[Mesa-dev] [PATCH 9/9] i965: Always scissor on Gen4-5 instead of disabling guardband.

Pohjolainen, Topi topi.pohjolainen at gmail.com
Mon May 15 06:43:47 UTC 2017


On Thu, May 11, 2017 at 04:32:06PM -0700, Kenneth Graunke wrote:
> See commit ece0e535a44c228dd994861592deb155c14740d8.  This makes
> Gen4-5 follow the behavior we use on Gen6+.  It seems to have
> worked out there.

Nice work, I couldn't spot anything amiss in the entire series. I was a little
hesitant with this last patch, but even though I don't know our clipping
hardware that well doing the same thing on all generations sounds good.
Series:

Reviewed-by: Topi Pohjolainen <topi.pohjolainen at intel.com>

> ---
>  src/mesa/drivers/dri/i965/brw_clip_state.c | 34 ++++++++++--------------------
>  src/mesa/drivers/dri/i965/brw_sf_state.c   |  7 ++----
>  2 files changed, 13 insertions(+), 28 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_clip_state.c b/src/mesa/drivers/dri/i965/brw_clip_state.c
> index 5ab254dbb54..8f22c0ff673 100644
> --- a/src/mesa/drivers/dri/i965/brw_clip_state.c
> +++ b/src/mesa/drivers/dri/i965/brw_clip_state.c
> @@ -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 |
> diff --git a/src/mesa/drivers/dri/i965/brw_sf_state.c b/src/mesa/drivers/dri/i965/brw_sf_state.c
> index 4b4c274c9e2..84db848ac81 100644
> --- a/src/mesa/drivers/dri/i965/brw_sf_state.c
> +++ b/src/mesa/drivers/dri/i965/brw_sf_state.c
> @@ -91,9 +91,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)
> @@ -217,8 +215,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 |
> -- 
> 2.12.2
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list