i965: Always scissor on Gen4-5 instead of disabling guardband.
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 11 May 2017 07:03:05 +0000 (00:03 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 30 May 2017 04:46:48 +0000 (21:46 -0700)
See commit ece0e535a44c228dd994861592deb155c14740d8.  This makes
Gen4-5 follow the behavior we use on Gen6+.  It seems to have
worked out there.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/mesa/drivers/dri/i965/brw_clip_state.c
src/mesa/drivers/dri/i965/brw_sf_state.c

index 5ab254dbb54f707be057a9491a601964ee8712a6..8f22c0ff6737da2a19d4e09f04bff5d11e718915 100644 (file)
@@ -41,11 +41,6 @@ brw_upload_clip_unit(struct brw_context *brw)
    struct gl_context *ctx = &brw->ctx;
    struct brw_clip_unit_state *clip;
 
-   /* _NEW_BUFFERS */
-   const struct gl_framebuffer *fb = ctx->DrawBuffer;
-   const float fb_width = (float)_mesa_geometric_width(fb);
-   const float fb_height = (float)_mesa_geometric_height(fb);
-
    clip = brw_state_batch(brw, sizeof(*clip), 32, &brw->clip.state_offset);
    memset(clip, 0, sizeof(*clip));
 
@@ -104,22 +99,16 @@ brw_upload_clip_unit(struct brw_context *brw)
    clip->clip5.userclip_must_clip = 1;
 
    /* enable guardband clipping if we can */
-   if (ctx->ViewportArray[0].X == 0 &&
-       ctx->ViewportArray[0].Y == 0 &&
-       ctx->ViewportArray[0].Width == fb_width &&
-       ctx->ViewportArray[0].Height == fb_height)
-   {
-      clip->clip5.guard_band_enable = 1;
-      clip->clip6.clipper_viewport_state_ptr =
-         (brw->batch.bo->offset64 + brw->clip.vp_offset) >> 5;
-
-      /* emit clip viewport relocation */
-      brw_emit_reloc(&brw->batch,
-                     (brw->clip.state_offset +
-                      offsetof(struct brw_clip_unit_state, clip6)),
-                     brw->batch.bo, brw->clip.vp_offset,
-                     I915_GEM_DOMAIN_INSTRUCTION, 0);
-   }
+   clip->clip5.guard_band_enable = 1;
+   clip->clip6.clipper_viewport_state_ptr =
+      (brw->batch.bo->offset64 + brw->clip.vp_offset) >> 5;
+
+   /* emit clip viewport relocation */
+   brw_emit_reloc(&brw->batch,
+                  (brw->clip.state_offset +
+                   offsetof(struct brw_clip_unit_state, clip6)),
+                  brw->batch.bo, brw->clip.vp_offset,
+                  I915_GEM_DOMAIN_INSTRUCTION, 0);
 
    /* _NEW_TRANSFORM */
    if (!ctx->Transform.DepthClamp)
@@ -145,8 +134,7 @@ brw_upload_clip_unit(struct brw_context *brw)
 
 const struct brw_tracked_state brw_clip_unit = {
    .dirty = {
-      .mesa  = _NEW_BUFFERS |
-               _NEW_TRANSFORM |
+      .mesa  = _NEW_TRANSFORM |
                _NEW_VIEWPORT,
       .brw   = BRW_NEW_BATCH |
                BRW_NEW_BLORP |
index a758581697c58cfb52d760d4317b54cfc61487fa..8cc81c984c7999ffca46f61b4001f5352f8c4a0b 100644 (file)
@@ -90,9 +90,7 @@ static void upload_sf_unit( struct brw_context *brw )
 
    sf->sf5.viewport_transform = 1;
 
-   /* _NEW_SCISSOR */
-   if (ctx->Scissor.EnableFlags)
-      sf->sf6.scissor = 1;
+   sf->sf6.scissor = 1;
 
    /* _NEW_POLYGON */
    if (ctx->Polygon._FrontBit)
@@ -216,8 +214,7 @@ const struct brw_tracked_state brw_sf_unit = {
                _NEW_LINE |
                _NEW_POINT |
                _NEW_POLYGON |
-               _NEW_PROGRAM |
-               _NEW_SCISSOR,
+               _NEW_PROGRAM,
       .brw   = BRW_NEW_BATCH |
                BRW_NEW_BLORP |
                BRW_NEW_PROGRAM_CACHE |