File mozilla-bmo1669275_use-GLX_SGI_video_sync.patch of Package MozillaThunderbird
# HG changeset patch
# User Robert Mader <robert.mader@posteo.de>
# Date 1606224619 0
# Node ID 20a6e3ad662fd3cea506501fb021f551e69bc356
# Parent 8ec50232ea5541b34962a496abaff720ebd81a73
Bug 1669275 - [WR/EGL/X11] Use GLX vsyncsource on mesa. r=stransky
This allows mesa to continue using the existing vsync implementation.
Differential Revision: https://phabricator.services.mozilla.com/D92466
diff --git a/gfx/thebes/gfxPlatformGtk.cpp b/gfx/thebes/gfxPlatformGtk.cpp
--- a/gfx/thebes/gfxPlatformGtk.cpp
+++ b/gfx/thebes/gfxPlatformGtk.cpp
@@ -27,16 +27,17 @@
#include "GLContextProvider.h"
#include "mozilla/Atomics.h"
#include "mozilla/FontPropertyTypes.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/gfx/Logging.h"
#include "mozilla/Monitor.h"
#include "mozilla/Preferences.h"
#include "mozilla/StaticPrefs_layers.h"
+#include "nsIGfxInfo.h"
#include "nsMathUtils.h"
#include "nsUnicharUtils.h"
#include "nsUnicodeProperties.h"
#include "VsyncSource.h"
#ifdef MOZ_X11
# include <gdk/gdkx.h>
# include "cairo-xlib.h"
@@ -697,18 +698,23 @@ already_AddRefed<gfx::VsyncSource> gfxPl
// The extra cost of initializing a GLX context while blocking the main
// thread is not worth it when using basic composition.
//
// Don't call gl::sGLXLibrary.SupportsVideoSync() when EGL is used.
// NVIDIA drivers refuse to use EGL GL context when GLX was initialized first
// and fail silently.
if (gfxConfig::IsEnabled(Feature::HW_COMPOSITING)) {
bool useGlxVsync = false;
- // Nvidia doesn't support GLX at the same time as EGL.
- if (!gfxVars::UseEGL()) {
+
+ nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
+ nsString adapterDriverVendor;
+ gfxInfo->GetAdapterDriverVendor(adapterDriverVendor);
+
+ // Nvidia doesn't support GLX at the same time as EGL but Mesa does.
+ if (!gfxVars::UseEGL() || (adapterDriverVendor.Find("mesa") != -1)) {
useGlxVsync = gl::sGLXLibrary.SupportsVideoSync();
}
if (useGlxVsync) {
RefPtr<VsyncSource> vsyncSource = new GtkVsyncSource();
VsyncSource::Display& display = vsyncSource->GetGlobalDisplay();
if (!static_cast<GtkVsyncSource::GLXDisplay&>(display).Setup()) {
NS_WARNING(
"Failed to setup GLContext, falling back to software vsync.");