Commit c19b674f authored by Konstantin's avatar Konstantin
Browse files

xwayland: fix glamor es black windows



On some drivers (mesa included), when we request GBM_FORMAT_XRGB8888,
driver set surface storage format to GL_RGB8, which breaks gles2 rendering.
If we force set gbm_format to GBM_FORMAT_ARGB8888, then rendering
will happen and working. For correct colors, we need !924.

Fixes #1288
Fixes #1356

Signed-off-by: Konstantin's avatarKonstantin <ria.freelander@gmail.com>
parent e37eeb7a
Pipeline #630030 passed with stages
in 2 minutes and 44 seconds
......@@ -81,12 +81,14 @@ xwl_gbm_get(struct xwl_screen *xwl_screen)
}
static uint32_t
gbm_format_for_depth(int depth)
gbm_format_for_depth(int depth, int gles)
{
switch (depth) {
case 16:
return GBM_FORMAT_RGB565;
case 24:
if (gles)
return GBM_FORMAT_ARGB8888;
return GBM_FORMAT_XRGB8888;
case 30:
return GBM_FORMAT_ARGB2101010;
......@@ -284,7 +286,7 @@ xwl_glamor_gbm_create_pixmap(ScreenPtr screen,
(hint == CREATE_PIXMAP_USAGE_BACKING_PIXMAP ||
hint == CREATE_PIXMAP_USAGE_SHARED ||
(xwl_screen->rootless && hint == 0))) {
uint32_t format = gbm_format_for_depth(depth);
uint32_t format = gbm_format_for_depth(depth, xwl_screen->glamor_gles);
#ifdef GBM_BO_WITH_MODIFIERS
if (xwl_gbm->dmabuf_capable) {
......@@ -564,7 +566,7 @@ glamor_pixmap_from_fds(ScreenPtr screen, CARD8 num_fds, const int *fds,
data.width = width;
data.height = height;
data.num_fds = num_fds;
data.format = gbm_format_for_depth(depth);
data.format = gbm_format_for_depth(depth, xwl_screen->glamor_gles);
data.modifier = modifier;
for (i = 0; i < num_fds; i++) {
data.fds[i] = fds[i];
......@@ -581,7 +583,7 @@ glamor_pixmap_from_fds(ScreenPtr screen, CARD8 num_fds, const int *fds,
data.width = width;
data.height = height;
data.stride = strides[0];
data.format = gbm_format_for_depth(depth);
data.format = gbm_format_for_depth(depth, xwl_screen->glamor_gles);
bo = gbm_bo_import(xwl_gbm->gbm, GBM_BO_IMPORT_FD, &data,
GBM_BO_USE_RENDERING);
} else {
......@@ -995,6 +997,7 @@ xwl_glamor_gbm_init_egl(struct xwl_screen *xwl_screen)
/* Mesa uses "drm" as backend name, in that case, just do nothing */
if (gbm_backend_name && strcmp(gbm_backend_name, "drm") != 0)
xwl_screen->glvnd_vendor = gbm_backend_name;
xwl_screen->glamor_gles = !epoxy_is_desktop_gl();
return TRUE;
error:
......
......@@ -60,6 +60,7 @@ struct xwl_screen {
int rootless;
int glamor;
int glamor_gles;
int present;
int force_xrandr_emulation;
int fullscreen;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment