wayland: Don't rely on static variable for identifying wl_drm buffers
[mesa.git] / src / gallium / state_trackers / egl / common / native_wayland_drm_bufmgr.c
index 3fd5fa2dbda1dd122475aa4d9e2e443845fc44be..f9acb2afd6a36ee9040e117bacda42b605df4497 100644 (file)
@@ -139,7 +139,11 @@ static struct pipe_resource *
 wayland_drm_bufmgr_wl_buffer_get_resource(struct native_display *ndpy,
                                           struct wl_resource *buffer_resource)
 {
-   struct wl_drm_buffer *buffer = wayland_drm_buffer_get(buffer_resource);
+   struct wayland_drm_bufmgr *bufmgr;
+   struct wl_drm_buffer *buffer;
+
+   bufmgr = wayland_drm_bufmgr(ndpy->wayland_bufmgr);
+   buffer = wayland_drm_buffer_get(bufmgr->wl_server_drm, buffer_resource);
 
    if (!buffer)
       return NULL;
@@ -152,9 +156,12 @@ wayland_drm_bufmgr_query_buffer(struct native_display *ndpy,
                                 struct wl_resource *buffer_resource,
                                 int attribute, int *value)
 {
-   struct wl_drm_buffer *buffer = wayland_drm_buffer_get(buffer_resource);
+   struct wayland_drm_bufmgr *bufmgr;
+   struct wl_drm_buffer *buffer;
    struct pipe_resource *resource;
 
+   bufmgr = wayland_drm_bufmgr(ndpy->wayland_bufmgr);
+   buffer = wayland_drm_buffer_get(bufmgr->wl_server_drm, buffer_resource);
    if (!buffer)
       return FALSE;