summaryrefslogtreecommitdiffstats
path: root/src/gbm
diff options
context:
space:
mode:
authorKristian Høgsberg <[email protected]>2012-01-18 15:32:35 -0500
committerKristian Høgsberg <[email protected]>2012-01-18 15:32:51 -0500
commit221c678329fd1c073d5f8dcf387129cd426ecf07 (patch)
tree2979d985c90dedac3f5ae427acbe4b761b1b4fd3 /src/gbm
parent2f868f1ddd636bc8d4cbcd5beeef1246cec80c65 (diff)
gbm: Validate usage flags in gbm_bo_create_from_egl_image()
The entry point is supposed to validate that the EGLImage is suitable for the passed in usage flags, but that was never implemented.
Diffstat (limited to 'src/gbm')
-rw-r--r--src/gbm/backends/dri/gbm_dri.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 9de8cb61162..ddd153a7db4 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -255,6 +255,7 @@ gbm_dri_bo_create_from_egl_image(struct gbm_device *gbm,
{
struct gbm_dri_device *dri = gbm_dri_device(gbm);
struct gbm_dri_bo *bo;
+ unsigned dri_use = 0;
(void) egl_dpy;
@@ -276,6 +277,16 @@ gbm_dri_bo_create_from_egl_image(struct gbm_device *gbm,
if (bo->image == NULL)
return NULL;
+ if (usage & GBM_BO_USE_SCANOUT)
+ dri_use |= __DRI_IMAGE_USE_SCANOUT;
+ if (usage & GBM_BO_USE_CURSOR_64X64)
+ dri_use |= __DRI_IMAGE_USE_CURSOR;
+ if (dri->image->base.version >= 2 &&
+ !dri->image->validateUsage(bo->image, dri_use)) {
+ free(bo);
+ return NULL;
+ }
+
dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_HANDLE,
&bo->base.base.handle.s32);
dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_STRIDE,