[Mesa-dev] [PATCH 7/9] wayland-drm: static inline wayland_drm_buffer_get

Emil Velikov emil.l.velikov at gmail.com
Thu Sep 7 18:05:04 UTC 2017


From: Emil Velikov <emil.velikov at collabora.com>

The function is effectively a direct function call into
libwayland-server.so

Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
 src/egl/wayland/wayland-drm/wayland-drm.c | 26 --------------------------
 src/egl/wayland/wayland-drm/wayland-drm.h | 28 +++++++++++++++++++++++++---
 src/gbm/Makefile.am                       |  2 +-
 3 files changed, 26 insertions(+), 30 deletions(-)

diff --git a/src/egl/wayland/wayland-drm/wayland-drm.c b/src/egl/wayland/wayland-drm/wayland-drm.c
index 5c17b4386b5..477b92613ba 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;
-
-	const 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 77e8d273042..8dc7f6089ae 100644
--- a/src/egl/wayland/wayland-drm/wayland-drm.h
+++ b/src/egl/wayland/wayland-drm/wayland-drm.h
@@ -4,9 +4,21 @@
 #include <wayland-server.h>
 
 struct wl_display;
-struct wl_drm;
 struct wl_resource;
 
+struct wl_drm {
+	struct wl_display *display;
+	struct wl_global *wl_drm_global;
+
+	void *user_data;
+	char *device_name;
+	uint32_t flags;
+
+	const struct wayland_drm_callbacks *callbacks;
+
+	struct wl_buffer_interface buffer_interface;
+};
+
 struct wl_drm_buffer {
 	struct wl_resource *resource;
 	struct wl_drm *drm;
@@ -29,8 +41,18 @@ struct wayland_drm_callbacks {
 
 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,
diff --git a/src/gbm/Makefile.am b/src/gbm/Makefile.am
index 7a9a12f87a0..c77205bf798 100644
--- a/src/gbm/Makefile.am
+++ b/src/gbm/Makefile.am
@@ -31,7 +31,7 @@ libgbm_la_LIBADD = \
 
 if HAVE_PLATFORM_WAYLAND
 AM_CFLAGS += $(WAYLAND_CFLAGS)
-libgbm_la_LIBADD += $(top_builddir)/src/egl/wayland/wayland-drm/libwayland-drm.la $(WAYLAND_LIBS)
+libgbm_la_LIBADD += $(WAYLAND_LIBS)
 endif
 
 if HAVE_DRI2
-- 
2.14.1



More information about the mesa-dev mailing list