diff options
author | Emil Velikov <[email protected]> | 2017-10-24 17:14:20 +0100 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2017-11-08 14:40:12 +0000 |
commit | c7b65c330fd6ede0c82d3e2f2907e5a3ae864788 (patch) | |
tree | a563f7802c55b05a5ab6efe1528ad0e29e959300 /src/egl | |
parent | ba414dba4f1bf354cc9494fd76e3e28b489f13a1 (diff) |
wayland-drm: static inline wayland_drm_buffer_get
The function is effectively a direct function call into
libwayland-server.so.
Thus GBM no longer depends on the wayland-drm static library, making the
build more straight forward. And the resulting binary is a bit smaller.
Note: we need to move struct wayland_drm_callbacks further up,
otherwise we'll get an error since the type is incomplete.
v2: Rebase, beef-up commit message, update meson, move struct
wayland_drm_callbacks.
Signed-off-by: Emil Velikov <[email protected]>
Reviewed-by: Daniel Stone <[email protected]> (v1)
Reviewed-by: Eric Engestrom <[email protected]> # meson bit only
Acked-by: Eric Engestrom <[email protected]> # for the rest
Reviewed-by: Dylan Baker <[email protected]> # meson
Diffstat (limited to 'src/egl')
-rw-r--r-- | src/egl/wayland/wayland-drm/wayland-drm.c | 26 | ||||
-rw-r--r-- | src/egl/wayland/wayland-drm/wayland-drm.h | 48 |
2 files changed, 36 insertions, 38 deletions
diff --git a/src/egl/wayland/wayland-drm/wayland-drm.c b/src/egl/wayland/wayland-drm/wayland-drm.c index 73dfba9600e..81f6f528527 100644 --- a/src/egl/wayland/wayland-drm/wayland-drm.c +++ b/src/egl/wayland/wayland-drm/wayland-drm.c @@ -39,19 +39,6 @@ #define MIN(x,y) (((x)<(y))?(x):(y)) -struct wl_drm { - struct wl_display *display; - struct wl_global *wl_drm_global; - - void *user_data; - char *device_name; - uint32_t flags; - - struct wayland_drm_callbacks callbacks; - - struct wl_buffer_interface buffer_interface; -}; - static void destroy_buffer(struct wl_resource *resource) { @@ -244,19 +231,6 @@ bind_drm(struct wl_client *client, void *data, uint32_t version, uint32_t id) wl_resource_post_event(resource, WL_DRM_CAPABILITIES, capabilities); } -struct wl_drm_buffer * -wayland_drm_buffer_get(struct wl_drm *drm, struct wl_resource *resource) -{ - if (resource == NULL) - return NULL; - - if (wl_resource_instance_of(resource, &wl_buffer_interface, - &drm->buffer_interface)) - return wl_resource_get_user_data(resource); - else - return NULL; -} - struct wl_drm * wayland_drm_init(struct wl_display *display, char *device_name, const struct wayland_drm_callbacks *callbacks, void *user_data, diff --git a/src/egl/wayland/wayland-drm/wayland-drm.h b/src/egl/wayland/wayland-drm/wayland-drm.h index 111383ff1d6..36e5bf042a7 100644 --- a/src/egl/wayland/wayland-drm/wayland-drm.h +++ b/src/egl/wayland/wayland-drm/wayland-drm.h @@ -4,8 +4,31 @@ #include <wayland-server.h> struct wl_display; -struct wl_drm; struct wl_resource; +struct wl_drm_buffer; + +struct wayland_drm_callbacks { + int (*authenticate)(void *user_data, uint32_t id); + + void (*reference_buffer)(void *user_data, uint32_t name, int fd, + struct wl_drm_buffer *buffer); + + void (*release_buffer)(void *user_data, struct wl_drm_buffer *buffer); +}; + + +struct wl_drm { + struct wl_display *display; + struct wl_global *wl_drm_global; + + void *user_data; + char *device_name; + uint32_t flags; + + struct wayland_drm_callbacks callbacks; + + struct wl_buffer_interface buffer_interface; +}; struct wl_drm_buffer { struct wl_resource *resource; @@ -18,19 +41,20 @@ struct wl_drm_buffer { void *driver_buffer; }; -struct wayland_drm_callbacks { - int (*authenticate)(void *user_data, uint32_t id); - - void (*reference_buffer)(void *user_data, uint32_t name, int fd, - struct wl_drm_buffer *buffer); - - void (*release_buffer)(void *user_data, struct wl_drm_buffer *buffer); -}; - enum { WAYLAND_DRM_PRIME = 0x01 }; -struct wl_drm_buffer * -wayland_drm_buffer_get(struct wl_drm *drm, struct wl_resource *resource); +static inline struct wl_drm_buffer * +wayland_drm_buffer_get(struct wl_drm *drm, struct wl_resource *resource) +{ + if (resource == NULL) + return NULL; + + if (wl_resource_instance_of(resource, &wl_buffer_interface, + &drm->buffer_interface)) + return wl_resource_get_user_data(resource); + else + return NULL; +} struct wl_drm * wayland_drm_init(struct wl_display *display, char *device_name, |