libweston: Add a helper for retrieving backend type

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This commit is contained in:
Marius Vlad 2024-06-26 18:48:17 +03:00 committed by Derek Foreman
parent d88782bf41
commit 14cfb97949
3 changed files with 26 additions and 0 deletions

View File

@ -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

View File

@ -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 */

View File

@ -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;
}