[Mesa-dev] [PATCH 2/5] i965/gen8: Allow rendering to B8G8R8X8

Ben Widawsky ben at bwidawsk.net
Thu Nov 19 17:51:01 PST 2015


On Thu, Nov 19, 2015 at 04:25:18PM +0100, Neil Roberts wrote:
> Since Gen8 this is allowed as a rendering target so we don't need to
> override it to B8G8R8A8. This is helpful on Gen9+ where using this
> override causes fast clears not to work.
> ---
>  src/mesa/drivers/dri/i965/brw_surface_formats.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_surface_formats.c b/src/mesa/drivers/dri/i965/brw_surface_formats.c
> index 55e7e64..7c38431 100644
> --- a/src/mesa/drivers/dri/i965/brw_surface_formats.c
> +++ b/src/mesa/drivers/dri/i965/brw_surface_formats.c
> @@ -167,8 +167,8 @@ const struct surface_format_info surface_formats[] = {
>     SF( Y, 50,  Y,  x,  x,  x,  x,  x,  x,    x,   I32_FLOAT)
>     SF( Y, 50,  Y,  x,  x,  x,  x,  x,  x,    x,   L32_FLOAT)
>     SF( Y, 50,  Y,  x,  x,  x,  x,  x,  x,    x,   A32_FLOAT)
> -   SF( Y,  Y,  x,  Y,  x,  x,  x,  x, 60,   90,   B8G8R8X8_UNORM)
> -   SF( Y,  Y,  x,  x,  x,  x,  x,  x,  x,    x,   B8G8R8X8_UNORM_SRGB)
> +   SF( Y,  Y,  x,  Y, 80, 80,  x,  x, 60,   90,   B8G8R8X8_UNORM)
> +   SF( Y,  Y,  x,  x, 80, 80,  x,  x,  x,    x,   B8G8R8X8_UNORM_SRGB)
>     SF( Y,  Y,  x,  x,  x,  x,  x,  x,  x,    x,   R8G8B8X8_UNORM)
>     SF( Y,  Y,  x,  x,  x,  x,  x,  x,  x,    x,   R8G8B8X8_UNORM_SRGB)
>     SF( Y,  Y,  x,  x,  x,  x,  x,  x,  x,    x,   R9G9B9E5_SHAREDEXP)
> @@ -670,9 +670,10 @@ brw_init_surface_formats(struct brw_context *brw)
>  	  * mask writes to alpha (ala glColorMask) and reconfigure the
>  	  * alpha blending hardware to use GL_ONE (or GL_ZERO) for
>  	  * cases where GL_DST_ALPHA (or GL_ONE_MINUS_DST_ALPHA) is
> -	  * used.
> +	  * used. On Gen8+ BGRX is actually allowed (but not RGBX).
>  	  */
> -	 render = BRW_SURFACEFORMAT_B8G8R8A8_UNORM;
> +         if (gen < tinfo->render_target)
> +            render = BRW_SURFACEFORMAT_B8G8R8A8_UNORM;
>  	 break;
>        case BRW_SURFACEFORMAT_R8G8B8X8_UNORM:
>           render = BRW_SURFACEFORMAT_R8G8B8A8_UNORM;

There's probably something I don't know about the format naming but at the top
of the of the comment you modified they refer to the formats with the components
reversed (XRGB and ARGB) whereas you named them as in order (BGRX).

BTW, I pointed this out to Nanley, but I didn't see a patch, I think we need to
add is_braswell (and maybe broxton)) to the gen += 5 at the top of this
function.

lgtm
Reviewed-by: Ben Widawsky <benjamin.widawsky at intel.com>


More information about the mesa-dev mailing list