mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
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
This commit is contained in:
parent
5a8e4da2a8
commit
2d6040e2a3
@ -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]);
|
||||
}
|
||||
|
@ -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 */
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user