[Mesa-dev] [PATCH 3/5] i965/gen9: Resolve SRGB color buffers when GL_FRAMEBUFFER_SRGB enabled

Pohjolainen, Topi topi.pohjolainen at intel.com
Tue Dec 1 08:47:04 PST 2015


On Wed, Nov 25, 2015 at 06:36:37PM +0100, Neil Roberts wrote:
> SKL can't cope with the CCS buffer for SRGB buffers. Normally the
> hardware won't see the SRGB formats because when GL_FRAMEBUFFER_SRGB
> is disabled these get mapped to their linear equivalents. In order to
> avoid relying on the CCS buffer when it is enabled this patch now
> makes it flush the renderbuffers.
> ---
> 
> I made a test case for this here:
> 
> http://patchwork.freedesktop.org/patch/66225/
> 
>  src/mesa/drivers/dri/i965/brw_context.c | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
> index 7e2fdcb..a8c1052 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.c
> +++ b/src/mesa/drivers/dri/i965/brw_context.c
> @@ -197,6 +197,31 @@ intel_update_state(struct gl_context * ctx, GLuint new_state)
>        brw_render_cache_set_check_flush(brw, tex_obj->mt->bo);
>     }
>  
> +   /* If FRAMEBUFFER_SRGB is used on Gen9+ then we need to resolve any of the
> +    * single-sampled color renderbuffers because the CCS buffer isn't
> +    * supported for SRGB formats and the blending wouldn't work.

Something we discussed over IRC. To me this comment sort of hints that the
issue is blending. I didn't realize immediately that while is a problem also,
we need this restriction even without blending. When sRGBEnabled is true we
program the render surface to real srgb format and CCS is not supported. But
when sRGBEnabled is false we can use linear equivalent and using CCS is just
fine. If you like you could add something to the comment here.

I already gave my r-b for the first patch in the series, but the rest now
make sense to also. So the series:

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

> +    */
> +   if (brw->gen >= 9 && ctx->Color.sRGBEnabled) {
> +      struct gl_framebuffer *fb = ctx->DrawBuffer;
> +      for (int i = 0; i < fb->_NumColorDrawBuffers; i++) {
> +         struct gl_renderbuffer *rb = fb->_ColorDrawBuffers[i];
> +
> +         if (rb == NULL)
> +            continue;
> +
> +         struct intel_renderbuffer *irb = intel_renderbuffer(rb);
> +         struct intel_mipmap_tree *mt = irb->mt;
> +
> +         if (mt == NULL ||
> +             mt->num_samples > 1 ||
> +             _mesa_get_srgb_format_linear(mt->format) == mt->format)
> +               continue;
> +
> +         intel_miptree_resolve_color(brw, mt);
> +         brw_render_cache_set_check_flush(brw, mt->bo);
> +      }
> +   }
> +
>     _mesa_lock_context_textures(ctx);
>  }
>  
> -- 
> 1.9.3
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list