[Mesa-dev] [PATCH] st/dri: Don't expose sRGB formats to clients

Jason Ekstrand jason at jlekstrand.net
Fri Aug 31 16:41:43 UTC 2018


This is basically what we do in i965 only we support two SRGB formats.

Acked-by: Jason Ekstrand <jason at jlekstrand.net>

On Fri, Aug 31, 2018 at 11:37 AM Daniel Stone <daniels at collabora.com> wrote:

> Though the SARGB8888 format is used internally through its FourCC value,
> it is not a real format as defined by drm_fourcc.h; it cannot be used
> with KMS or other interfaces expecting drm_fourcc.h format codes.
>
> Ensure we don't advertise it through the dmabuf format/modifier query
> interfaces, preventing us from tripping over an assert.
>
> Signed-off-by: Daniel Stone <daniels at collabora.com>
> Reported-by: Michel Dänzer <michel.daenzer at amd.com>
> Fixes: 8c1b9882b2e0 ("egl/dri2: Guard against invalid fourcc formats")
> Cc: Jason Ekstrand <jason.ekstrand at intel.com>
> ---
>  src/gallium/state_trackers/dri/dri2.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/src/gallium/state_trackers/dri/dri2.c
> b/src/gallium/state_trackers/dri/dri2.c
> index 2ac32205d9a..c8a484e3926 100644
> --- a/src/gallium/state_trackers/dri/dri2.c
> +++ b/src/gallium/state_trackers/dri/dri2.c
> @@ -1485,6 +1485,12 @@ dri2_query_dma_buf_formats(__DRIscreen *_screen,
> int max, int *formats,
>
>     for (i = 0, j = 0; (i < ARRAY_SIZE(fourcc_formats)) &&
>           (j < max || max == 0); i++) {
> +      /* The sRGB format is not a real FourCC as defined by drm_fourcc.h,
> so we
> +       * must not leak it out to clients.
> +       */
> +      if (fourcc_formats[i] == __DRI_IMAGE_FOURCC_SARGB8888)
> +         continue;
> +
>        if (pscreen->is_format_supported(pscreen,
>                                         fourcc_to_pipe_format(
>                                            fourcc_formats[i]),
> --
> 2.17.1
>
> _______________________________________________
> 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/20180831/e3d7ed19/attachment.html>


More information about the mesa-dev mailing list