aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorben <[email protected]>2010-08-26 17:32:32 +0200
committerJakob Bornecrantz <[email protected]>2010-09-09 22:47:38 +0200
commit1d61793824b77e45f2ecf9b7d38bfc36d2a5af52 (patch)
tree0539abea6ad2f3f07ed2bb03b42c070404f2ff5b
parenta572e3198d19b88a5418e12376e233a583b5977a (diff)
st/dri: support EGL_MESA_image_drm: queryImage
Signed-off-by: Jakob Bornecrantz <[email protected]>
-rw-r--r--src/gallium/state_trackers/dri/drm/dri2.c30
1 files changed, 30 insertions, 0 deletions
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,
};
/*