Bug 1699864 - Request 32bit color depth on Linux/EGL by default, r=stransky,jgilbert

Since D108508 the X11/EGL backend creates a shared GL context via
`CreateGLContextEGL()` which chains up to `CreateForCompositorWidget()`
with a `nullptr` widget. With the OGL compositor we relied on the
widget giving us a valid color depth, while now we'd fall back to
`gfxVars::ScreenDepth()`.

On X11 color depth is defined as:
> depth means the number of bits in a pixel that are actually used
> to determine the pixel color

i.e. we on a usual system we would get 24bit.

As we require an alpha channel when using WR, the result would be
disappointing. Thus hardcode 32bit color depth for X11/EGL when
creating contexts without widget for now.

In order to keep X11 and Wayland code close together, do the same
on Wayland, even if `gfxVars::ScreenDepth()` returns valid values
there.

Differential Revision: https://phabricator.services.mozilla.com/D109737
This commit is contained in:
Robert Mader 2021-03-25 18:44:13 +00:00
Родитель b696e62540
Коммит 1dcdf4e04c
1 изменённых файлов: 4 добавлений и 0 удалений

Просмотреть файл

@ -1007,6 +1007,10 @@ already_AddRefed<GLContext> GLContextProviderEGL::CreateForCompositorWidget(
window = GET_NATIVE_WINDOW_FROM_COMPOSITOR_WIDGET(aCompositorWidget);
#if defined(MOZ_WIDGET_GTK)
depth = aCompositorWidget->AsX11()->GetDepth();
#endif
} else {
#if defined(MOZ_WIDGET_GTK)
depth = 32;
#endif
}
return GLContextEGLFactory::Create(window, aWebRender, depth);