[weston v2 4/4] rpi: Add support for SHM buffers in RGB565 format

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


---
 src/rpi-bcm-stubs.h |  1 +
 src/rpi-renderer.c  | 10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/src/rpi-bcm-stubs.h b/src/rpi-bcm-stubs.h
index 4b89319..d3ffd4b 100644
--- a/src/rpi-bcm-stubs.h
+++ b/src/rpi-bcm-stubs.h
@@ -85,6 +85,7 @@ typedef enum
 	/* these are not the right values: */
 	VC_IMAGE_ARGB8888,
 	VC_IMAGE_XRGB8888,
+	VC_IMAGE_RGB565,
 } VC_IMAGE_TYPE_T;
 
 /* from /opt/vc/include/interface/vmcs_host/vc_dispmanx_types.h */
diff --git a/src/rpi-renderer.c b/src/rpi-renderer.c
index 919ecc5..13661cf 100644
--- a/src/rpi-renderer.c
+++ b/src/rpi-renderer.c
@@ -233,6 +233,8 @@ shm_buffer_get_vc_format(struct wl_shm_buffer *buffer)
 		return VC_IMAGE_XRGB8888;
 	case WL_SHM_FORMAT_ARGB8888:
 		return VC_IMAGE_ARGB8888 | PREMULT_ALPHA_FLAG;
+	case WL_SHM_FORMAT_RGB565:
+		return VC_IMAGE_RGB565;
 	default:
 		/* invalid format */
 		return VC_IMAGE_MIN;
@@ -1263,6 +1265,8 @@ rpi_renderer_create(struct weston_compositor *compositor,
 		    const struct rpi_renderer_parameters *params)
 {
 	struct rpi_renderer *renderer;
+	struct wl_array formats;
+	uint32_t *p;
 
 	weston_log("Initializing the DispmanX compositing renderer\n");
 
@@ -1285,6 +1289,12 @@ rpi_renderer_create(struct weston_compositor *compositor,
 	compositor->read_format = PIXMAN_a8r8g8b8;
 	/* WESTON_CAP_ROTATION_ANY not supported */
 
+	wl_array_init(&formats);
+	p = wl_array_add(&formats, sizeof *p);
+	*p = WL_SHM_FORMAT_RGB565;
+
+	wl_display_set_additional_shm_formats(compositor->wl_display, &formats);
+
 	return 0;
 }
 
-- 
1.8.3.1



More information about the wayland-devel mailing list