iris: Allocate shader variant in caller of iris_upload_shader
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11229>
This commit is contained in:
@@ -949,6 +949,7 @@ struct iris_compiled_shader *iris_create_shader_variant(const struct iris_screen
|
|||||||
|
|
||||||
struct iris_compiled_shader *iris_upload_shader(struct iris_screen *screen,
|
struct iris_compiled_shader *iris_upload_shader(struct iris_screen *screen,
|
||||||
struct iris_uncompiled_shader *,
|
struct iris_uncompiled_shader *,
|
||||||
|
struct iris_compiled_shader *,
|
||||||
struct hash_table *driver_ht,
|
struct hash_table *driver_ht,
|
||||||
struct u_upload_mgr *uploader,
|
struct u_upload_mgr *uploader,
|
||||||
enum iris_program_cache_id,
|
enum iris_program_cache_id,
|
||||||
|
@@ -245,10 +245,12 @@ iris_disk_cache_retrieve(struct iris_screen *screen,
|
|||||||
* return it to the caller.
|
* return it to the caller.
|
||||||
*/
|
*/
|
||||||
struct iris_compiled_shader *shader =
|
struct iris_compiled_shader *shader =
|
||||||
iris_upload_shader(screen, ish, NULL, uploader,
|
iris_create_shader_variant(screen, NULL, cache_id, key_size, prog_key);
|
||||||
cache_id, key_size, prog_key, assembly,
|
|
||||||
prog_data, so_decls, system_values,
|
shader = iris_upload_shader(screen, ish, shader, NULL, uploader,
|
||||||
num_system_values, kernel_input_size, num_cbufs, &bt);
|
cache_id, key_size, prog_key, assembly,
|
||||||
|
prog_data, so_decls, system_values,
|
||||||
|
num_system_values, kernel_input_size, num_cbufs, &bt);
|
||||||
|
|
||||||
free(buffer);
|
free(buffer);
|
||||||
|
|
||||||
|
@@ -1221,10 +1221,12 @@ iris_compile_vs(struct iris_screen *screen,
|
|||||||
&vue_prog_data->vue_map);
|
&vue_prog_data->vue_map);
|
||||||
|
|
||||||
struct iris_compiled_shader *shader =
|
struct iris_compiled_shader *shader =
|
||||||
iris_upload_shader(screen, ish, NULL, uploader,
|
iris_create_shader_variant(screen, NULL, IRIS_CACHE_VS, sizeof(*key), key);
|
||||||
IRIS_CACHE_VS, sizeof(*key), key, program,
|
|
||||||
prog_data, so_decls, system_values, num_system_values,
|
shader = iris_upload_shader(screen, ish, shader, NULL, uploader,
|
||||||
0, num_cbufs, &bt);
|
IRIS_CACHE_VS, sizeof(*key), key, program,
|
||||||
|
prog_data, so_decls, system_values, num_system_values,
|
||||||
|
0, num_cbufs, &bt);
|
||||||
|
|
||||||
iris_disk_cache_store(screen->disk_cache, ish, shader, key, sizeof(*key));
|
iris_disk_cache_store(screen->disk_cache, ish, shader, key, sizeof(*key));
|
||||||
|
|
||||||
@@ -1410,11 +1412,16 @@ iris_compile_tcs(struct iris_screen *screen,
|
|||||||
|
|
||||||
iris_debug_recompile(screen, dbg, ish, &brw_key.base);
|
iris_debug_recompile(screen, dbg, ish, &brw_key.base);
|
||||||
|
|
||||||
|
void *passthrough_mem_ctx = (ish != NULL) ? NULL : passthrough_ht;
|
||||||
|
|
||||||
struct iris_compiled_shader *shader =
|
struct iris_compiled_shader *shader =
|
||||||
iris_upload_shader(screen, ish, passthrough_ht, uploader,
|
iris_create_shader_variant(screen, passthrough_mem_ctx, IRIS_CACHE_TCS,
|
||||||
IRIS_CACHE_TCS, sizeof(*key), key, program,
|
sizeof(*key), key);
|
||||||
prog_data, NULL, system_values, num_system_values,
|
|
||||||
0, num_cbufs, &bt);
|
shader = iris_upload_shader(screen, ish, shader, passthrough_ht, uploader,
|
||||||
|
IRIS_CACHE_TCS, sizeof(*key), key, program,
|
||||||
|
prog_data, NULL, system_values, num_system_values,
|
||||||
|
0, num_cbufs, &bt);
|
||||||
|
|
||||||
if (ish)
|
if (ish)
|
||||||
iris_disk_cache_store(screen->disk_cache, ish, shader, key, sizeof(*key));
|
iris_disk_cache_store(screen->disk_cache, ish, shader, key, sizeof(*key));
|
||||||
@@ -1546,12 +1553,13 @@ iris_compile_tes(struct iris_screen *screen,
|
|||||||
screen->vtbl.create_so_decl_list(&ish->stream_output,
|
screen->vtbl.create_so_decl_list(&ish->stream_output,
|
||||||
&vue_prog_data->vue_map);
|
&vue_prog_data->vue_map);
|
||||||
|
|
||||||
|
|
||||||
struct iris_compiled_shader *shader =
|
struct iris_compiled_shader *shader =
|
||||||
iris_upload_shader(screen, ish, NULL, uploader,
|
iris_create_shader_variant(screen, NULL, IRIS_CACHE_TES, sizeof(*key), key);
|
||||||
IRIS_CACHE_TES, sizeof(*key), key, program,
|
|
||||||
prog_data, so_decls, system_values, num_system_values,
|
shader = iris_upload_shader(screen, ish, shader, NULL, uploader,
|
||||||
0, num_cbufs, &bt);
|
IRIS_CACHE_TES, sizeof(*key), key, program,
|
||||||
|
prog_data, so_decls, system_values, num_system_values,
|
||||||
|
0, num_cbufs, &bt);
|
||||||
|
|
||||||
iris_disk_cache_store(screen->disk_cache, ish, shader, key, sizeof(*key));
|
iris_disk_cache_store(screen->disk_cache, ish, shader, key, sizeof(*key));
|
||||||
|
|
||||||
@@ -1674,10 +1682,12 @@ iris_compile_gs(struct iris_screen *screen,
|
|||||||
&vue_prog_data->vue_map);
|
&vue_prog_data->vue_map);
|
||||||
|
|
||||||
struct iris_compiled_shader *shader =
|
struct iris_compiled_shader *shader =
|
||||||
iris_upload_shader(screen, ish, NULL, uploader,
|
iris_create_shader_variant(screen, NULL, IRIS_CACHE_GS, sizeof(*key), key);
|
||||||
IRIS_CACHE_GS, sizeof(*key), key, program,
|
|
||||||
prog_data, so_decls, system_values, num_system_values,
|
shader = iris_upload_shader(screen, ish, shader, NULL, uploader,
|
||||||
0, num_cbufs, &bt);
|
IRIS_CACHE_GS, sizeof(*key), key, program,
|
||||||
|
prog_data, so_decls, system_values, num_system_values,
|
||||||
|
0, num_cbufs, &bt);
|
||||||
|
|
||||||
iris_disk_cache_store(screen->disk_cache, ish, shader, key, sizeof(*key));
|
iris_disk_cache_store(screen->disk_cache, ish, shader, key, sizeof(*key));
|
||||||
|
|
||||||
@@ -1801,10 +1811,12 @@ iris_compile_fs(struct iris_screen *screen,
|
|||||||
iris_debug_recompile(screen, dbg, ish, &brw_key.base);
|
iris_debug_recompile(screen, dbg, ish, &brw_key.base);
|
||||||
|
|
||||||
struct iris_compiled_shader *shader =
|
struct iris_compiled_shader *shader =
|
||||||
iris_upload_shader(screen, ish, NULL, uploader,
|
iris_create_shader_variant(screen, NULL, IRIS_CACHE_FS, sizeof(*key), key);
|
||||||
IRIS_CACHE_FS, sizeof(*key), key, program,
|
|
||||||
prog_data, NULL, system_values, num_system_values,
|
shader = iris_upload_shader(screen, ish, shader, NULL, uploader,
|
||||||
0, num_cbufs, &bt);
|
IRIS_CACHE_FS, sizeof(*key), key, program,
|
||||||
|
prog_data, NULL, system_values, num_system_values,
|
||||||
|
0, num_cbufs, &bt);
|
||||||
|
|
||||||
iris_disk_cache_store(screen->disk_cache, ish, shader, key, sizeof(*key));
|
iris_disk_cache_store(screen->disk_cache, ish, shader, key, sizeof(*key));
|
||||||
|
|
||||||
@@ -2068,10 +2080,12 @@ iris_compile_cs(struct iris_screen *screen,
|
|||||||
iris_debug_recompile(screen, dbg, ish, &brw_key.base);
|
iris_debug_recompile(screen, dbg, ish, &brw_key.base);
|
||||||
|
|
||||||
struct iris_compiled_shader *shader =
|
struct iris_compiled_shader *shader =
|
||||||
iris_upload_shader(screen, ish, NULL, uploader,
|
iris_create_shader_variant(screen, NULL, IRIS_CACHE_CS, sizeof(*key), key);
|
||||||
IRIS_CACHE_CS, sizeof(*key), key, program,
|
|
||||||
prog_data, NULL, system_values, num_system_values,
|
shader = iris_upload_shader(screen, ish, shader, NULL, uploader,
|
||||||
ish->kernel_input_size, num_cbufs, &bt);
|
IRIS_CACHE_CS, sizeof(*key), key, program,
|
||||||
|
prog_data, NULL, system_values, num_system_values,
|
||||||
|
ish->kernel_input_size, num_cbufs, &bt);
|
||||||
|
|
||||||
iris_disk_cache_store(screen->disk_cache, ish, shader, key, sizeof(*key));
|
iris_disk_cache_store(screen->disk_cache, ish, shader, key, sizeof(*key));
|
||||||
|
|
||||||
|
@@ -146,6 +146,7 @@ iris_create_shader_variant(const struct iris_screen *screen,
|
|||||||
struct iris_compiled_shader *
|
struct iris_compiled_shader *
|
||||||
iris_upload_shader(struct iris_screen *screen,
|
iris_upload_shader(struct iris_screen *screen,
|
||||||
struct iris_uncompiled_shader *ish,
|
struct iris_uncompiled_shader *ish,
|
||||||
|
struct iris_compiled_shader *shader,
|
||||||
struct hash_table *driver_shaders,
|
struct hash_table *driver_shaders,
|
||||||
struct u_upload_mgr *uploader,
|
struct u_upload_mgr *uploader,
|
||||||
enum iris_program_cache_id cache_id,
|
enum iris_program_cache_id cache_id,
|
||||||
@@ -162,11 +163,6 @@ iris_upload_shader(struct iris_screen *screen,
|
|||||||
{
|
{
|
||||||
const struct intel_device_info *devinfo = &screen->devinfo;
|
const struct intel_device_info *devinfo = &screen->devinfo;
|
||||||
|
|
||||||
void *mem_ctx = ish ? NULL : (void *) driver_shaders;
|
|
||||||
|
|
||||||
struct iris_compiled_shader *shader =
|
|
||||||
iris_create_shader_variant(screen, mem_ctx, cache_id, key_size, key);
|
|
||||||
|
|
||||||
u_upload_alloc(uploader, 0, prog_data->program_size, 64,
|
u_upload_alloc(uploader, 0, prog_data->program_size, 64,
|
||||||
&shader->assembly.offset, &shader->assembly.res,
|
&shader->assembly.offset, &shader->assembly.res,
|
||||||
&shader->map);
|
&shader->map);
|
||||||
@@ -280,10 +276,13 @@ iris_blorp_upload_shader(struct blorp_batch *blorp_batch, uint32_t stage,
|
|||||||
memset(&bt, 0, sizeof(bt));
|
memset(&bt, 0, sizeof(bt));
|
||||||
|
|
||||||
struct iris_compiled_shader *shader =
|
struct iris_compiled_shader *shader =
|
||||||
iris_upload_shader(screen, NULL, ice->shaders.cache,
|
iris_create_shader_variant(screen, ice->shaders.cache, IRIS_CACHE_BLORP,
|
||||||
ice->shaders.uploader_driver,
|
key_size, key);
|
||||||
IRIS_CACHE_BLORP, key_size, key, kernel,
|
|
||||||
prog_data, NULL, NULL, 0, 0, 0, &bt);
|
iris_upload_shader(screen, NULL, shader, ice->shaders.cache,
|
||||||
|
ice->shaders.uploader_driver,
|
||||||
|
IRIS_CACHE_BLORP, key_size, key, kernel,
|
||||||
|
prog_data, NULL, NULL, 0, 0, 0, &bt);
|
||||||
|
|
||||||
struct iris_bo *bo = iris_resource_bo(shader->assembly.res);
|
struct iris_bo *bo = iris_resource_bo(shader->assembly.res);
|
||||||
*kernel_out =
|
*kernel_out =
|
||||||
|
Reference in New Issue
Block a user