From: ben Date: Thu, 26 Aug 2010 15:32:32 +0000 (+0200) Subject: st/dri: support EGL_MESA_image_drm: queryImage X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1d61793824b77e45f2ecf9b7d38bfc36d2a5af52;p=mesa.git st/dri: support EGL_MESA_image_drm: queryImage Signed-off-by: Jakob Bornecrantz --- diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c index 2fa71ba4eda..3ba7961d7c7 100644 --- a/src/gallium/state_trackers/dri/drm/dri2.c +++ b/src/gallium/state_trackers/dri/drm/dri2.c @@ -437,6 +437,35 @@ dri2_create_image(__DRIscreen *_screen, return img; } +static GLboolean +dri2_query_image(__DRIimage *image, int attrib, int *value) +{ + struct winsys_handle whandle; + memset(&whandle, 0, sizeof(whandle)); + + switch (attrib) { + case __DRI_IMAGE_ATTRIB_STRIDE: + image->texture->screen->resource_get_handle(image->texture->screen, + image->texture, &whandle); + *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, + image->texture, &whandle); + *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, + image->texture, &whandle); + *value = whandle.handle; + return GL_TRUE; + default: + return GL_FALSE; + } +} + static void dri2_destroy_image(__DRIimage *img) { @@ -450,6 +479,7 @@ static struct __DRIimageExtensionRec dri2ImageExtension = { dri2_create_image_from_renderbuffer, dri2_destroy_image, dri2_create_image, + dri2_query_image, }; /*