summaryrefslogtreecommitdiffstats
path: root/src/egl/wayland/wayland-drm
diff options
context:
space:
mode:
authorKristian Høgsberg <[email protected]>2013-09-26 12:25:11 -0700
committerKristian Høgsberg <[email protected]>2013-10-11 15:14:35 -0700
commit360a141f24a9d00891665b7fedb77ffb116944ca (patch)
tree79ebe6820c6a23471849307af1d5b03f1b965de2 /src/egl/wayland/wayland-drm
parentfe6974382b353efebf06dfb2d00b0b2c752fb666 (diff)
wayland: Don't rely on static variable for identifying wl_drm buffers
Now that libEGL has been fixed to not leak all kinds of symbols, gbm links to its own copy of the libwayland-drm.a helper library. That means we can't rely on comparing the addresses of a static vtable symbol in that library to determine if a wl_buffer is a wl_drm_buffer. Instead, we move the vtable into the wl_drm struct and use that for comparing. https://bugs.freedesktop.org/show_bug.cgi?id=69437 Cc: 9.2 <[email protected]>
Diffstat (limited to 'src/egl/wayland/wayland-drm')
-rw-r--r--src/egl/wayland/wayland-drm/wayland-drm.c20
-rw-r--r--src/egl/wayland/wayland-drm/wayland-drm.h2
2 files changed, 12 insertions, 10 deletions
diff --git a/src/egl/wayland/wayland-drm/wayland-drm.c b/src/egl/wayland/wayland-drm/wayland-drm.c
index d317c5e1c46..7b614b71b5c 100644
--- a/src/egl/wayland/wayland-drm/wayland-drm.c
+++ b/src/egl/wayland/wayland-drm/wayland-drm.c
@@ -47,6 +47,8 @@ struct wl_drm {
uint32_t flags;
struct wayland_drm_callbacks *callbacks;
+
+ struct wl_buffer_interface buffer_interface;
};
static void
@@ -65,10 +67,6 @@ buffer_destroy(struct wl_client *client, struct wl_resource *resource)
wl_resource_destroy(resource);
}
-const static struct wl_buffer_interface drm_buffer_interface = {
- buffer_destroy
-};
-
static void
create_buffer(struct wl_client *client, struct wl_resource *resource,
uint32_t id, uint32_t name, int fd,
@@ -115,7 +113,7 @@ create_buffer(struct wl_client *client, struct wl_resource *resource,
}
wl_resource_set_implementation(buffer->resource,
- (void (**)(void)) &drm_buffer_interface,
+ (void (**)(void)) &drm->buffer_interface,
buffer, destroy_buffer);
}
@@ -243,15 +241,17 @@ bind_drm(struct wl_client *client, void *data, uint32_t version, uint32_t id)
}
struct wl_drm_buffer *
-wayland_drm_buffer_get(struct wl_resource *resource)
+wayland_drm_buffer_get(struct wl_drm *drm, struct wl_resource *resource)
{
+ struct wl_drm_buffer *buffer;
+
if (resource == NULL)
return NULL;
- if (wl_resource_instance_of(resource, &wl_buffer_interface,
- &drm_buffer_interface))
+ if (wl_resource_instance_of(resource, &wl_buffer_interface,
+ &drm->buffer_interface))
return wl_resource_get_user_data(resource);
- else
+ else
return NULL;
}
@@ -270,6 +270,8 @@ wayland_drm_init(struct wl_display *display, char *device_name,
drm->user_data = user_data;
drm->flags = flags;
+ drm->buffer_interface.destroy = buffer_destroy;
+
wl_global_create(display, &wl_drm_interface, 2, drm, bind_drm);
return drm;
diff --git a/src/egl/wayland/wayland-drm/wayland-drm.h b/src/egl/wayland/wayland-drm/wayland-drm.h
index ca0488285bc..7892d561f3c 100644
--- a/src/egl/wayland/wayland-drm/wayland-drm.h
+++ b/src/egl/wayland/wayland-drm/wayland-drm.h
@@ -92,7 +92,7 @@ struct wayland_drm_callbacks {
enum { WAYLAND_DRM_PRIME = 0x01 };
struct wl_drm_buffer *
-wayland_drm_buffer_get(struct wl_resource *resource);
+wayland_drm_buffer_get(struct wl_drm *drm, struct wl_resource *resource);
struct wl_drm *
wayland_drm_init(struct wl_display *display, char *device_name,