[Mesa-dev] [PATCH 4/4] i965/clip: Removing scissor atom

Ben Widawsky benjamin.widawsky at intel.com
Mon Aug 4 12:24:04 PDT 2014


On GEN8, a change in scissor state does not effect anything for the
clipper/sf hardware state. The hardware will always do the right thing
once the viewport extents are programmed. We can therefore remove the
unecessary state emission.

Ken originally spotted this.
---
 src/mesa/drivers/dri/i965/gen8_viewport_state.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen8_viewport_state.c b/src/mesa/drivers/dri/i965/gen8_viewport_state.c
index 04a4530..d7e06c4 100644
--- a/src/mesa/drivers/dri/i965/gen8_viewport_state.c
+++ b/src/mesa/drivers/dri/i965/gen8_viewport_state.c
@@ -100,13 +100,17 @@ gen8_upload_sf_clip_viewport(struct brw_context *brw)
       vp[10] = -gby; /* y-min */
       vp[11] =  gby; /* y-max */
 
-      /* _NEW_SCISSOR | _NEW_VIEWPORT | _NEW_BUFFERS: Screen Space Viewport
+      /* _NEW_VIEWPORT | _NEW_BUFFERS: Screen Space Viewport
        * The hardware will take the intersection of the drawing rectangle,
        * scissor rectangle, and the viewport extents. We don't need to be
        * smart, and can therefore just program the viewport extents.
        */
       float viewport_Xmax = ctx->ViewportArray[i].X + ctx->ViewportArray[i].Width;
       float viewport_Ymax = ctx->ViewportArray[i].Y + ctx->ViewportArray[i].Height;
+      if (viewport_Ymax < ctx->DrawBuffer->_Ymax ||
+            viewport_Xmax < ctx->DrawBuffer->_Xmax) {
+            perf_debug("Using viewport extents for savings\n");
+      }
       if (render_to_fbo) {
          vp[12] = ctx->ViewportArray[i].X;
          vp[13] = viewport_Xmax - 1;
@@ -130,7 +134,7 @@ gen8_upload_sf_clip_viewport(struct brw_context *brw)
 
 const struct brw_tracked_state gen8_sf_clip_viewport = {
    .dirty = {
-      .mesa = _NEW_BUFFERS | _NEW_SCISSOR | _NEW_VIEWPORT,
+      .mesa = _NEW_BUFFERS | _NEW_VIEWPORT,
       .brw = BRW_NEW_BATCH,
       .cache = 0,
    },
-- 
2.0.3



More information about the mesa-dev mailing list