st/dri: Don't expose sRGB formats to clients
[mesa.git] / src / gallium / state_trackers / dri / dri2.c
index 2ac32205d9ac0cee954a7a724fa9633e88a10a97..c8a484e3926125a4ad10129152c574eeafdd1bf9 100644 (file)
@@ -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]),