[weston v2 3/4] pixman-renderer: Add support for SHM buffers in RGB565 format

Tomeu Vizoso tomeu at tomeuvizoso.net
Thu Jul 11 07:08:24 PDT 2013


---
 src/pixman-renderer.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/pixman-renderer.c b/src/pixman-renderer.c
index 25bffbe..fd0a61c 100644
--- a/src/pixman-renderer.c
+++ b/src/pixman-renderer.c
@@ -560,6 +560,9 @@ pixman_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer)
 	case WL_SHM_FORMAT_ARGB8888:
 		pixman_format = PIXMAN_a8r8g8b8;
 		break;
+	case WL_SHM_FORMAT_RGB565:
+		pixman_format = PIXMAN_r5g6b5;
+		break;
 	default:
 		weston_log("Unsupported SHM buffer format\n");
 		weston_buffer_reference(&ps->buffer_ref, NULL);
@@ -656,6 +659,8 @@ WL_EXPORT int
 pixman_renderer_init(struct weston_compositor *ec)
 {
 	struct pixman_renderer *renderer;
+	struct wl_array formats;
+	uint32_t *p;
 
 	renderer = malloc(sizeof *renderer);
 	if (renderer == NULL)
@@ -677,6 +682,13 @@ pixman_renderer_init(struct weston_compositor *ec)
 
 	weston_compositor_add_debug_binding(ec, KEY_R,
 					    debug_binding, ec);
+
+	wl_array_init(&formats);
+	p = wl_array_add(&formats, sizeof *p);
+	*p = WL_SHM_FORMAT_RGB565;
+
+	wl_display_set_additional_shm_formats(ec->wl_display, &formats);
+
 	return 0;
 }
 
-- 
1.8.3.1



More information about the wayland-devel mailing list