[mutter] wayland/shm: Advertise support for RGB565
- From: Robert Mader <rmader src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] wayland/shm: Advertise support for RGB565
- Date: Fri, 7 Aug 2020 09:10:53 +0000 (UTC)
commit 2d6040e2a38cdada9229916e15437279df06dda4
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Wed Sep 18 16:18:58 2019 +0200
wayland/shm: Advertise support for RGB565
Doesn't hurt to support it, could save memory bandwidth would any client
use it without degrading visual quality.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/804
src/wayland/meta-wayland-buffer.c | 21 +++++++++++++++++++++
src/wayland/meta-wayland-buffer.h | 2 ++
src/wayland/meta-wayland.c | 3 ++-
3 files changed, 25 insertions(+), 1 deletion(-)
---
diff --git a/src/wayland/meta-wayland-buffer.c b/src/wayland/meta-wayland-buffer.c
index cbf48727df..60ef78cd12 100644
--- a/src/wayland/meta-wayland-buffer.c
+++ b/src/wayland/meta-wayland-buffer.c
@@ -57,6 +57,7 @@
#include "cogl/cogl-egl.h"
#include "meta/util.h"
#include "wayland/meta-wayland-dma-buf.h"
+#include "wayland/meta-wayland-private.h"
#ifdef HAVE_NATIVE_BACKEND
#include "backends/native/meta-drm-buffer-gbm.h"
@@ -205,6 +206,10 @@ shm_format_to_cogl_pixel_format (enum wl_shm_format shm_format,
components = COGL_TEXTURE_COMPONENTS_RGB;
break;
#elif G_BYTE_ORDER == G_LITTLE_ENDIAN
+ case WL_SHM_FORMAT_RGB565:
+ format = COGL_PIXEL_FORMAT_RGB_565;
+ components = COGL_TEXTURE_COMPONENTS_RGB;
+ break;
case WL_SHM_FORMAT_ARGB8888:
format = COGL_PIXEL_FORMAT_BGRA_8888_PRE;
break;
@@ -736,3 +741,19 @@ meta_wayland_buffer_class_init (MetaWaylandBufferClass *klass)
NULL, NULL, NULL,
G_TYPE_NONE, 0);
}
+
+void
+meta_wayland_init_shm (MetaWaylandCompositor *compositor)
+{
+ static const enum wl_shm_format shm_formats[] = {
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+ WL_SHM_FORMAT_RGB565,
+#endif
+ };
+ int i;
+
+ wl_display_init_shm (compositor->wayland_display);
+
+ for (i = 0; i < G_N_ELEMENTS (shm_formats); i++)
+ wl_display_add_shm_format (compositor->wayland_display, shm_formats[i]);
+}
diff --git a/src/wayland/meta-wayland-buffer.h b/src/wayland/meta-wayland-buffer.h
index 77e68e7247..e00406ba26 100644
--- a/src/wayland/meta-wayland-buffer.h
+++ b/src/wayland/meta-wayland-buffer.h
@@ -91,4 +91,6 @@ void meta_wayland_buffer_process_damage (MetaWaylandBuff
CoglScanout * meta_wayland_buffer_try_acquire_scanout (MetaWaylandBuffer *buffer,
CoglOnscreen *onscreen);
+void meta_wayland_init_shm (MetaWaylandCompositor *compositor);
+
#endif /* META_WAYLAND_BUFFER_H */
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index 1feddef93f..c0d3197afe 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -31,6 +31,7 @@
#include "clutter/clutter.h"
#include "clutter/wayland/clutter-wayland-compositor.h"
#include "core/main-private.h"
+#include "wayland/meta-wayland-buffer.h"
#include "wayland/meta-wayland-data-device.h"
#include "wayland/meta-wayland-dma-buf.h"
#include "wayland/meta-wayland-egl-stream.h"
@@ -428,7 +429,7 @@ meta_wayland_compositor_setup (MetaWaylandCompositor *compositor)
compositor, compositor_bind))
g_error ("Failed to register the global wl_compositor");
- wl_display_init_shm (compositor->wayland_display);
+ meta_wayland_init_shm (compositor);
meta_wayland_outputs_init (compositor);
meta_wayland_data_device_manager_init (compositor);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]