From 19c3f3ede495232913fa4204c62f31ecb6fda305 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Mon, 31 Jul 2023 15:12:32 +0300 Subject: [PATCH] anv: categorize partial/final pipeline instruction MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The old gfx8 field doesn't apply anymore. Signed-off-by: Lionel Landwerlin Reviewed-by: Tapani Pälli Part-of: --- src/intel/vulkan/anv_private.h | 10 +++++++--- src/intel/vulkan/genX_cmd_buffer.c | 4 ++-- src/intel/vulkan/genX_gfx_state.c | 12 ++++++------ src/intel/vulkan/genX_pipeline.c | 22 +++++++++++----------- 4 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 18849a6..9200cf4 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -3572,6 +3572,12 @@ struct anv_graphics_pipeline { */ uint32_t batch_data[416]; + /* Fully backed instructions, ready to be emitted in the anv_cmd_buffer */ + struct { + uint32_t hs[9]; + uint32_t ds[11]; + } final; + /* Pre packed CS instructions & structures that need to be merged later * with dynamic state. */ @@ -3581,10 +3587,8 @@ struct anv_graphics_pipeline { uint32_t raster[5]; uint32_t wm[2]; uint32_t streamout_state[5]; - uint32_t hs[9]; - uint32_t ds[11]; uint32_t gs[10]; - } gfx8; + } partial; }; struct anv_compute_pipeline { diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 2dc8f13..df11300 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -2997,7 +2997,7 @@ genX(emit_hs)(struct anv_cmd_buffer *cmd_buffer) uint32_t *dw = anv_batch_emitn(&cmd_buffer->batch, GENX(3DSTATE_HS_length), GENX(3DSTATE_HS)); - memcpy(dw, &pipeline->gfx8.hs, sizeof(pipeline->gfx8.hs)); + memcpy(dw, &pipeline->final.hs, sizeof(pipeline->final.hs)); } ALWAYS_INLINE static void @@ -3025,7 +3025,7 @@ genX(emit_ds)(struct anv_cmd_buffer *cmd_buffer) uint32_t *dw = anv_batch_emitn(&cmd_buffer->batch, GENX(3DSTATE_DS_length), GENX(3DSTATE_DS)); - memcpy(dw, &pipeline->gfx8.ds, sizeof(pipeline->gfx8.ds)); + memcpy(dw, &pipeline->final.ds, sizeof(pipeline->final.ds)); #endif } diff --git a/src/intel/vulkan/genX_gfx_state.c b/src/intel/vulkan/genX_gfx_state.c index 172c596..e7d458c 100644 --- a/src/intel/vulkan/genX_gfx_state.c +++ b/src/intel/vulkan/genX_gfx_state.c @@ -294,7 +294,7 @@ genX(emit_gs)(struct anv_cmd_buffer *cmd_buffer) const struct vk_dynamic_graphics_state *dyn = &cmd_buffer->vk.dynamic_graphics_state; anv_batch_emit_merge(&cmd_buffer->batch, GENX(3DSTATE_GS), - pipeline->gfx8.gs, gs) { + pipeline->partial.gs, gs) { switch (dyn->rs.provoking_vertex) { case VK_PROVOKING_VERTEX_MODE_FIRST_VERTEX_EXT: gs.ReorderMode = LEADING; @@ -506,7 +506,7 @@ cmd_buffer_emit_clip(struct anv_cmd_buffer *cmd_buffer) return; anv_batch_emit_merge(&cmd_buffer->batch, GENX(3DSTATE_CLIP), - pipeline->gfx8.clip, clip) { + pipeline->partial.clip, clip) { /* Take dynamic primitive topology in to account with * 3DSTATE_CLIP::ViewportXYClipTestEnable */ @@ -575,7 +575,7 @@ cmd_buffer_emit_streamout(struct anv_cmd_buffer *cmd_buffer) genX(streamout_prologue)(cmd_buffer); anv_batch_emit_merge(&cmd_buffer->batch, GENX(3DSTATE_STREAMOUT), - pipeline->gfx8.streamout_state, so) { + pipeline->partial.streamout_state, so) { so.RenderingDisable = dyn->rs.rasterizer_discard_enable; so.RenderStreamSelect = dyn->rs.rasterization_stream; #if INTEL_NEEDS_WA_18022508906 @@ -939,7 +939,7 @@ genX(cmd_buffer_flush_dynamic_state)(struct anv_cmd_buffer *cmd_buffer) BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_RS_PROVOKING_VERTEX) || BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_RS_DEPTH_BIAS_FACTORS)) { anv_batch_emit_merge(&cmd_buffer->batch, GENX(3DSTATE_SF), - pipeline->gfx8.sf, sf) { + pipeline->partial.sf, sf) { ANV_SETUP_PROVOKING_VERTEX(sf, dyn->rs.provoking_vertex); sf.LineWidth = dyn->rs.line.width; @@ -1021,7 +1021,7 @@ genX(cmd_buffer_flush_dynamic_state)(struct anv_cmd_buffer *cmd_buffer) vk_rasterization_state_depth_clip_enable(&dyn->rs); anv_batch_emit_merge(&cmd_buffer->batch, GENX(3DSTATE_RASTER), - pipeline->gfx8.raster, raster) { + pipeline->partial.raster, raster) { raster.APIMode = api_mode; raster.DXMultisampleRasterizationEnable = msaa_raster_enable; raster.AntialiasingEnable = aa_enable; @@ -1205,7 +1205,7 @@ genX(cmd_buffer_flush_dynamic_state)(struct anv_cmd_buffer *cmd_buffer) * threads. */ anv_batch_emit_merge(&cmd_buffer->batch, GENX(3DSTATE_WM), - pipeline->gfx8.wm, wm) { + pipeline->partial.wm, wm) { wm.ForceThreadDispatchEnable = anv_pipeline_has_stage(pipeline, MESA_SHADER_FRAGMENT) && (pipeline->force_fragment_thread_dispatch || anv_cmd_buffer_all_color_write_masked(cmd_buffer)) ? diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c index 3377ef4..bac487a 100644 --- a/src/intel/vulkan/genX_pipeline.c +++ b/src/intel/vulkan/genX_pipeline.c @@ -746,8 +746,8 @@ emit_rs_state(struct anv_graphics_pipeline *pipeline, raster.ScissorRectangleEnable = true; - GENX(3DSTATE_SF_pack)(NULL, pipeline->gfx8.sf, &sf); - GENX(3DSTATE_RASTER_pack)(NULL, pipeline->gfx8.raster, &raster); + GENX(3DSTATE_SF_pack)(NULL, pipeline->partial.sf, &sf); + GENX(3DSTATE_RASTER_pack)(NULL, pipeline->partial.raster, &raster); } static void @@ -890,7 +890,7 @@ emit_3dstate_clip(struct anv_graphics_pipeline *pipeline, clip.NonPerspectiveBarycentricEnable = wm_prog_data ? wm_prog_data->uses_nonperspective_interp_modes : 0; - GENX(3DSTATE_CLIP_pack)(NULL, pipeline->gfx8.clip, &clip); + GENX(3DSTATE_CLIP_pack)(NULL, pipeline->partial.clip, &clip); #if GFX_VERx10 >= 125 if (anv_pipeline_is_mesh(pipeline)) { @@ -1073,7 +1073,7 @@ emit_3dstate_streamout(struct anv_graphics_pipeline *pipeline, so.Stream3VertexReadLength = urb_entry_read_length - 1; } - GENX(3DSTATE_STREAMOUT_pack)(NULL, pipeline->gfx8.streamout_state, &so); + GENX(3DSTATE_STREAMOUT_pack)(NULL, pipeline->partial.streamout_state, &so); } static uint32_t @@ -1277,8 +1277,8 @@ emit_3dstate_hs_ds(struct anv_graphics_pipeline *pipeline, hs.DispatchMode = tcs_prog_data->base.dispatch_mode; hs.IncludePrimitiveID = tcs_prog_data->include_primitive_id; - STATIC_ASSERT(ARRAY_SIZE(pipeline->gfx8.hs) == GENX(3DSTATE_HS_length)); - GENX(3DSTATE_HS_pack)(&pipeline->base.base.batch, pipeline->gfx8.hs, &hs); + STATIC_ASSERT(ARRAY_SIZE(pipeline->final.hs) == GENX(3DSTATE_HS_length)); + GENX(3DSTATE_HS_pack)(&pipeline->base.base.batch, pipeline->final.hs, &hs); struct GENX(3DSTATE_DS) ds = { GENX(3DSTATE_DS_header), @@ -1332,12 +1332,12 @@ emit_3dstate_hs_ds(struct anv_graphics_pipeline *pipeline, * We need to both emit 3DSTATE_DS now, and before each 3DPRIMITIVE, so * we pack it to have it later, and memcpy into the current batch. */ - STATIC_ASSERT(ARRAY_SIZE(pipeline->gfx8.ds) == GENX(3DSTATE_DS_length)); - GENX(3DSTATE_DS_pack)(&pipeline->base.base.batch, pipeline->gfx8.ds, &ds); + STATIC_ASSERT(ARRAY_SIZE(pipeline->final.ds) == GENX(3DSTATE_DS_length)); + GENX(3DSTATE_DS_pack)(&pipeline->base.base.batch, pipeline->final.ds, &ds); uint32_t *dw = anv_batch_emitn(batch, GENX(3DSTATE_DS_length), GENX(3DSTATE_DS)); - memcpy(dw, &pipeline->gfx8.ds, sizeof(pipeline->gfx8.ds)); + memcpy(dw, &pipeline->final.ds, sizeof(pipeline->final.ds)); } static void @@ -1400,7 +1400,7 @@ emit_3dstate_gs(struct anv_graphics_pipeline *pipeline) #endif } - GENX(3DSTATE_GS_pack)(&pipeline->base.base.batch, pipeline->gfx8.gs, &gs); + GENX(3DSTATE_GS_pack)(&pipeline->base.base.batch, pipeline->partial.gs, &gs); } static bool @@ -1462,7 +1462,7 @@ emit_3dstate_wm(struct anv_graphics_pipeline *pipeline, pipeline->fs_msaa_flags); } - GENX(3DSTATE_WM_pack)(NULL, pipeline->gfx8.wm, &wm); + GENX(3DSTATE_WM_pack)(NULL, pipeline->partial.wm, &wm); } static void -- 2.7.4