[Mesa-dev] [PATCH 2/7] i965: Allow fast depth clears if scissoring doesn't do anything.

Ian Romanick idr at freedesktop.org
Fri Sep 28 08:41:51 PDT 2012


On 09/19/2012 01:27 PM, Kenneth Graunke wrote:
> A game we're working with leaves scissoring enabled, but frequently sets
> the scissor rectangle to the size of the whole screen.  In that case,
> scissoring has no effect, so it's safe to go ahead with a fast clear.
>
> Chad believe this should help with Oliver McFadden's "Dante" as well.
>
> v2/Chad: Use the drawbuffer dimensions rather than the miptree slice
> dimensions.  The miptree slice may be slightly larger due to alignment
> restrictions.

There was some question of whether this actually gave any performance 
improvement or just made the INTEL_DEBUG=perf warning go away.  Can we 
see any actual performance delta in Dante?

> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
> Cc: Oliver McFadden <oliver.mcfadden at linux.intel.com>
> ---
>   src/mesa/drivers/dri/i965/brw_clear.c | 14 +++++++++++++-
>   1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_clear.c b/src/mesa/drivers/dri/i965/brw_clear.c
> index c3c75df..625cc85 100644
> --- a/src/mesa/drivers/dri/i965/brw_clear.c
> +++ b/src/mesa/drivers/dri/i965/brw_clear.c
> @@ -77,6 +77,18 @@ debug_mask(const char *name, GLbitfield mask)
>   }
>
>   /**
> + * Returns true if the scissor is a noop (cuts out nothing).
> + */
> +static bool
> +noop_scissor(struct gl_context *ctx, struct gl_framebuffer *fb)
> +{
> +   return ctx->Scissor.X <= 0 &&
> +          ctx->Scissor.Y <= 0 &&
> +          ctx->Scissor.Width >= fb->Width &&
> +          ctx->Scissor.Height >= fb->Height;
> +}
> +
> +/**
>    * Implements fast depth clears on gen6+.
>    *
>    * Fast clears basically work by setting a flag in each of the subspans
> @@ -110,7 +122,7 @@ brw_fast_clear_depth(struct gl_context *ctx)
>       * a previous clear had happened at a different clear value and resolve it
>       * first.
>       */
> -   if (ctx->Scissor.Enabled) {
> +   if (ctx->Scissor.Enabled && !noop_scissor(ctx, fb)) {
>         perf_debug("Failed to fast clear depth due to scissor being enabled.  "
>                    "Possible 5%% performance win if avoided.\n");
>         return false;
>



More information about the mesa-dev mailing list