[tbb-commits] [tor-browser-build/master] Bug 29843: Backport the fix for bug 1527534
gk at torproject.org
gk at torproject.org
Thu Apr 11 10:24:14 UTC 2019
commit b619af79d04bde9313d8a4a2696c4a5a06c60175
Author: Georg Koppen <gk at torproject.org>
Date: Thu Mar 21 15:06:04 2019 +0000
Bug 29843: Backport the fix for bug 1527534
---
projects/firefox/1527534.patch | 139 +++++++++++++++++++++++++++++++++++++++++
projects/firefox/build | 6 ++
projects/firefox/config | 2 +
3 files changed, 147 insertions(+)
diff --git a/projects/firefox/1527534.patch b/projects/firefox/1527534.patch
new file mode 100644
index 0000000..ad8720c
--- /dev/null
+++ b/projects/firefox/1527534.patch
@@ -0,0 +1,139 @@
+From dcd5a0e59bef209aa8301a427b749830876cdada Mon Sep 17 00:00:00 2001
+From: Jeff Gilbert <jgilbert at mozilla.com>
+Date: Tue, 19 Feb 2019 15:43:39 -0800
+Subject: [PATCH] Bug 1527534 - Reuse LoadApitraceLibrary. r=lsalzman a=lizzard
+
+Differential Revision: https://phabricator.services.mozilla.com/D20418
+
+diff --git a/gfx/gl/GLContextProviderEGL.cpp b/gfx/gl/GLContextProviderEGL.cpp
+index d91d03aee6a9..f4d8c1f80176 100644
+--- a/gfx/gl/GLContextProviderEGL.cpp
++++ b/gfx/gl/GLContextProviderEGL.cpp
+@@ -265,11 +265,8 @@ GLContextEGL::~GLContextEGL() {
+ }
+
+ bool GLContextEGL::Init() {
+-#if defined(ANDROID)
+- // We can't use LoadApitraceLibrary here because the GLContext
+- // expects its own handle to the GL library
+- if (!OpenLibrary(APITRACE_LIB))
+-#endif
++ mLibrary = LoadApitraceLibrary();
++ if (!mLibrary) {
+ if (!OpenLibrary(GLES2_LIB)) {
+ #if defined(XP_UNIX)
+ if (!OpenLibrary(GLES2_LIB2)) {
+@@ -278,6 +275,7 @@ bool GLContextEGL::Init() {
+ }
+ #endif
+ }
++ }
+
+ SetupLookupFunction();
+ if (!InitWithPrefix("gl", true)) return false;
+diff --git a/gfx/gl/GLLibraryEGL.cpp b/gfx/gl/GLLibraryEGL.cpp
+index fe4bd9811949..ef693e283968 100644
+--- a/gfx/gl/GLLibraryEGL.cpp
++++ b/gfx/gl/GLLibraryEGL.cpp
+@@ -63,9 +63,18 @@ static const char* sEGLExtensionNames[] = {
+ "EGL_ANGLE_device_creation_d3d11",
+ };
+
+-#if defined(ANDROID)
++PRLibrary* LoadApitraceLibrary() {
++ const char* path = nullptr;
++
++#ifdef ANDROID
++ // We only need to explicitly dlopen egltrace
++ // on android as we can use LD_PRELOAD or other tricks
++ // on other platforms. We look for it in /data/local
++ // as that's writeable by all users.
++ path = "/data/local/tmp/egltrace.so";
++#endif
++ if (!path) return nullptr;
+
+-static PRLibrary* LoadApitraceLibrary() {
+ // Initialization of gfx prefs here is only needed during the unit tests...
+ gfxPrefs::GetSingleton();
+ if (!gfxPrefs::UseApitrace()) {
+@@ -73,7 +82,6 @@ static PRLibrary* LoadApitraceLibrary() {
+ }
+
+ static PRLibrary* sApitraceLibrary = nullptr;
+-
+ if (sApitraceLibrary) return sApitraceLibrary;
+
+ nsAutoCString logFile;
+@@ -87,20 +95,19 @@ static PRLibrary* LoadApitraceLibrary() {
+ nsAutoCString logPath;
+ logPath.AppendPrintf("%s/%s", getenv("GRE_HOME"), logFile.get());
+
++#ifndef XP_WIN // Windows is missing setenv and forbids PR_LoadLibrary.
+ // apitrace uses the TRACE_FILE environment variable to determine where
+ // to log trace output to
+ printf_stderr("Logging GL tracing output to %s", logPath.get());
+ setenv("TRACE_FILE", logPath.get(), false);
+
+- printf_stderr("Attempting load of %s\n", APITRACE_LIB);
+-
+- sApitraceLibrary = PR_LoadLibrary(APITRACE_LIB);
++ printf_stderr("Attempting load of %s\n", path);
++ sApitraceLibrary = PR_LoadLibrary(path);
++#endif
+
+ return sApitraceLibrary;
+ }
+
+-#endif // ANDROID
+-
+ #ifdef XP_WIN
+ // see the comment in GLLibraryEGL::EnsureInitialized() for the rationale here.
+ static PRLibrary* LoadLibraryForEGLOnWindows(const nsAString& filename) {
+diff --git a/gfx/gl/GLLibraryEGL.h b/gfx/gl/GLLibraryEGL.h
+index 069a2f0908d7..3f200bf76b3f 100644
+--- a/gfx/gl/GLLibraryEGL.h
++++ b/gfx/gl/GLLibraryEGL.h
+@@ -18,18 +18,6 @@
+ #include <bitset>
+ #include <vector>
+
+-#ifdef ANDROID
+-// We only need to explicitly dlopen egltrace
+-// on android as we can use LD_PRELOAD or other tricks
+-// on other platforms. We look for it in /data/local
+-// as that's writeable by all users
+-//
+-// This should really go in GLLibraryEGL.cpp but we currently reference
+-// APITRACE_LIB in GLContextProviderEGL.cpp. Further refactoring
+-// will come in subsequent patches on Bug 732865
+-#define APITRACE_LIB "/data/local/tmp/egltrace.so"
+-#endif
+-
+ #if defined(MOZ_X11)
+ #define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)mozilla::DefaultXDisplay())
+ #else
+@@ -49,6 +37,7 @@ class DataSourceSurface;
+ namespace gl {
+
+ class GLContext;
++PRLibrary* LoadApitraceLibrary();
+
+ void BeforeEGLCall(const char* funcName);
+ void AfterEGLCall(const char* funcName);
+diff --git a/gfx/thebes/gfxPrefs.h b/gfx/thebes/gfxPrefs.h
+index b2e094672b59..fae5bec1e78e 100644
+--- a/gfx/thebes/gfxPrefs.h
++++ b/gfx/thebes/gfxPrefs.h
+@@ -433,9 +433,7 @@ class gfxPrefs final {
+ SmoothScrollMSDPhysicsRegularSpringConstant, int32_t, 1000);
+
+ DECL_GFX_PREF(Once, "gfx.android.rgb16.force", AndroidRGB16Force, bool, false);
+-#if defined(ANDROID)
+ DECL_GFX_PREF(Once, "gfx.apitrace.enabled", UseApitrace, bool, false);
+-#endif
+ #if defined(RELEASE_OR_BETA)
+ // "Skip" means this is locked to the default value in beta and release.
+ DECL_GFX_PREF(Skip, "gfx.blocklist.all", BlocklistAll, int32_t, 0);
+--
+2.20.1
+
diff --git a/projects/firefox/build b/projects/firefox/build
index 9bc025a..96cba10 100644
--- a/projects/firefox/build
+++ b/projects/firefox/build
@@ -153,6 +153,12 @@ fi
patch -p1 < $rootdir/nsis-uninstall.patch
[% END -%]
+# Backporting a sec-high bugfix to ESR 60, but making sure it is only applied to
+# mobile, as desktop ESR has not seen any testing with this mobile-related patch
+[% IF c("var/android") %]
+ patch -p1 < $rootdir/1527534.patch
+[% END -%]
+
rm -f configure
rm -f js/src/configure
diff --git a/projects/firefox/config b/projects/firefox/config
index 9c85fcb..41f7fbd 100644
--- a/projects/firefox/config
+++ b/projects/firefox/config
@@ -166,3 +166,5 @@ input_files:
- project: firefox-locale-bundle
name: firefox-locale-bundle
enable: '[% c("var/android") %]'
+ - filename: 1527534.patch
+ enable: '[% c("var/android") %]'
More information about the tbb-commits
mailing list