summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/dri/dri2.c
diff options
context:
space:
mode:
authorDaniel Stone <[email protected]>2018-08-31 17:34:03 +0100
committerDaniel Stone <[email protected]>2018-08-31 18:02:42 +0100
commit01c0aa9f058673071f908ed775a76b4415464b5c (patch)
treeeabb69b68ff854229573cf90b2e28f95a7ae8775 /src/gallium/state_trackers/dri/dri2.c
parent686ec97cfb40b12774843463da14d2807477b71e (diff)
st/dri: Don't expose sRGB formats to clients
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 <[email protected]> Reported-by: Michel Dänzer <[email protected]> Fixes: 8c1b9882b2e0 ("egl/dri2: Guard against invalid fourcc formats") Acked-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/dri/dri2.c')
-rw-r--r--src/gallium/state_trackers/dri/dri2.c6
1 files changed, 6 insertions, 0 deletions
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]),