diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2012-01-18 15:32:35 -0500 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2012-01-18 15:32:51 -0500 |
commit | 221c678329fd1c073d5f8dcf387129cd426ecf07 (patch) | |
tree | 2979d985c90dedac3f5ae427acbe4b761b1b4fd3 /src/gbm | |
parent | 2f868f1ddd636bc8d4cbcd5beeef1246cec80c65 (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.c | 11 |
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 9de8cb6116..ddd153a7db 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, |