[Mesa-dev] [PATCH 5/5] anv: Emit DRAWING_RECTANGLE once at driver initialization

Jason Ekstrand jason at jlekstrand.net
Fri May 20 19:41:08 UTC 2016


Also, we don't actually need it for clipping because meta always colors
inside the lines and, for all other operations, the user is required to set
a scissor.  Since DRAWING_RECTANGLE stalls the GPU, we want to emit it as
little as possible.
---
 src/intel/vulkan/genX_cmd_buffer.c | 13 -------------
 src/intel/vulkan/genX_state.c      |  9 +++++++++
 2 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
index 64172ca..e7d322c 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -1128,19 +1128,6 @@ void genX(CmdBeginRenderPass)(
 
    genX(flush_pipeline_select_3d)(cmd_buffer);
 
-   const VkRect2D *render_area = &pRenderPassBegin->renderArea;
-
-   anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_DRAWING_RECTANGLE), r) {
-      r.ClippedDrawingRectangleYMin = MAX2(render_area->offset.y, 0);
-      r.ClippedDrawingRectangleXMin = MAX2(render_area->offset.x, 0);
-      r.ClippedDrawingRectangleYMax =
-         render_area->offset.y + render_area->extent.height - 1;
-      r.ClippedDrawingRectangleXMax =
-         render_area->offset.x + render_area->extent.width - 1;
-      r.DrawingRectangleOriginY     = 0;
-      r.DrawingRectangleOriginX     = 0;
-   }
-
    genX(cmd_buffer_set_subpass)(cmd_buffer, pass->subpasses);
    anv_cmd_buffer_clear_subpass(cmd_buffer);
 }
diff --git a/src/intel/vulkan/genX_state.c b/src/intel/vulkan/genX_state.c
index a53555c..f67b0a7 100644
--- a/src/intel/vulkan/genX_state.c
+++ b/src/intel/vulkan/genX_state.c
@@ -61,6 +61,15 @@ genX(init_device_state)(struct anv_device *device)
    anv_batch_emit(&batch, GENX(3DSTATE_STREAMOUT), so);
    anv_batch_emit(&batch, GENX(3DSTATE_AA_LINE_PARAMETERS), aa);
 
+   anv_batch_emit(&batch, GENX(3DSTATE_DRAWING_RECTANGLE), rect) {
+      rect.ClippedDrawingRectangleYMin = 0;
+      rect.ClippedDrawingRectangleXMin = 0;
+      rect.ClippedDrawingRectangleYMax = UINT16_MAX;
+      rect.ClippedDrawingRectangleXMax = UINT16_MAX;
+      rect.DrawingRectangleOriginY = 0;
+      rect.DrawingRectangleOriginX = 0;
+   }
+
 #if GEN_GEN >= 8
    anv_batch_emit(&batch, GENX(3DSTATE_WM_CHROMAKEY), ck);
 
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list