зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1712472 - Reenable depth-buffer in EGL config if native compositor is used, r=jgilbert,gw
After D113532, a depth-buffer is not needed any more for the draw compositor and it was subsequently removed from the EGL and GLX context providers in D115216. This, however, broke the experimental Wayland native compositor integration, which still needs it. `SurfacePoolCA` solves this by manually attaching a depth buffer in `CreateFramebufferForTexture`. `SurfacePoolWayland` will likely be able to do the same eventually, however until that is the case we need the GL context to provide it. While on it, move the hardcoded bits into a better place below the hard-coded values for ANGLE and remove now used code to make things less cluttered. Context: the `aDepth` argument was introduced in D76417 for EGL on X11 support, which used `RenderCompositorOGL`. This was changed in D108508, making X11/EGL use `RenderCompositorEGL` instead, which uses a shared GL singleton. This again required the color depth to be independent of the window, so 32bit color depth was hardcoded in D109737. Therefore, the `aDepth` and other things introduced in D76417 can be removed again. Finally, it was found that we only need 32bit depth when used with HW-WR, see also D114959. Differential Revision: https://phabricator.services.mozilla.com/D115760
This commit is contained in:
Родитель
c030d257c2
Коммит
de931f5505
|
@ -226,11 +226,10 @@ static EGLSurface CreateSurfaceFromNativeWindow(
|
|||
class GLContextEGLFactory {
|
||||
public:
|
||||
static already_AddRefed<GLContext> Create(EGLNativeWindowType aWindow,
|
||||
bool aHardwareWebRender,
|
||||
int32_t aDepth);
|
||||
bool aHardwareWebRender);
|
||||
static already_AddRefed<GLContext> CreateImpl(EGLNativeWindowType aWindow,
|
||||
bool aHardwareWebRender,
|
||||
bool aUseGles, int32_t aDepth);
|
||||
bool aUseGles);
|
||||
|
||||
private:
|
||||
GLContextEGLFactory() = default;
|
||||
|
@ -238,8 +237,7 @@ class GLContextEGLFactory {
|
|||
};
|
||||
|
||||
already_AddRefed<GLContext> GLContextEGLFactory::CreateImpl(
|
||||
EGLNativeWindowType aWindow, bool aHardwareWebRender, bool aUseGles,
|
||||
int32_t aDepth) {
|
||||
EGLNativeWindowType aWindow, bool aHardwareWebRender, bool aUseGles) {
|
||||
nsCString failureId;
|
||||
const auto lib = gl::DefaultEglLibrary(&failureId);
|
||||
if (!lib) {
|
||||
|
@ -280,20 +278,20 @@ already_AddRefed<GLContext> GLContextEGLFactory::CreateImpl(
|
|||
gfxCriticalNote << "Failed to create EGLConfig for WebRender ANGLE!";
|
||||
return nullptr;
|
||||
}
|
||||
} else if (aHardwareWebRender && (kIsWayland || kIsX11)) {
|
||||
const int bpp = 32;
|
||||
const bool enableDepthBuffer = gfx::gfxVars::UseWebRenderCompositor();
|
||||
if (!CreateConfig(*egl, &config, bpp, enableDepthBuffer, aUseGles,
|
||||
visualID)) {
|
||||
gfxCriticalNote << "Failed to create EGLConfig for WebRender!";
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
if (aDepth) {
|
||||
if (!CreateConfig(*egl, &config, aDepth, false, aUseGles, visualID)) {
|
||||
gfxCriticalNote
|
||||
<< "Failed to create EGLConfig for WebRender with depth!";
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
if (!CreateConfigScreen(*egl, &config,
|
||||
/* aEnableDepthBuffer */ false, aUseGles,
|
||||
visualID)) {
|
||||
gfxCriticalNote << "Failed to create EGLConfig!";
|
||||
return nullptr;
|
||||
}
|
||||
if (!CreateConfigScreen(*egl, &config,
|
||||
/* aEnableDepthBuffer */ false, aUseGles,
|
||||
visualID)) {
|
||||
gfxCriticalNote << "Failed to create EGLConfig!";
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -344,16 +342,14 @@ already_AddRefed<GLContext> GLContextEGLFactory::CreateImpl(
|
|||
}
|
||||
|
||||
already_AddRefed<GLContext> GLContextEGLFactory::Create(
|
||||
EGLNativeWindowType aWindow, bool aHardwareWebRender, int32_t aDepth) {
|
||||
EGLNativeWindowType aWindow, bool aHardwareWebRender) {
|
||||
RefPtr<GLContext> glContext;
|
||||
#if !defined(MOZ_WIDGET_ANDROID)
|
||||
glContext =
|
||||
CreateImpl(aWindow, aHardwareWebRender, /* aUseGles */ false, aDepth);
|
||||
glContext = CreateImpl(aWindow, aHardwareWebRender, /* aUseGles */ false);
|
||||
#endif // !defined(MOZ_WIDGET_ANDROID)
|
||||
|
||||
if (!glContext) {
|
||||
glContext =
|
||||
CreateImpl(aWindow, aHardwareWebRender, /* aUseGles */ true, aDepth);
|
||||
glContext = CreateImpl(aWindow, aHardwareWebRender, /* aUseGles */ true);
|
||||
}
|
||||
return glContext.forget();
|
||||
}
|
||||
|
@ -1004,18 +1000,10 @@ already_AddRefed<GLContext> GLContextProviderEGL::CreateForCompositorWidget(
|
|||
CompositorWidget* aCompositorWidget, bool aHardwareWebRender,
|
||||
bool /*aForceAccelerated*/) {
|
||||
EGLNativeWindowType window = nullptr;
|
||||
int32_t depth = 0;
|
||||
if (aCompositorWidget) {
|
||||
window = GET_NATIVE_WINDOW_FROM_COMPOSITOR_WIDGET(aCompositorWidget);
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
depth = aCompositorWidget->AsGTK()->GetDepth();
|
||||
#endif
|
||||
} else {
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
depth = 32;
|
||||
#endif
|
||||
}
|
||||
return GLContextEGLFactory::Create(window, aHardwareWebRender, depth);
|
||||
return GLContextEGLFactory::Create(window, aHardwareWebRender);
|
||||
}
|
||||
|
||||
EGLSurface GLContextEGL::CreateCompatibleSurface(void* aWindow) const {
|
||||
|
|
|
@ -44,10 +44,10 @@ GtkCompositorWidget::GtkCompositorWidget(
|
|||
}
|
||||
|
||||
Visual* visual = windowAttrs.visual;
|
||||
mDepth = windowAttrs.depth;
|
||||
int depth = windowAttrs.depth;
|
||||
|
||||
// Initialize the window surface provider
|
||||
mProvider.Initialize(mXWindow, visual, mDepth, aInitData.Shaped());
|
||||
mProvider.Initialize(mXWindow, visual, depth, aInitData.Shaped());
|
||||
}
|
||||
#endif
|
||||
auto size = mClientSize.Lock();
|
||||
|
@ -102,8 +102,6 @@ EGLNativeWindowType GtkCompositorWidget::GetEGLNativeWindow() {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
int32_t GtkCompositorWidget::GetDepth() { return mDepth; }
|
||||
|
||||
#if defined(MOZ_WAYLAND)
|
||||
void GtkCompositorWidget::SetEGLNativeWindowSize(
|
||||
const LayoutDeviceIntSize& aEGLWindowSize) {
|
||||
|
|
|
@ -64,7 +64,6 @@ class GtkCompositorWidget : public CompositorWidget,
|
|||
CompositorWidgetDelegate* AsDelegate() override { return this; }
|
||||
|
||||
EGLNativeWindowType GetEGLNativeWindow();
|
||||
int32_t GetDepth();
|
||||
|
||||
LayoutDeviceIntRegion GetTransparentRegion() override;
|
||||
|
||||
|
@ -97,8 +96,6 @@ class GtkCompositorWidget : public CompositorWidget,
|
|||
#if defined(MOZ_X11)
|
||||
Window mXWindow = {};
|
||||
#endif
|
||||
int32_t mDepth = {};
|
||||
|
||||
#ifdef MOZ_WAYLAND
|
||||
RefPtr<mozilla::layers::NativeLayerRootWayland> mNativeLayerRoot;
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче