diff options
author | Jason Ekstrand <[email protected]> | 2018-06-06 10:24:01 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2018-06-07 11:23:34 -0700 |
commit | a26693493570a9d0f0fba1be617e01ee7bfff4db (patch) | |
tree | 7930fad98058cb33c5b4976e6d4dead4078cea8e /src/mesa | |
parent | eeae4851494c16d2a6591550bfa6ef77d887ebe3 (diff) |
i965/screen: Return false for unsupported formats in query_modifiers
Cc: [email protected]
Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_screen.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index 2c783591202..5f0eeb41779 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -1262,6 +1262,16 @@ intel_create_image_from_dma_bufs(__DRIscreen *dri_screen, loaderPrivate); } +static bool +intel_image_format_is_supported(const struct intel_image_format *fmt) +{ + if (fmt->fourcc == __DRI_IMAGE_FOURCC_SARGB8888 || + fmt->fourcc == __DRI_IMAGE_FOURCC_SABGR8888) + return false; + + return true; +} + static GLboolean intel_query_dma_buf_formats(__DRIscreen *screen, int max, int *formats, int *count) @@ -1269,8 +1279,7 @@ intel_query_dma_buf_formats(__DRIscreen *screen, int max, int num_formats = 0, i; for (i = 0; i < ARRAY_SIZE(intel_image_formats); i++) { - if (intel_image_formats[i].fourcc == __DRI_IMAGE_FOURCC_SARGB8888 || - intel_image_formats[i].fourcc == __DRI_IMAGE_FOURCC_SABGR8888) + if (!intel_image_format_is_supported(&intel_image_formats[i])) continue; num_formats++; @@ -1300,6 +1309,9 @@ intel_query_dma_buf_modifiers(__DRIscreen *_screen, int fourcc, int max, if (f == NULL) return false; + if (!intel_image_format_is_supported(f)) + return false; + for (i = 0; i < ARRAY_SIZE(supported_modifiers); i++) { uint64_t modifier = supported_modifiers[i].modifier; if (!modifier_is_supported(&screen->devinfo, f, 0, modifier)) |