Bug 1950610 [Wayland] Always use WR compositor to paint D&D popups r=lsalzman
We can't use native compositor to paint D&D popups as Wayland doesn't implement subsurfaces for it. Differential Revision: https://phabricator.services.mozilla.com/D239733
This commit is contained in:
@@ -42,6 +42,7 @@ class CompositorOptions {
|
||||
bool AllowSoftwareWebRenderOGL() const { return mAllowSoftwareWebRenderOGL; }
|
||||
bool InitiallyPaused() const { return mInitiallyPaused; }
|
||||
bool NeedFastSnaphot() const { return mNeedFastSnaphot; }
|
||||
bool AllowNativeCompositor() const { return mAllowNativeCompositor; }
|
||||
|
||||
void SetUseAPZ(bool aUseAPZ) { mUseAPZ = aUseAPZ; }
|
||||
|
||||
@@ -61,13 +62,18 @@ class CompositorOptions {
|
||||
mNeedFastSnaphot = aNeedFastSnaphot;
|
||||
}
|
||||
|
||||
void SetAllowNativeCompositor(bool aAllowNativeCompositor) {
|
||||
mAllowNativeCompositor = aAllowNativeCompositor;
|
||||
}
|
||||
|
||||
bool EqualsIgnoringApzEnablement(const CompositorOptions& aOther) const {
|
||||
return mUseSoftwareWebRender == aOther.mUseSoftwareWebRender &&
|
||||
mAllowSoftwareWebRenderD3D11 ==
|
||||
aOther.mAllowSoftwareWebRenderD3D11 &&
|
||||
mAllowSoftwareWebRenderOGL == aOther.mAllowSoftwareWebRenderOGL &&
|
||||
mInitiallyPaused == aOther.mInitiallyPaused &&
|
||||
mNeedFastSnaphot == aOther.mNeedFastSnaphot;
|
||||
mNeedFastSnaphot == aOther.mNeedFastSnaphot &&
|
||||
mAllowNativeCompositor == aOther.mAllowNativeCompositor;
|
||||
}
|
||||
|
||||
bool operator==(const CompositorOptions& aOther) const {
|
||||
@@ -83,6 +89,7 @@ class CompositorOptions {
|
||||
bool mAllowSoftwareWebRenderOGL = false;
|
||||
bool mInitiallyPaused = false;
|
||||
bool mNeedFastSnaphot = false;
|
||||
bool mAllowNativeCompositor = true;
|
||||
|
||||
// Make sure to add new fields to the ParamTraits implementation
|
||||
// in LayersMessageUtils.h
|
||||
|
||||
@@ -1011,6 +1011,7 @@ struct ParamTraits<mozilla::layers::CompositorOptions> {
|
||||
WriteParam(aWriter, aParam.mAllowSoftwareWebRenderOGL);
|
||||
WriteParam(aWriter, aParam.mInitiallyPaused);
|
||||
WriteParam(aWriter, aParam.mNeedFastSnaphot);
|
||||
WriteParam(aWriter, aParam.mAllowNativeCompositor);
|
||||
}
|
||||
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
@@ -1019,7 +1020,8 @@ struct ParamTraits<mozilla::layers::CompositorOptions> {
|
||||
ReadParam(aReader, &aResult->mAllowSoftwareWebRenderD3D11) &&
|
||||
ReadParam(aReader, &aResult->mAllowSoftwareWebRenderOGL) &&
|
||||
ReadParam(aReader, &aResult->mInitiallyPaused) &&
|
||||
ReadParam(aReader, &aResult->mNeedFastSnaphot);
|
||||
ReadParam(aReader, &aResult->mNeedFastSnaphot) &&
|
||||
ReadParam(aReader, &aResult->mAllowNativeCompositor);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -205,7 +205,10 @@ UniquePtr<RenderCompositor> RenderCompositor::Create(
|
||||
return RenderCompositorNativeSWGL::Create(aWidget, aError);
|
||||
}
|
||||
#elif defined(MOZ_WAYLAND)
|
||||
if (gfx::gfxVars::UseWebRenderCompositor()) {
|
||||
// Some widgets on Wayland (D&D popups for instance) can't use native
|
||||
// compositor due to system limitations.
|
||||
if (gfx::gfxVars::UseWebRenderCompositor() &&
|
||||
aWidget->GetCompositorOptions().AllowNativeCompositor()) {
|
||||
return RenderCompositorNativeSWGL::Create(aWidget, aError);
|
||||
}
|
||||
#endif
|
||||
@@ -231,7 +234,8 @@ UniquePtr<RenderCompositor> RenderCompositor::Create(
|
||||
#endif
|
||||
|
||||
#if defined(MOZ_WAYLAND)
|
||||
if (gfx::gfxVars::UseWebRenderCompositor()) {
|
||||
if (gfx::gfxVars::UseWebRenderCompositor() &&
|
||||
aWidget->GetCompositorOptions().AllowNativeCompositor()) {
|
||||
return RenderCompositorNativeOGL::Create(aWidget, aError);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -432,6 +432,7 @@ class nsWindow final : public nsBaseWidget {
|
||||
LayoutDeviceIntMargin GtkBorderToDevicePixels(const GtkBorder&);
|
||||
|
||||
bool WidgetTypeSupportsAcceleration() override;
|
||||
bool WidgetTypeSupportsNativeCompositing() override { return !mIsDragPopup; }
|
||||
|
||||
nsresult SetSystemFont(const nsCString& aFontName) override;
|
||||
nsresult GetSystemFont(nsCString& aFontName) override;
|
||||
|
||||
@@ -1452,6 +1452,7 @@ already_AddRefed<WebRenderLayerManager> nsBaseWidget::CreateCompositorSession(
|
||||
options.SetAllowSoftwareWebRenderOGL(
|
||||
gfx::gfxVars::AllowSoftwareWebRenderOGL());
|
||||
}
|
||||
options.SetAllowNativeCompositor(WidgetTypeSupportsNativeCompositing());
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
|
||||
@@ -280,6 +280,7 @@ class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference {
|
||||
}
|
||||
bool ComputeShouldAccelerate();
|
||||
virtual bool WidgetTypeSupportsAcceleration() { return true; }
|
||||
virtual bool WidgetTypeSupportsNativeCompositing() { return true; }
|
||||
[[nodiscard]] nsresult OnDefaultButtonLoaded(
|
||||
const LayoutDeviceIntRect& aButtonRect) override {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
Reference in New Issue
Block a user