From 5837769cc352eb219153ed2f693fbf95804df2bc Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Fri, 27 Apr 2012 17:47:38 +0200 Subject: compositor: implement query_surface_formats(). Signed-off-by: Gwenole Beauchesne --- src/compositor.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/compositor.c b/src/compositor.c index 1642f63..00812f4 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -1465,6 +1465,27 @@ compositor_create_surface(struct wl_client *client, wl_client_add_resource(client, &surface->surface.resource); } +static void +compositor_query_surface_formats(struct wl_client *client, + struct wl_resource *resource) +{ + uint32_t i; + + static const uint32_t surface_formats[] = { + WL_BUFFER_FORMAT_ARGB32, + WL_BUFFER_FORMAT_XRGB32, + WL_BUFFER_FORMAT_NV12, + WL_BUFFER_FORMAT_YUV410, + WL_BUFFER_FORMAT_YUV411, + WL_BUFFER_FORMAT_YUV420, + WL_BUFFER_FORMAT_YUV422, + WL_BUFFER_FORMAT_YUV444 + }; + + for (i = 0; i < ARRAY_LENGTH(surface_formats); i++) + wl_compositor_send_surface_format(resource, surface_formats[i]); +} + static void destroy_region(struct wl_resource *resource) { @@ -1536,7 +1557,8 @@ compositor_create_region(struct wl_client *client, static const struct wl_compositor_interface compositor_interface = { compositor_create_surface, - compositor_create_region + compositor_create_region, + compositor_query_surface_formats }; WL_EXPORT void -- cgit v1.2.3