[RFC weston 2/2] compositor-x11: Use event loop abstraction API
Pekka Paalanen
ppaalanen at gmail.com
Wed Feb 21 09:56:14 UTC 2018
On Mon, 19 Feb 2018 20:19:05 +0100
Quentin Glidic <sardemff7+wayland at sardemff7.net> wrote:
> From: Quentin Glidic <sardemff7+git at sardemff7.net>
>
> Signed-off-by: Quentin Glidic <sardemff7+git at sardemff7.net>
> ---
> libweston/compositor-x11.c | 64 +++++++++++++++++++++-------------------------
> 1 file changed, 29 insertions(+), 35 deletions(-)
>
> diff --git a/libweston/compositor-x11.c b/libweston/compositor-x11.c
> index 14faeda03..7675b7275 100644
> --- a/libweston/compositor-x11.c
> +++ b/libweston/compositor-x11.c
> @@ -81,7 +81,7 @@ struct x11_backend {
> xcb_screen_t *screen;
> xcb_cursor_t null_cursor;
> struct wl_array keys;
> - struct wl_event_source *xcb_source;
> + void *xcb_source;
> struct xkb_keymap *xkb_keymap;
> unsigned int has_xkb;
> uint8_t xkb_event_base;
> @@ -122,7 +122,7 @@ struct x11_output {
> xcb_window_t window;
> struct weston_mode mode;
> struct weston_mode native;
> - struct wl_event_source *finish_frame_timer;
> + void *finish_frame_timer;
Instead of void*, we should have a unique opaque pointer type. It does
not matter if the actual struct does not exist at all, we do that in
libwayland-client extensively.
It would be good for the pointer type to make it "impossible" to call
an API function that is not meant for the event source type.
>
> xcb_gc_t gc;
> xcb_shm_seg_t segment;
> @@ -1840,13 +1834,13 @@ x11_backend_create(struct weston_compositor *compositor,
> goto err_renderer;
> }
>
> - loop = wl_display_get_event_loop(compositor->wl_display);
> b->xcb_source =
> - wl_event_loop_add_fd(loop,
> - xcb_get_file_descriptor(b->conn),
> - WL_EVENT_READABLE,
> - x11_backend_handle_event, b);
> - wl_event_source_check(b->xcb_source);
> + weston_compositor_event_source_add_fd(compositor,
> + WESTON_EVENT_SOURCE_PRIORITY_DEFAULT,
> + xcb_get_file_descriptor(b->conn),
> + WESTON_EVENT_SOURCE_FD_IN,
> + x11_backend_handle_event,
> + b);
>
> if (compositor->renderer->import_dmabuf) {
> if (linux_dmabuf_setup(compositor) < 0)
What does the equivalent of wl_event_sourche_check(), or can we just
remove all the calls in upstream already?
Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20180221/fea23a21/attachment-0001.sig>
More information about the wayland-devel
mailing list