backend-wayland: use DRM formats for EGLConfig

Define a specific DRM format for the GL-renderer to render in. It goes through
fuzzy matching in egl-glue.c which ensures we get exactly the number of bits
for each channel, but does not require an exact format match.

This ensures we get the bit depth we expect instead of the first arbitrary
EGLConfig.

This should not change the current behaviour, because Mesa EGL takes care to
order the configs as apps expect.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
dev
Pekka Paalanen 5 years ago
parent 7cbafec8ae
commit ed20b4d983
  1. 13
      libweston/backend-wayland/wayland.c

@ -38,6 +38,7 @@
#include <sys/mman.h> #include <sys/mman.h>
#include <linux/input.h> #include <linux/input.h>
#include <drm_fourcc.h>
#include <wayland-client.h> #include <wayland-client.h>
#include <wayland-cursor.h> #include <wayland-cursor.h>
@ -63,6 +64,10 @@
#define WINDOW_TITLE "Weston Compositor" #define WINDOW_TITLE "Weston Compositor"
static const uint32_t wayland_formats[] = {
DRM_FORMAT_ARGB8888,
};
struct wayland_backend { struct wayland_backend {
struct weston_backend base; struct weston_backend base;
struct weston_compositor *compositor; struct weston_compositor *compositor;
@ -775,8 +780,8 @@ wayland_output_init_gl_renderer(struct wayland_output *output)
output->gl.egl_window, output->gl.egl_window,
output->gl.egl_window, output->gl.egl_window,
gl_renderer->alpha_attribs, gl_renderer->alpha_attribs,
NULL, wayland_formats,
0) < 0) ARRAY_LENGTH(wayland_formats)) < 0)
goto cleanup_window; goto cleanup_window;
return 0; return 0;
@ -2770,8 +2775,8 @@ wayland_backend_create(struct weston_compositor *compositor,
EGL_PLATFORM_WAYLAND_KHR, EGL_PLATFORM_WAYLAND_KHR,
b->parent.wl_display, b->parent.wl_display,
gl_renderer->alpha_attribs, gl_renderer->alpha_attribs,
NULL, wayland_formats,
0) < 0) { ARRAY_LENGTH(wayland_formats)) < 0) {
weston_log("Failed to initialize the GL renderer; " weston_log("Failed to initialize the GL renderer; "
"falling back to pixman.\n"); "falling back to pixman.\n");
b->use_pixman = true; b->use_pixman = true;

Loading…
Cancel
Save