[Mesa-dev] [PATCH 1/5] i965/gen9: Don't disallow fast clear for MSRT formats matching render

Ben Widawsky ben at bwidawsk.net
Thu Nov 19 17:55:02 PST 2015


On Thu, Nov 19, 2015 at 04:25:17PM +0100, Neil Roberts wrote:
> Previously fast clear was disallowed on Gen9 for MSRTs with the claim
> that some formats don't work but we didn't understand why. On further
> investigation it seems the formats that don't work are the ones where
> the render surface format is being overriden to a different format
> than the one used for texturing. The one used for texturing is not
> actually a renderable format. It arguably makes sense that the sampler
> hardware doesn't handle the fast color correctly in these cases
> because it shouldn't be possible to end up with a fast cleared surface
> that is non-renderable.
> 
> This patch changes the limitation to prevent fast clear for surfaces
> where the format for rendering is overriden.
> ---
>  src/mesa/drivers/dri/i965/brw_meta_fast_clear.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c b/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c
> index 1f8bfdf..f2e894a 100644
> --- a/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c
> +++ b/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c
> @@ -48,6 +48,7 @@
>  #include "brw_defines.h"
>  #include "brw_context.h"
>  #include "brw_draw.h"
> +#include "brw_state.h"
>  #include "intel_fbo.h"
>  #include "intel_batchbuffer.h"
>  
> @@ -549,11 +550,17 @@ brw_meta_fast_clear(struct brw_context *brw, struct gl_framebuffer *fb,
>        if (brw->gen < 7)
>           clear_type = REP_CLEAR;
>  
> -      /* Certain formats have unresolved issues with sampling from the MCS
> -       * buffer on Gen9. This disables fast clears altogether for MSRTs until
> -       * we can figure out what's going on.
> +      /* If we're mapping the render format to a different format than the
> +       * format we use for texturing then it is a bit questionable whether it
> +       * should be possible to use a fast clear. Although we only actually
> +       * render using a renderable format, without the override workaround it
> +       * wouldn't be possible to have a non-renderable surface in a fast clear
> +       * state so the hardware probably legitimately doesn't need to support
> +       * this case. At least on Gen9 this really does seem to cause problems.
>         */
> -      if (brw->gen >= 9 && irb->mt->num_samples > 1)
> +      if (brw->gen >= 9 &&
> +          brw_format_for_mesa_format(irb->mt->format) !=
> +          brw->render_target_format[irb->mt->format])

Could you just do !brw->format_supported_as_render_target[irb->mt->format]?

>           clear_type = REP_CLEAR;
>  
>        if (irb->mt->fast_clear_state == INTEL_FAST_CLEAR_STATE_NO_MCS)

I forget, did you find failures for this in the non-MSRT case? If not, maybe we
could skip this patch and just take the rest of the series? That way we can
avoid the "perf regression" of RGBX clears which we do hit on certain workloads.

Assuming we have a failure in non-MSRT case, and we can't just bypass this
patch, this is:
Reviewed-by: Ben Widawsky <benjamin.widawsky at intel.com>


More information about the mesa-dev mailing list