st/dri2: implement image offset query
authorLucas Stach <l.stach@pengutronix.de>
Fri, 23 Jun 2017 15:36:37 +0000 (17:36 +0200)
committerDaniel Stone <daniels@collabora.com>
Sat, 24 Jun 2017 15:57:55 +0000 (16:57 +0100)
This trivially adds support for the image offset query, which is needed
for the zwp_linux_dmabuf based EGL platform wayland implementation.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Daniel Stone <daniels@collabora.com>
src/gallium/state_trackers/dri/dri2.c

index 2402c61bd85e25cb99cd822113843239f24e2523..60ec38d8e44536f7f5a5ff6f8ef56ff38be4db23 100644 (file)
@@ -1179,6 +1179,12 @@ dri2_query_image(__DRIimage *image, int attrib, int *value)
             NULL, image->texture, &whandle, usage);
       *value = whandle.stride;
       return GL_TRUE;
+   case __DRI_IMAGE_ATTRIB_OFFSET:
+      whandle.type = DRM_API_HANDLE_TYPE_KMS;
+      image->texture->screen->resource_get_handle(image->texture->screen,
+            NULL, image->texture, &whandle, usage);
+      *value = whandle.offset;
+      return GL_TRUE;
    case __DRI_IMAGE_ATTRIB_HANDLE:
       whandle.type = DRM_API_HANDLE_TYPE_KMS;
       image->texture->screen->resource_get_handle(image->texture->screen,