Module: Mesa
Branch: master
Commit: 672e8d5e7ee63ebb69ffdc635210f06f68cb4d8a
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=672e8d5e7ee63ebb69ffdc635210f06f68cb4d8a

Author: Leo Liu <leo....@amd.com>
Date:   Mon Apr 25 13:06:20 2016 -0400

vl/dri3: set drawable geometry

Signed-off-by: Leo Liu <leo....@amd.com>
Reviewed-by: Alex Deucher <alexander.deuc...@amd.com>
Reviewed-by: Christian König <christian.koe...@amd.com>

---

 src/gallium/auxiliary/vl/vl_winsys_dri3.c | 35 +++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri3.c 
b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
index 74f3891..980b3b6 100644
--- a/src/gallium/auxiliary/vl/vl_winsys_dri3.c
+++ b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
@@ -44,8 +44,36 @@ struct vl_dri3_screen
    struct vl_screen base;
    xcb_connection_t *conn;
    xcb_drawable_t drawable;
+
+   uint32_t width, height, depth;
 };
 
+static bool
+dri3_set_drawable(struct vl_dri3_screen *scrn, Drawable drawable)
+{
+   xcb_get_geometry_cookie_t geom_cookie;
+   xcb_get_geometry_reply_t *geom_reply;
+
+   assert(drawable);
+
+   if (scrn->drawable == drawable)
+      return true;
+
+   scrn->drawable = drawable;
+
+   geom_cookie = xcb_get_geometry(scrn->conn, scrn->drawable);
+   geom_reply = xcb_get_geometry_reply(scrn->conn, geom_cookie, NULL);
+   if (!geom_reply)
+      return false;
+
+   scrn->width = geom_reply->width;
+   scrn->height = geom_reply->height;
+   scrn->depth = geom_reply->depth;
+   free(geom_reply);
+
+   return true;
+}
+
 static void
 vl_dri3_flush_frontbuffer(struct pipe_screen *screen,
                           struct pipe_resource *resource,
@@ -59,6 +87,13 @@ vl_dri3_flush_frontbuffer(struct pipe_screen *screen,
 static struct pipe_resource *
 vl_dri3_screen_texture_from_drawable(struct vl_screen *vscreen, void *drawable)
 {
+   struct vl_dri3_screen *scrn = (struct vl_dri3_screen *)vscreen;
+
+   assert(scrn);
+
+   if (!dri3_set_drawable(scrn, (Drawable)drawable))
+      return NULL;
+
    /* TODO */
    return NULL;
 }

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to