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

Marc Chalain marc.chalain at gmail.com
Tue Sep 10 07:15:19 PDT 2013


Hello,
I wonder if there isn't a problem when some client application uses this
function from a child thread. If I remember, only the main thread must use
the main queue. If you give an API to use it, developers will want to use
it, and may not understand the usage.
I read your patch about EGL_WL_create_wayland_buffer_from_image , it's
simpler to use directly &display->queue , isn't it ?

Or it may be inserted inside wayland_private.h , and to use this file
inside mesa eglwayland. (The architecture is complex, with eglwayland
outside wayland).
Regards,
Marc.


2013/9/10 Neil Roberts <neil at linux.intel.com>

> 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
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20130910/d27e7cdb/attachment-0001.html>


More information about the wayland-devel mailing list