diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h index 7a01a29e..ee9fbd5b 100644 --- a/include/libweston/libweston.h +++ b/include/libweston/libweston.h @@ -2202,6 +2202,8 @@ void weston_output_schedule_repaint_reset(struct weston_output *output); void weston_output_schedule_repaint_restart(struct weston_output *output); +enum weston_compositor_backend +weston_get_backend_type(struct weston_backend *backend); void weston_compositor_schedule_repaint(struct weston_compositor *compositor); void diff --git a/libweston/backend.h b/libweston/backend.h index 8b7e4e60..05a40f30 100644 --- a/libweston/backend.h +++ b/libweston/backend.h @@ -129,6 +129,11 @@ struct weston_backend { */ bool (*can_scanout_dmabuf)(struct weston_backend *backend, struct linux_dmabuf_buffer *buffer); + + /** Identifies a particular backend_type from one + * defined in weston_compositor_backend. + */ + enum weston_compositor_backend backend_type; }; /* weston_head */ diff --git a/libweston/compositor.c b/libweston/compositor.c index a4c77c3b..799bfa76 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -10189,6 +10189,7 @@ weston_compositor_load_backend(struct weston_compositor *compositor, return NULL; b = wl_container_of(compositor->backend_list.next, b, link); + b->backend_type = backend; /* Return the last loaded backend. */ return b; @@ -10456,3 +10457,21 @@ weston_output_finish_frame_from_timer(struct weston_output *output) weston_output_finish_frame(output, &ts, 0); } + +/** Retrieve the backend type of as described in enum + * weston_compositor_backend. + * + * Note that the backend must be loaded, with weston_compositor_load_backend + * + * \param backend weston_backend in question + * \returns a type of enum weston_compositor_backend + * + * \sa weston_compositor_load_backend + * + */ +WL_EXPORT enum weston_compositor_backend +weston_get_backend_type(struct weston_backend *backend) +{ + assert(backend); + return backend->backend_type; +}