From: Kristian Høgsberg Kristensen Date: Mon, 15 Feb 2016 06:45:41 +0000 (-0800) Subject: anv: Share flush_pipeline_select_3d() between gen7 and gen8 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=832f73f512e9e6c21d495d7b07e229482371ef2f;p=mesa.git anv: Share flush_pipeline_select_3d() between gen7 and gen8 --- diff --git a/src/vulkan/anv_private.h b/src/vulkan/anv_private.h index a5c390674a3..160d5fe84e8 100644 --- a/src/vulkan/anv_private.h +++ b/src/vulkan/anv_private.h @@ -1293,6 +1293,11 @@ void gen9_cmd_buffer_set_subpass(struct anv_cmd_buffer *cmd_buffer, void anv_cmd_buffer_set_subpass(struct anv_cmd_buffer *cmd_buffer, struct anv_subpass *subpass); +void gen7_flush_pipeline_select_3d(struct anv_cmd_buffer *cmd_buffer); +void gen75_flush_pipeline_select_3d(struct anv_cmd_buffer *cmd_buffer); +void gen8_flush_pipeline_select_3d(struct anv_cmd_buffer *cmd_buffer); +void gen9_flush_pipeline_select_3d(struct anv_cmd_buffer *cmd_buffer); + void gen7_cmd_buffer_flush_state(struct anv_cmd_buffer *cmd_buffer); void gen75_cmd_buffer_flush_state(struct anv_cmd_buffer *cmd_buffer); void gen8_cmd_buffer_flush_state(struct anv_cmd_buffer *cmd_buffer); diff --git a/src/vulkan/gen7_cmd_buffer.c b/src/vulkan/gen7_cmd_buffer.c index 4bec8a620c5..be713798709 100644 --- a/src/vulkan/gen7_cmd_buffer.c +++ b/src/vulkan/gen7_cmd_buffer.c @@ -364,11 +364,7 @@ genX(cmd_buffer_flush_state)(struct anv_cmd_buffer *cmd_buffer) assert((pipeline->active_stages & VK_SHADER_STAGE_COMPUTE_BIT) == 0); - if (cmd_buffer->state.current_pipeline != _3D) { - anv_batch_emit(&cmd_buffer->batch, GEN7_PIPELINE_SELECT, - .PipelineSelection = _3D); - cmd_buffer->state.current_pipeline = _3D; - } + genX(flush_pipeline_select_3d)(cmd_buffer); if (vb_emit) { const uint32_t num_buffers = __builtin_popcount(vb_emit); diff --git a/src/vulkan/gen8_cmd_buffer.c b/src/vulkan/gen8_cmd_buffer.c index 82f7eb1f48f..1635a53b32a 100644 --- a/src/vulkan/gen8_cmd_buffer.c +++ b/src/vulkan/gen8_cmd_buffer.c @@ -200,21 +200,6 @@ config_l3(struct anv_cmd_buffer *cmd_buffer, bool enable_slm) } } -static void -flush_pipeline_select_3d(struct anv_cmd_buffer *cmd_buffer) -{ - config_l3(cmd_buffer, false); - - if (cmd_buffer->state.current_pipeline != _3D) { - anv_batch_emit(&cmd_buffer->batch, GENX(PIPELINE_SELECT), -#if ANV_GEN >= 9 - .MaskBits = 3, -#endif - .PipelineSelection = _3D); - cmd_buffer->state.current_pipeline = _3D; - } -} - static void __emit_genx_sf_state(struct anv_cmd_buffer *cmd_buffer) { @@ -261,7 +246,9 @@ genX(cmd_buffer_flush_state)(struct anv_cmd_buffer *cmd_buffer) assert((pipeline->active_stages & VK_SHADER_STAGE_COMPUTE_BIT) == 0); - flush_pipeline_select_3d(cmd_buffer); + config_l3(cmd_buffer, false); + + genX(flush_pipeline_select_3d)(cmd_buffer); if (vb_emit) { const uint32_t num_buffers = __builtin_popcount(vb_emit); @@ -735,7 +722,7 @@ void genX(CmdBeginRenderPass)( cmd_buffer->state.pass = pass; anv_cmd_state_setup_attachments(cmd_buffer, pRenderPassBegin); - flush_pipeline_select_3d(cmd_buffer); + genX(flush_pipeline_select_3d)(cmd_buffer); const VkRect2D *render_area = &pRenderPassBegin->renderArea; diff --git a/src/vulkan/genX_cmd_buffer.c b/src/vulkan/genX_cmd_buffer.c index 923f2086717..7c6ad43a9b2 100644 --- a/src/vulkan/genX_cmd_buffer.c +++ b/src/vulkan/genX_cmd_buffer.c @@ -535,3 +535,16 @@ void genX(CmdDispatchIndirect)( anv_batch_emit(&cmd_buffer->batch, GENX(MEDIA_STATE_FLUSH)); } + +void +genX(flush_pipeline_select_3d)(struct anv_cmd_buffer *cmd_buffer) +{ + if (cmd_buffer->state.current_pipeline != _3D) { + anv_batch_emit(&cmd_buffer->batch, GENX(PIPELINE_SELECT), +#if ANV_GEN >= 9 + .MaskBits = 3, +#endif + .PipelineSelection = _3D); + cmd_buffer->state.current_pipeline = _3D; + } +}