diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/state_trackers/dri/drm/dri2.c | 2 | ||||
-rw-r--r-- | src/gbm/backends/dri/gbm_dri.c | 11 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_screen.c | 16 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_screen.c | 2 |
4 files changed, 27 insertions, 4 deletions
diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c index 2f7f1cba7e6..afd91ee27a1 100644 --- a/src/gallium/state_trackers/dri/drm/dri2.c +++ b/src/gallium/state_trackers/dri/drm/dri2.c @@ -626,7 +626,7 @@ dri2_destroy_image(__DRIimage *img) } static struct __DRIimageExtensionRec dri2ImageExtension = { - { __DRI_IMAGE, __DRI_IMAGE_VERSION }, + { __DRI_IMAGE, 1 }, dri2_create_image_from_name, dri2_create_image_from_renderbuffer, dri2_destroy_image, 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, diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 0566907fb3d..094ff568c44 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -324,14 +324,26 @@ intel_dup_image(__DRIimage *orig_image, void *loaderPrivate) return image; } +static GLboolean +intel_validate_usage(__DRIimage *image, unsigned int use) +{ + if (use & __DRI_IMAGE_USE_CURSOR) { + if (image->region->width != 64 || image->region->height != 64) + return GL_FALSE; + } + + return GL_TRUE; +} + static struct __DRIimageExtensionRec intelImageExtension = { - { __DRI_IMAGE, __DRI_IMAGE_VERSION }, + { __DRI_IMAGE, 2 }, intel_create_image_from_name, intel_create_image_from_renderbuffer, intel_destroy_image, intel_create_image, intel_query_image, - intel_dup_image + intel_dup_image, + intel_validate_usage }; static const __DRIextension *intelScreenExtensions[] = { diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 2e364d02807..a5dff983aa9 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -375,7 +375,7 @@ radeon_query_image(__DRIimage *image, int attrib, int *value) } static struct __DRIimageExtensionRec radeonImageExtension = { - { __DRI_IMAGE, __DRI_IMAGE_VERSION }, + { __DRI_IMAGE, 1 }, radeon_create_image_from_name, radeon_create_image_from_renderbuffer, radeon_destroy_image, |