Bug 1516224 - [Linux/Gtk] Disable ARGB toplevel visual on X11 SW compositor due to visible graphics artifacts, r=lsalzman

Differential Revision: https://phabricator.services.mozilla.com/D16561

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Martin Stransky 2019-01-15 17:45:35 +00:00
Родитель 17adb0406b
Коммит 956e93c403
1 изменённых файлов: 12 добавлений и 11 удалений

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

@ -3174,14 +3174,6 @@ nsresult nsWindow::Create(nsIWidget *aParent, nsNativeWidget aNativeParent,
bool needsAlphaVisual = bool needsAlphaVisual =
(mWindowType == eWindowType_popup && aInitData->mSupportTranslucency); (mWindowType == eWindowType_popup && aInitData->mSupportTranslucency);
// Some Gtk+ themes use non-rectangular toplevel windows. To fully support
// such themes we need to make toplevel window transparent with ARGB visual.
// It may cause performanance issue so make it configurable
// and enable it by default for selected window managers.
if (mWindowType == eWindowType_toplevel) {
needsAlphaVisual = TopLevelWindowUseARGBVisual();
}
if (aParent) { if (aParent) {
parentnsWindow = static_cast<nsWindow *>(aParent); parentnsWindow = static_cast<nsWindow *>(aParent);
parentGdkWindow = parentnsWindow->mGdkWindow; parentGdkWindow = parentnsWindow->mGdkWindow;
@ -3228,8 +3220,6 @@ nsresult nsWindow::Create(nsIWidget *aParent, nsNativeWidget aNativeParent,
} }
mShell = gtk_window_new(type); mShell = gtk_window_new(type);
bool isSetVisual = false;
#ifdef MOZ_X11
// Ensure gfxPlatform is initialized, since that is what initializes // Ensure gfxPlatform is initialized, since that is what initializes
// gfxVars, used below. // gfxVars, used below.
Unused << gfxPlatform::GetPlatform(); Unused << gfxPlatform::GetPlatform();
@ -3240,6 +3230,18 @@ nsresult nsWindow::Create(nsIWidget *aParent, nsNativeWidget aNativeParent,
bool shouldAccelerate = ComputeShouldAccelerate(); bool shouldAccelerate = ComputeShouldAccelerate();
MOZ_ASSERT(shouldAccelerate | !useWebRender); MOZ_ASSERT(shouldAccelerate | !useWebRender);
// Some Gtk+ themes use non-rectangular toplevel windows. To fully support
// such themes we need to make toplevel window transparent with ARGB visual.
// It may cause performanance issue so make it configurable
// and enable it by default for selected window managers.
// Also disable it for X11 SW rendering (Bug 1516224) by default.
if (mWindowType == eWindowType_toplevel &&
(shouldAccelerate || !mIsX11Display ||
Preferences::HasUserValue("mozilla.widget.use-argb-visuals"))) {
needsAlphaVisual = TopLevelWindowUseARGBVisual();
}
bool isSetVisual = false;
// If using WebRender on X11, we need to select a visual with a depth // If using WebRender on X11, we need to select a visual with a depth
// buffer, as well as an alpha channel if transparency is requested. This // buffer, as well as an alpha channel if transparency is requested. This
// must be done before the widget is realized. // must be done before the widget is realized.
@ -3263,7 +3265,6 @@ nsresult nsWindow::Create(nsIWidget *aParent, nsNativeWidget aNativeParent,
NS_WARNING("We're missing X11 Visual!"); NS_WARNING("We're missing X11 Visual!");
} }
} }
#endif // MOZ_X11
if (!isSetVisual && needsAlphaVisual) { if (!isSetVisual && needsAlphaVisual) {
GdkScreen *screen = gtk_widget_get_screen(mShell); GdkScreen *screen = gtk_widget_get_screen(mShell);