backend-x11: 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 ed20b4d983
commit 9ddb3bc315
  1. 17
      libweston/backend-x11/x11.c

@ -39,6 +39,7 @@
#include <sys/shm.h> #include <sys/shm.h>
#include <linux/input.h> #include <linux/input.h>
#include <drm_fourcc.h>
#include <xcb/xcb.h> #include <xcb/xcb.h>
#include <xcb/shm.h> #include <xcb/shm.h>
#ifdef HAVE_XCB_XKB #ifdef HAVE_XCB_XKB
@ -72,6 +73,10 @@
#define WINDOW_MAX_WIDTH 8192 #define WINDOW_MAX_WIDTH 8192
#define WINDOW_MAX_HEIGHT 8192 #define WINDOW_MAX_HEIGHT 8192
static const uint32_t x11_formats[] = {
DRM_FORMAT_XRGB8888,
};
struct x11_backend { struct x11_backend {
struct weston_backend base; struct weston_backend base;
struct weston_compositor *compositor; struct weston_compositor *compositor;
@ -866,8 +871,8 @@ x11_output_switch_mode(struct weston_output *base, struct weston_mode *mode)
(EGLNativeWindowType) output->window, (EGLNativeWindowType) output->window,
&xid, &xid,
gl_renderer->opaque_attribs, gl_renderer->opaque_attribs,
NULL, x11_formats,
0); ARRAY_LENGTH(x11_formats));
if (ret < 0) if (ret < 0)
return -1; return -1;
} }
@ -1042,8 +1047,8 @@ x11_output_enable(struct weston_output *base)
(EGLNativeWindowType) output->window, (EGLNativeWindowType) output->window,
&xid, &xid,
gl_renderer->opaque_attribs, gl_renderer->opaque_attribs,
NULL, x11_formats,
0); ARRAY_LENGTH(x11_formats));
if (ret < 0) if (ret < 0)
goto err; goto err;
@ -1810,7 +1815,9 @@ init_gl_renderer(struct x11_backend *b)
ret = gl_renderer->display_create(b->compositor, EGL_PLATFORM_X11_KHR, ret = gl_renderer->display_create(b->compositor, EGL_PLATFORM_X11_KHR,
(void *) b->dpy, (void *) b->dpy,
gl_renderer->opaque_attribs, NULL, 0); gl_renderer->opaque_attribs,
x11_formats,
ARRAY_LENGTH(x11_formats));
return ret; return ret;
} }

Loading…
Cancel
Save