mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-22 22:50:32 +01:00
anv: reduce blorp dynamic state emissions
Just enable the work done in the previous commit. Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28368>
This commit is contained in:
parent
a147ccaa5c
commit
fe1baa6481
5 changed files with 76 additions and 20 deletions
|
|
@ -91,6 +91,23 @@ upload_blorp_shader(struct blorp_batch *batch, uint32_t stage,
|
|||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
upload_dynamic_state(struct blorp_context *context,
|
||||
const void *data, uint32_t size,
|
||||
uint32_t alignment, enum blorp_dynamic_state name)
|
||||
{
|
||||
struct anv_device *device = context->driver_ctx;
|
||||
|
||||
device->blorp.dynamic_states[name].state =
|
||||
anv_state_pool_emit_data(&device->dynamic_state_pool,
|
||||
size, alignment, data);
|
||||
if (device->vk.enabled_extensions.EXT_descriptor_buffer) {
|
||||
device->blorp.dynamic_states[name].db_state =
|
||||
anv_state_pool_emit_data(&device->dynamic_state_db_pool,
|
||||
size, alignment, data);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
anv_device_init_blorp(struct anv_device *device)
|
||||
{
|
||||
|
|
@ -98,20 +115,38 @@ anv_device_init_blorp(struct anv_device *device)
|
|||
.use_mesh_shading = device->vk.enabled_extensions.EXT_mesh_shader,
|
||||
.use_unrestricted_depth_range =
|
||||
device->vk.enabled_extensions.EXT_depth_range_unrestricted,
|
||||
.use_cached_dynamic_states = true,
|
||||
};
|
||||
|
||||
blorp_init_brw(&device->blorp, device, &device->isl_dev,
|
||||
blorp_init_brw(&device->blorp.context, device, &device->isl_dev,
|
||||
device->physical->compiler, &config);
|
||||
device->blorp.lookup_shader = lookup_blorp_shader;
|
||||
device->blorp.upload_shader = upload_blorp_shader;
|
||||
device->blorp.enable_tbimr = device->physical->instance->enable_tbimr;
|
||||
device->blorp.exec = anv_genX(device->info, blorp_exec);
|
||||
device->blorp.context.lookup_shader = lookup_blorp_shader;
|
||||
device->blorp.context.upload_shader = upload_blorp_shader;
|
||||
device->blorp.context.enable_tbimr = device->physical->instance->enable_tbimr;
|
||||
device->blorp.context.exec = anv_genX(device->info, blorp_exec);
|
||||
device->blorp.context.upload_dynamic_state = upload_dynamic_state;
|
||||
|
||||
anv_genX(device->info, blorp_init_dynamic_states)(&device->blorp.context);
|
||||
}
|
||||
|
||||
void
|
||||
anv_device_finish_blorp(struct anv_device *device)
|
||||
{
|
||||
blorp_finish(&device->blorp);
|
||||
#ifdef HAVE_VALGRIND
|
||||
/* We only need to free these to prevent valgrind errors. The backing
|
||||
* BO will go away in a couple of lines so we don't actually leak.
|
||||
*/
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(device->blorp.dynamic_states); i++) {
|
||||
anv_state_pool_free(&device->dynamic_state_pool,
|
||||
device->blorp.dynamic_states[i].state);
|
||||
if (device->vk.enabled_extensions.EXT_descriptor_buffer) {
|
||||
anv_state_pool_free(&device->dynamic_state_pool,
|
||||
device->blorp.dynamic_states[i].db_state);
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
blorp_finish(&device->blorp.context);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -134,7 +169,7 @@ anv_blorp_batch_init(struct anv_cmd_buffer *cmd_buffer,
|
|||
assert((flags & BLORP_BATCH_USE_BLITTER) == 0 ||
|
||||
(flags & BLORP_BATCH_USE_COMPUTE) == 0);
|
||||
|
||||
blorp_batch_init(&cmd_buffer->device->blorp, batch, cmd_buffer, flags);
|
||||
blorp_batch_init(&cmd_buffer->device->blorp.context, batch, cmd_buffer, flags);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -2956,17 +2956,6 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetInstanceProcAddr(
|
|||
return anv_GetInstanceProcAddr(instance, pName);
|
||||
}
|
||||
|
||||
static struct anv_state
|
||||
anv_state_pool_emit_data(struct anv_state_pool *pool, size_t size, size_t align, const void *p)
|
||||
{
|
||||
struct anv_state state;
|
||||
|
||||
state = anv_state_pool_alloc(pool, size, align);
|
||||
memcpy(state.map, p, size);
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
static void
|
||||
anv_device_init_border_colors(struct anv_device *device)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -204,6 +204,8 @@ void genX(cmd_buffer_dispatch_kernel)(struct anv_cmd_buffer *cmd_buffer,
|
|||
uint32_t arg_count,
|
||||
const struct anv_kernel_arg *args);
|
||||
|
||||
void genX(blorp_init_dynamic_states)(struct blorp_context *context);
|
||||
|
||||
void genX(blorp_exec)(struct blorp_batch *batch,
|
||||
const struct blorp_params *params);
|
||||
|
||||
|
|
|
|||
|
|
@ -842,6 +842,19 @@ anv_state_pool_state_address(struct anv_state_pool *pool, struct anv_state state
|
|||
};
|
||||
}
|
||||
|
||||
static inline struct anv_state
|
||||
anv_state_pool_emit_data(struct anv_state_pool *pool,
|
||||
size_t size, size_t align,
|
||||
const void *p)
|
||||
{
|
||||
struct anv_state state;
|
||||
|
||||
state = anv_state_pool_alloc(pool, size, align);
|
||||
memcpy(state.map, p, size);
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
void anv_state_stream_init(struct anv_state_stream *stream,
|
||||
struct anv_state_pool *state_pool,
|
||||
uint32_t block_size);
|
||||
|
|
@ -1781,7 +1794,14 @@ struct anv_device {
|
|||
|
||||
struct vk_pipeline_cache * default_pipeline_cache;
|
||||
struct vk_pipeline_cache * internal_cache;
|
||||
struct blorp_context blorp;
|
||||
|
||||
struct {
|
||||
struct blorp_context context;
|
||||
struct {
|
||||
struct anv_state state;
|
||||
struct anv_state db_state;
|
||||
} dynamic_states[BLORP_DYNAMIC_STATE_COUNT];
|
||||
} blorp;
|
||||
|
||||
struct anv_state border_colors;
|
||||
struct anv_state border_colors_db;
|
||||
|
|
|
|||
|
|
@ -120,7 +120,11 @@ static uint32_t
|
|||
blorp_get_dynamic_state(struct blorp_batch *batch,
|
||||
enum blorp_dynamic_state name)
|
||||
{
|
||||
unreachable("Not implemented");
|
||||
struct anv_cmd_buffer *cmd_buffer = batch->driver_batch;
|
||||
return (cmd_buffer->state.current_db_mode ==
|
||||
ANV_CMD_DESCRIPTOR_BUFFER_MODE_BUFFER) ?
|
||||
cmd_buffer->device->blorp.dynamic_states[name].db_state.offset :
|
||||
cmd_buffer->device->blorp.dynamic_states[name].state.offset;
|
||||
}
|
||||
|
||||
static void *
|
||||
|
|
@ -496,3 +500,9 @@ blorp_emit_post_draw(struct blorp_batch *batch, const struct blorp_params *param
|
|||
genX(emit_breakpoint)(&cmd_buffer->batch, cmd_buffer->device, false);
|
||||
blorp_measure_end(batch, params);
|
||||
}
|
||||
|
||||
void
|
||||
genX(blorp_init_dynamic_states)(struct blorp_context *context)
|
||||
{
|
||||
blorp_init_dynamic_states(context);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue