summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/dri/dri2.c
diff options
context:
space:
mode:
authorDaniel Stone <[email protected]>2017-07-21 13:55:42 +0100
committerDaniel Stone <[email protected]>2017-07-25 18:40:07 +0100
commit45383d32d4fd0265a7133704cb3e6c15620177cd (patch)
tree88ac13a9a7e1adf90b8b20876e053dafe3de6e1e /src/gallium/state_trackers/dri/dri2.c
parentb4a18f13ce7f0e7d0307fb3388819345616752ce (diff)
st/dri2: Return invalid modifier when no driver support
Always initialise whandle.modifier for DRIImage modifier queries, so if the driver doesn't support it then we return false for the query. Signed-off-by: Daniel Stone <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Fixes: d33fe8b84e45 ("st/dri: enable DRIimage modifier queries")
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 3ebed7a98b4..0cbc76f7f8b 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -1239,16 +1239,22 @@ dri2_query_image(__DRIimage *image, int attrib, int *value)
return GL_TRUE;
case __DRI_IMAGE_ATTRIB_MODIFIER_UPPER:
whandle.type = DRM_API_HANDLE_TYPE_KMS;
+ whandle.modifier = DRM_FORMAT_MOD_INVALID;
if (!image->texture->screen->resource_get_handle(image->texture->screen,
NULL, image->texture, &whandle, usage))
return GL_FALSE;
+ if (whandle.modifier == DRM_FORMAT_MOD_INVALID)
+ return GL_FALSE;
*value = (whandle.modifier >> 32) & 0xffffffff;
return GL_TRUE;
case __DRI_IMAGE_ATTRIB_MODIFIER_LOWER:
whandle.type = DRM_API_HANDLE_TYPE_KMS;
+ whandle.modifier = DRM_FORMAT_MOD_INVALID;
if (!image->texture->screen->resource_get_handle(image->texture->screen,
NULL, image->texture, &whandle, usage))
return GL_FALSE;
+ if (whandle.modifier == DRM_FORMAT_MOD_INVALID)
+ return GL_FALSE;
*value = whandle.modifier & 0xffffffff;
return GL_TRUE;
default: