[PATCH] client: Add a way to get a pointer to the display's default queue

Neil Roberts neil at linux.intel.com
Tue Sep 10 06:47:22 PDT 2013


Adds a function called wl_display_get_main_queue which just returns a
pointer to the default event queue. This will be useful in order to
implement the EGL_WL_create_wayland_buffer_from_image extension. The
buffers created within Mesa's Wayland platform are created using the
the wl_drm object as a proxy factory which means they will be set to
use Mesa's internal event queue. However, these buffers will be owned
by the client application so they ideally need to use the default
event loop. This function provides a way to set the proxy's event
queue back to the default.
---
 src/wayland-client.c | 14 ++++++++++++++
 src/wayland-client.h |  1 +
 2 files changed, 15 insertions(+)

diff --git a/src/wayland-client.c b/src/wayland-client.c
index 04d988b..48f06c7 100644
--- a/src/wayland-client.c
+++ b/src/wayland-client.c
@@ -194,6 +194,20 @@ wl_display_create_queue(struct wl_display *display)
 	return queue;
 }
 
+/** Get the main event queue for this display
+ *
+ * \param display The display context object
+ * \return A pointer to the main default event queue used with this
+ * display.
+ *
+ * \memberof wl_display
+ */
+WL_EXPORT struct wl_event_queue *
+wl_display_get_main_queue(struct wl_display *display)
+{
+	return &display->queue;
+}
+
 /** Create a proxy object with a given interface
  *
  * \param factory Factory proxy object
diff --git a/src/wayland-client.h b/src/wayland-client.h
index cf92174..8cf6847 100644
--- a/src/wayland-client.h
+++ b/src/wayland-client.h
@@ -157,6 +157,7 @@ int wl_display_get_error(struct wl_display *display);
 int wl_display_flush(struct wl_display *display);
 int wl_display_roundtrip(struct wl_display *display);
 struct wl_event_queue *wl_display_create_queue(struct wl_display *display);
+struct wl_event_queue *wl_display_get_main_queue(struct wl_display *display);
 
 int wl_display_prepare_read_queue(struct wl_display *display,
 				  struct wl_event_queue *queue);
-- 
1.8.3.1



More information about the wayland-devel mailing list