[Mesa-dev] [PATCH] mesa/main: return GL_BGRA as the preferred color read format more often

Marek Olšák maraeo at gmail.com
Wed Jan 16 00:00:27 UTC 2019


Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Sun, Jan 13, 2019 at 1:57 PM Ilia Mirkin <imirkin at alum.mit.edu> wrote:

> Currently we were only returning it for BGRA8. But it makes sense to
> return it for all the BGR[AX] variants. This was discovered when
> figuring out why wlroots was sending a RGBX instead of BGRX image when
> screenshotting.
>
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
>
> Not sure that this can really matter for performance -- I guess in some
> cases it means we can memcpy a mapped RB. But we might also fall off
> some optimized imageBuffer pbo download path. On average, probably
> "meh", but seems more consistent.
>
>  src/mesa/main/framebuffer.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
> index 10dd2fde446..09059a11cbd 100644
> --- a/src/mesa/main/framebuffer.c
> +++ b/src/mesa/main/framebuffer.c
> @@ -850,6 +850,11 @@ _mesa_get_color_read_format(struct gl_context *ctx,
>        case MESA_FORMAT_RGBA_UINT8:
>           return GL_RGBA_INTEGER;
>        case MESA_FORMAT_B8G8R8A8_UNORM:
> +      case MESA_FORMAT_B8G8R8X8_UNORM:
> +      case MESA_FORMAT_B5G5R5A1_UNORM:
> +      case MESA_FORMAT_B5G5R5X1_UNORM:
> +      case MESA_FORMAT_B4G4R4A4_UNORM:
> +      case MESA_FORMAT_B4G4R4X4_UNORM:
>           return GL_BGRA;
>        case MESA_FORMAT_B5G6R5_UNORM:
>        case MESA_FORMAT_R11G11B10_FLOAT:
> --
> 2.19.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20190115/2c3c5839/attachment.html>


More information about the mesa-dev mailing list