anv: Share flush_pipeline_select_3d() between gen7 and gen8
authorKristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
Mon, 15 Feb 2016 06:45:41 +0000 (22:45 -0800)
committerKristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
Tue, 16 Feb 2016 01:32:07 +0000 (17:32 -0800)
src/vulkan/anv_private.h
src/vulkan/gen7_cmd_buffer.c
src/vulkan/gen8_cmd_buffer.c
src/vulkan/genX_cmd_buffer.c

index a5c390674a36b863e3e2a2937fcc40856de7f549..160d5fe84e814f77a59e30f9391374006318b90f 100644 (file)
@@ -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);
index 4bec8a620c5a9419cfe0f351f4ef9cf15ee554f0..be71379870923ee277171c8d21e27a4f3aa0ef6d 100644 (file)
@@ -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);
index 82f7eb1f48f3c4a1c156952d3d93d6fc1d2facf5..1635a53b32a303500798f021b36aba1b8bdecfc7 100644 (file)
@@ -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;
 
index 923f2086717d08fad67f08ab51542ac9bf169d90..7c6ad43a9b234921b34b095cac132c55c114c84b 100644 (file)
@@ -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;
+   }
+}