diff options
author | Daniel Stone <[email protected]> | 2017-07-24 14:42:56 +0100 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2017-08-03 00:19:07 +0100 |
commit | 1b0beffb6244d14f642e323f446d4ea194d05c59 (patch) | |
tree | e5139e18331601fa8f40b8cb8a11c0ab7c2ac424 /src | |
parent | bfaf401d6bc340e28c39d693eb1b1f3ff6bbc1c4 (diff) |
st/dri: Check get-handle return value in queryImage
In the DRIImage queryImage hook, check if resource_get_handle() failed
and return FALSE if so.
Signed-off-by: Daniel Stone <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
(cherry picked from commit b4a18f13ce7f0e7d0307fb3388819345616752ce)
[Emil Velikov: drop offset and modifier hunks - not in branch]
Signed-off-by: Emil Velikov <[email protected]>
Conflicts:
src/gallium/state_trackers/dri/dri2.c
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/state_trackers/dri/dri2.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c index ed6004f836d..3bd67bf21c5 100644 --- a/src/gallium/state_trackers/dri/dri2.c +++ b/src/gallium/state_trackers/dri/dri2.c @@ -1038,20 +1038,23 @@ dri2_query_image(__DRIimage *image, int attrib, int *value) switch (attrib) { case __DRI_IMAGE_ATTRIB_STRIDE: whandle.type = DRM_API_HANDLE_TYPE_KMS; - image->texture->screen->resource_get_handle(image->texture->screen, - NULL, image->texture, &whandle, usage); + if (!image->texture->screen->resource_get_handle(image->texture->screen, + NULL, image->texture, &whandle, usage)) + return GL_FALSE; *value = whandle.stride; return GL_TRUE; case __DRI_IMAGE_ATTRIB_HANDLE: whandle.type = DRM_API_HANDLE_TYPE_KMS; - image->texture->screen->resource_get_handle(image->texture->screen, - NULL, image->texture, &whandle, usage); + if (!image->texture->screen->resource_get_handle(image->texture->screen, + NULL, image->texture, &whandle, usage)) + return GL_FALSE; *value = whandle.handle; return GL_TRUE; case __DRI_IMAGE_ATTRIB_NAME: whandle.type = DRM_API_HANDLE_TYPE_SHARED; - image->texture->screen->resource_get_handle(image->texture->screen, - NULL, image->texture, &whandle, usage); + if (!image->texture->screen->resource_get_handle(image->texture->screen, + NULL, image->texture, &whandle, usage)) + return GL_FALSE; *value = whandle.handle; return GL_TRUE; case __DRI_IMAGE_ATTRIB_FD: |