summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2018-06-06 10:24:01 -0700
committerDylan Baker <dylan@pnwbakers.com>2018-06-11 10:45:54 -0700
commit5a3107b7ec3908d2550189d2ea8528d80640a3a0 (patch)
tree8862a21712a3b623fe6bea01089db73cd6fa8020
parent5bf748045c605b911659a757da9adf13d3855c64 (diff)
i965/screen: Return false for unsupported formats in query_modifiers
Cc: mesa-stable@lists.freedesktop.org Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> (cherry picked from commit 7d55d7d54d6855b2b6cb183d0aa87fce1c7b9e5e) v2: - Remove __DRI_IMAGE_FOURCC_SABGR8888 which doesn't exist on 18.1 V2 by Dylan, changes suggested by Jason
-rw-r--r--src/mesa/drivers/dri/i965/intel_screen.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 61e01c8c556..bb5ed53f1b6 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -1264,6 +1264,15 @@ 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)
+ return false;
+
+ return true;
+}
+
static GLboolean
intel_query_dma_buf_formats(__DRIscreen *screen, int max,
int *formats, int *count)
@@ -1271,7 +1280,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)
+ if (!intel_image_format_is_supported(&intel_image_formats[i]))
continue;
num_formats++;
@@ -1301,6 +1310,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))