return loader_dri3_query_buffer_age(&dri3_surf->loader_drawable);
}
+static EGLBoolean
+dri3_query_surface(_EGLDriver *drv, _EGLDisplay *dpy,
+ _EGLSurface *surf, EGLint attribute,
+ EGLint *value)
+{
+ struct dri3_egl_surface *dri3_surf = dri3_egl_surface(surf);
+
+ switch (attribute) {
+ case EGL_WIDTH:
+ case EGL_HEIGHT:
+ loader_dri3_update_drawable_geometry(&dri3_surf->loader_drawable);
+ break;
+ default:
+ break;
+ }
+
+ return _eglQuerySurface(drv, dpy, surf, attribute, value);
+}
+
static __DRIdrawable *
dri3_get_dri_drawable(_EGLSurface *surf)
{
.post_sub_buffer = dri2_fallback_post_sub_buffer,
.copy_buffers = dri3_copy_buffers,
.query_buffer_age = dri3_query_buffer_age,
+ .query_surface = dri3_query_surface,
.create_wayland_buffer_from_image = dri2_fallback_create_wayland_buffer_from_image,
.get_sync_values = dri3_get_sync_values,
.get_dri_drawable = dri3_get_dri_drawable,
return true;
}
+
+/** loader_dri3_update_drawable_geometry
+ *
+ * Get the current drawable geometry.
+ */
+void
+loader_dri3_update_drawable_geometry(struct loader_dri3_drawable *draw)
+{
+ xcb_get_geometry_cookie_t geom_cookie;
+ xcb_get_geometry_reply_t *geom_reply;
+
+ geom_cookie = xcb_get_geometry(draw->conn, draw->drawable);
+
+ geom_reply = xcb_get_geometry_reply(draw->conn, geom_cookie, NULL);
+
+ if (geom_reply) {
+ draw->width = geom_reply->width;
+ draw->height = geom_reply->height;
+ draw->vtable->set_drawable_size(draw, draw->width, draw->height);
+
+ free(geom_reply);
+ }
+}