summaryrefslogtreecommitdiff
path: root/gfx/gl
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-12-27 06:58:56 +0000
committerMoonchild <moonchild@palemoon.org>2020-12-27 06:58:56 +0000
commit8d4456c797eea9236f4d84cdb23d85ce670152dc (patch)
tree5328170540665a789e1d857957e433f253849f8b /gfx/gl
parentae2a160348562dfa5361f1e68226365b240c9597 (diff)
downloaduxp-8d4456c797eea9236f4d84cdb23d85ce670152dc.tar.gz
Issue #1053 - Part 3a: Remove Android conditionals from /gfx
Diffstat (limited to 'gfx/gl')
-rw-r--r--gfx/gl/GLBlitHelper.cpp120
-rw-r--r--gfx/gl/GLBlitHelper.h5
-rw-r--r--gfx/gl/GLContext.cpp93
-rw-r--r--gfx/gl/GLContext.h13
-rw-r--r--gfx/gl/GLContextProviderEGL.cpp83
-rw-r--r--gfx/gl/GLContextProviderImpl.h8
-rw-r--r--gfx/gl/GLLibraryEGL.cpp72
-rw-r--r--gfx/gl/GLLibraryEGL.h26
-rw-r--r--gfx/gl/moz.build2
9 files changed, 8 insertions, 414 deletions
diff --git a/gfx/gl/GLBlitHelper.cpp b/gfx/gl/GLBlitHelper.cpp
index d59cea8636..da7f5b462d 100644
--- a/gfx/gl/GLBlitHelper.cpp
+++ b/gfx/gl/GLBlitHelper.cpp
@@ -14,12 +14,6 @@
#include "mozilla/gfx/Matrix.h"
#include "mozilla/UniquePtr.h"
-#ifdef MOZ_WIDGET_ANDROID
-#include "AndroidSurfaceTexture.h"
-#include "GLImages.h"
-#include "GLLibraryEGL.h"
-#endif
-
#ifdef XP_MACOSX
#include "MacIOSurfaceImage.h"
#include "GLContextCGL.h"
@@ -146,26 +140,6 @@ GLBlitHelper::InitTexQuadProgram(BlitType target)
vTexCoord * uTexCoordMult); \n\
} \n\
";
-#ifdef ANDROID /* MOZ_WIDGET_ANDROID */
- const char kTexExternalBlit_FragShaderSource[] = "\
- #version 100 \n\
- #extension GL_OES_EGL_image_external : require \n\
- #ifdef GL_FRAGMENT_PRECISION_HIGH \n\
- precision highp float; \n\
- #else \n\
- precision mediump float; \n\
- #endif \n\
- varying vec2 vTexCoord; \n\
- uniform mat4 uTextureTransform; \n\
- uniform samplerExternalOES uTexUnit; \n\
- \n\
- void main() \n\
- { \n\
- gl_FragColor = texture2D(uTexUnit, \n\
- (uTextureTransform * vec4(vTexCoord, 0.0, 1.0)).xy); \n\
- } \n\
- ";
-#endif
/* From Rec601:
[R] [1.1643835616438356, 0.0, 1.5960267857142858] [ Y - 16]
[G] = [1.1643835616438358, -0.3917622900949137, -0.8129676472377708] x [Cb - 128]
@@ -257,14 +231,6 @@ GLBlitHelper::InitTexQuadProgram(BlitType target)
fragShaderPtr = &mTex2DRectBlit_FragShader;
fragShaderSource = kTex2DRectBlit_FragShaderSource;
break;
-#ifdef ANDROID
- case ConvertSurfaceTexture:
- case ConvertGralloc:
- programPtr = &mTexExternalBlit_Program;
- fragShaderPtr = &mTexExternalBlit_FragShader;
- fragShaderSource = kTexExternalBlit_FragShaderSource;
- break;
-#endif
case ConvertPlanarYCbCr:
programPtr = &mTexYUVPlanarBlit_Program;
fragShaderPtr = &mTexYUVPlanarBlit_FragShader;
@@ -398,10 +364,6 @@ GLBlitHelper::InitTexQuadProgram(BlitType target)
// Cache and set attribute and uniform
mGL->fUseProgram(program);
switch (target) {
-#ifdef ANDROID
- case ConvertSurfaceTexture:
- case ConvertGralloc:
-#endif
case BlitTex2D:
case BlitTexRect:
case ConvertEGLImage: {
@@ -678,67 +640,6 @@ GLBlitHelper::BindAndUploadEGLImage(EGLImage image, GLuint target)
mGL->fEGLImageTargetTexture2D(target, image);
}
-#ifdef MOZ_WIDGET_ANDROID
-
-#define ATTACH_WAIT_MS 50
-
-bool
-GLBlitHelper::BlitSurfaceTextureImage(layers::SurfaceTextureImage* stImage)
-{
- AndroidSurfaceTexture* surfaceTexture = stImage->GetSurfaceTexture();
-
- ScopedBindTextureUnit boundTU(mGL, LOCAL_GL_TEXTURE0);
-
- if (NS_FAILED(surfaceTexture->Attach(mGL, PR_MillisecondsToInterval(ATTACH_WAIT_MS))))
- return false;
-
- // UpdateTexImage() changes the EXTERNAL binding, so save it here
- // so we can restore it after.
- int oldBinding = 0;
- mGL->fGetIntegerv(LOCAL_GL_TEXTURE_BINDING_EXTERNAL, &oldBinding);
-
- surfaceTexture->UpdateTexImage();
-
- gfx::Matrix4x4 transform;
- surfaceTexture->GetTransformMatrix(transform);
-
- mGL->fUniformMatrix4fv(mTextureTransformLoc, 1, false, &transform._11);
- mGL->fDrawArrays(LOCAL_GL_TRIANGLE_STRIP, 0, 4);
-
- surfaceTexture->Detach();
-
- mGL->fBindTexture(LOCAL_GL_TEXTURE_EXTERNAL, oldBinding);
- return true;
-}
-
-bool
-GLBlitHelper::BlitEGLImageImage(layers::EGLImageImage* image)
-{
- EGLImage eglImage = image->GetImage();
- EGLSync eglSync = image->GetSync();
-
- if (eglSync) {
- EGLint status = sEGLLibrary.fClientWaitSync(EGL_DISPLAY(), eglSync, 0, LOCAL_EGL_FOREVER);
- if (status != LOCAL_EGL_CONDITION_SATISFIED) {
- return false;
- }
- }
-
- ScopedBindTextureUnit boundTU(mGL, LOCAL_GL_TEXTURE0);
-
- int oldBinding = 0;
- mGL->fGetIntegerv(LOCAL_GL_TEXTURE_BINDING_2D, &oldBinding);
-
- BindAndUploadEGLImage(eglImage, LOCAL_GL_TEXTURE_2D);
-
- mGL->fDrawArrays(LOCAL_GL_TRIANGLE_STRIP, 0, 4);
-
- mGL->fBindTexture(LOCAL_GL_TEXTURE_2D, oldBinding);
- return true;
-}
-
-#endif
-
bool
GLBlitHelper::BlitPlanarYCbCrImage(layers::PlanarYCbCrImage* yuvImage)
{
@@ -835,16 +736,6 @@ GLBlitHelper::BlitImageToFramebuffer(layers::Image* srcImage,
srcOrigin = OriginPos::BottomLeft;
break;
-#ifdef MOZ_WIDGET_ANDROID
- case ImageFormat::SURFACE_TEXTURE:
- type = ConvertSurfaceTexture;
- srcOrigin = srcImage->AsSurfaceTextureImage()->GetOriginPos();
- break;
- case ImageFormat::EGLIMAGE:
- type = ConvertEGLImage;
- srcOrigin = srcImage->AsEGLImageImage()->GetOriginPos();
- break;
-#endif
#ifdef XP_MACOSX
case ImageFormat::MAC_IOSURFACE:
type = ConvertMacIOSurfaceImage;
@@ -877,14 +768,6 @@ GLBlitHelper::BlitImageToFramebuffer(layers::Image* srcImage,
return ret;
}
-#ifdef MOZ_WIDGET_ANDROID
- case ConvertSurfaceTexture:
- return BlitSurfaceTextureImage(static_cast<layers::SurfaceTextureImage*>(srcImage));
-
- case ConvertEGLImage:
- return BlitEGLImageImage(static_cast<layers::EGLImageImage*>(srcImage));
-#endif
-
#ifdef XP_MACOSX
case ConvertMacIOSurfaceImage:
return BlitMacIOSurfaceImage(srcImage->AsMacIOSurfaceImage());
@@ -983,8 +866,7 @@ GLBlitHelper::BlitFramebufferToTexture(GLuint srcFB, GLuint destTex,
GLenum destTarget,
bool internalFBs)
{
- // On the Android 4.3 emulator, IsFramebuffer may return false incorrectly.
- MOZ_ASSERT_IF(mGL->Renderer() != GLRenderer::AndroidEmulator, !srcFB || mGL->fIsFramebuffer(srcFB));
+ MOZ_ASSERT(!srcFB || mGL->fIsFramebuffer(srcFB));
MOZ_ASSERT(mGL->fIsTexture(destTex));
if (mGL->IsSupported(GLFeature::framebuffer_blit)) {
diff --git a/gfx/gl/GLBlitHelper.h b/gfx/gl/GLBlitHelper.h
index b98c472331..c2858f5913 100644
--- a/gfx/gl/GLBlitHelper.h
+++ b/gfx/gl/GLBlitHelper.h
@@ -107,11 +107,6 @@ class GLBlitHelper final
void BindAndUploadEGLImage(EGLImage image, GLuint target);
bool BlitPlanarYCbCrImage(layers::PlanarYCbCrImage* yuvImage);
-#ifdef MOZ_WIDGET_ANDROID
- // Blit onto the current FB.
- bool BlitSurfaceTextureImage(layers::SurfaceTextureImage* stImage);
- bool BlitEGLImageImage(layers::EGLImageImage* eglImage);
-#endif
#ifdef XP_MACOSX
bool BlitMacIOSurfaceImage(layers::MacIOSurfaceImage* ioImage);
#endif
diff --git a/gfx/gl/GLContext.cpp b/gfx/gl/GLContext.cpp
index e81bb980c7..72a7bea58b 100644
--- a/gfx/gl/GLContext.cpp
+++ b/gfx/gl/GLContext.cpp
@@ -10,9 +10,6 @@
#include <string.h>
#include <ctype.h>
#include <vector>
-#ifdef MOZ_WIDGET_ANDROID
-#include <sys/mman.h>
-#endif
#include "GLBlitHelper.h"
#include "GLReadTexImageHelper.h"
@@ -47,10 +44,6 @@
#include "nsCocoaFeatures.h"
#endif
-#ifdef MOZ_WIDGET_ANDROID
-#include "AndroidBridge.h"
-#endif
-
namespace mozilla {
namespace gl {
@@ -234,7 +227,7 @@ ParseGLSLVersion(GLContext* gl, uint32_t* out_version)
}
if (!versionString) {
- // This happens on the Android emulators. We'll just return 100
+ MOZ_ASSERT(false, "LOCAL_GL_SHADING_LANGUAGE_VERSION undefined, returning 100");
*out_version = 100;
return true;
}
@@ -1056,28 +1049,6 @@ GLContext::InitWithPrefixImpl(const char* prefix, bool trygl)
// prevents occasional driver crash.
mNeedsFlushBeforeDeleteFB = true;
}
-#ifdef MOZ_WIDGET_ANDROID
- if (mWorkAroundDriverBugs &&
- (Renderer() == GLRenderer::AdrenoTM305 ||
- Renderer() == GLRenderer::AdrenoTM320 ||
- Renderer() == GLRenderer::AdrenoTM330) &&
- AndroidBridge::Bridge()->GetAPIVersion() < 21) {
- // Bug 1164027. Driver crashes when functions such as
- // glTexImage2D fail due to virtual memory exhaustion.
- mTextureAllocCrashesOnMapFailure = true;
- }
-#endif
-#if MOZ_WIDGET_ANDROID
- if (mWorkAroundDriverBugs &&
- Renderer() == GLRenderer::SGX540 &&
- AndroidBridge::Bridge()->GetAPIVersion() <= 15) {
- // Bug 1288446. Driver sometimes crashes when uploading data to a
- // texture if the render target has changed since the texture was
- // rendered from. Calling glCheckFramebufferStatus after
- // glFramebufferTexture2D prevents the crash.
- mNeedsCheckAfterAttachTextureToFb = true;
- }
-#endif
mMaxTextureImageSize = mMaxTextureSize;
@@ -1810,17 +1781,6 @@ GLContext::InitExtensions()
MarkExtensionUnsupported(OES_EGL_sync);
}
-#ifdef MOZ_WIDGET_ANDROID
- if (Vendor() == GLVendor::Imagination &&
- Renderer() == GLRenderer::SGX544MP &&
- AndroidBridge::Bridge()->GetAPIVersion() < 21)
- {
- // Bug 1026404
- MarkExtensionUnsupported(OES_EGL_image);
- MarkExtensionUnsupported(OES_EGL_image_external);
- }
-#endif
-
if (Vendor() == GLVendor::ARM &&
(Renderer() == GLRenderer::Mali400MP ||
Renderer() == GLRenderer::Mali450MP))
@@ -1829,16 +1789,6 @@ GLContext::InitExtensions()
MarkExtensionUnsupported(OES_EGL_image_external);
}
- if (Renderer() == GLRenderer::AndroidEmulator) {
- // the Android emulator, which we use to run B2G reftests on,
- // doesn't expose the OES_rgb8_rgba8 extension, but it seems to
- // support it (tautologically, as it only runs on desktop GL).
- MarkExtensionSupported(OES_rgb8_rgba8);
- // there seems to be a similar issue for EXT_texture_format_BGRA8888
- // on the Android 4.3 emulator
- MarkExtensionSupported(EXT_texture_format_BGRA8888);
- }
-
if (Vendor() == GLVendor::VMware &&
Renderer() == GLRenderer::GalliumLlvmpipe)
{
@@ -2037,8 +1987,7 @@ GLContext::AttachBuffersToFB(GLuint colorTex, GLuint colorRB,
colorTex,
0);
} else if (colorRB) {
- // On the Android 4.3 emulator, IsRenderbuffer may return false incorrectly.
- MOZ_ASSERT_IF(Renderer() != GLRenderer::AndroidEmulator, fIsRenderbuffer(colorRB));
+ MOZ_ASSERT(fIsRenderbuffer(colorRB));
fFramebufferRenderbuffer(LOCAL_GL_FRAMEBUFFER,
LOCAL_GL_COLOR_ATTACHMENT0,
LOCAL_GL_RENDERBUFFER,
@@ -2046,7 +1995,7 @@ GLContext::AttachBuffersToFB(GLuint colorTex, GLuint colorRB,
}
if (depthRB) {
- MOZ_ASSERT_IF(Renderer() != GLRenderer::AndroidEmulator, fIsRenderbuffer(depthRB));
+ MOZ_ASSERT(fIsRenderbuffer(depthRB));
fFramebufferRenderbuffer(LOCAL_GL_FRAMEBUFFER,
LOCAL_GL_DEPTH_ATTACHMENT,
LOCAL_GL_RENDERBUFFER,
@@ -2054,7 +2003,7 @@ GLContext::AttachBuffersToFB(GLuint colorTex, GLuint colorRB,
}
if (stencilRB) {
- MOZ_ASSERT_IF(Renderer() != GLRenderer::AndroidEmulator, fIsRenderbuffer(stencilRB));
+ MOZ_ASSERT(fIsRenderbuffer(stencilRB));
fFramebufferRenderbuffer(LOCAL_GL_FRAMEBUFFER,
LOCAL_GL_STENCIL_ATTACHMENT,
LOCAL_GL_RENDERBUFFER,
@@ -2934,29 +2883,6 @@ GLContext::fDeleteFramebuffers(GLsizei n, const GLuint* names)
TRACKING_CONTEXT(DeletedFramebuffers(this, n, names));
}
-#ifdef MOZ_WIDGET_ANDROID
-/**
- * Conservatively estimate whether there is enough available
- * contiguous virtual address space to map a newly allocated texture.
- */
-static bool
-WillTextureMapSucceed(GLsizei width, GLsizei height, GLenum format, GLenum type)
-{
- bool willSucceed = false;
- // Some drivers leave large gaps between textures, so require
- // there to be double the actual size of the texture available.
- size_t size = width * height * GetBytesPerTexel(format, type) * 2;
-
- void *p = mmap(nullptr, size, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
- if (p != MAP_FAILED) {
- willSucceed = true;
- munmap(p, size);
- }
-
- return willSucceed;
-}
-#endif // MOZ_WIDGET_ANDROID
-
void
GLContext::fTexImage2D(GLenum target, GLint level, GLint internalformat,
GLsizei width, GLsizei height, GLint border,
@@ -2969,17 +2895,6 @@ GLContext::fTexImage2D(GLenum target, GLint level, GLint internalformat,
height = -1;
border = -1;
}
-#if MOZ_WIDGET_ANDROID
- if (mTextureAllocCrashesOnMapFailure) {
- // We have no way of knowing whether this texture already has
- // storage allocated for it, and therefore whether this check
- // is necessary. We must therefore assume it does not and
- // always perform the check.
- if (!WillTextureMapSucceed(width, height, internalformat, type)) {
- return;
- }
- }
-#endif
raw_fTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
}
diff --git a/gfx/gl/GLContext.h b/gfx/gl/GLContext.h
index f6af638972..5f0f5a4e89 100644
--- a/gfx/gl/GLContext.h
+++ b/gfx/gl/GLContext.h
@@ -788,18 +788,10 @@ private:
static void AssertNotPassingStackBufferToTheGL(const void* ptr);
-#ifdef MOZ_WIDGET_ANDROID
-// Record the name of the GL call for better hang stacks on Android.
-#define BEFORE_GL_CALL \
- PROFILER_LABEL_FUNC( \
- js::ProfileEntry::Category::GRAPHICS);\
- BeforeGLCall(MOZ_FUNCTION_NAME)
-#else
#define BEFORE_GL_CALL \
do { \
BeforeGLCall(MOZ_FUNCTION_NAME); \
} while (0)
-#endif
#define AFTER_GL_CALL \
do { \
@@ -815,12 +807,7 @@ private:
#else // ifdef MOZ_GL_DEBUG
-#ifdef MOZ_WIDGET_ANDROID
-// Record the name of the GL call for better hang stacks on Android.
-#define BEFORE_GL_CALL PROFILER_LABEL_FUNC(js::ProfileEntry::Category::GRAPHICS)
-#else
#define BEFORE_GL_CALL do { } while (0)
-#endif
#define AFTER_GL_CALL do { } while (0)
#define TRACKING_CONTEXT(a) do {} while (0)
#define ASSERT_NOT_PASSING_STACK_BUFFER_TO_GL(ptr) do {} while (0)
diff --git a/gfx/gl/GLContextProviderEGL.cpp b/gfx/gl/GLContextProviderEGL.cpp
index e39858a92e..ad515e6040 100644
--- a/gfx/gl/GLContextProviderEGL.cpp
+++ b/gfx/gl/GLContextProviderEGL.cpp
@@ -11,20 +11,7 @@
#define GET_NATIVE_WINDOW(aWidget) ((EGLNativeWindowType)aWidget->GetNativeData(NS_NATIVE_WINDOW))
#endif
-#ifdef MOZ_WIDGET_ANDROID
- #define GET_JAVA_SURFACE(aWidget) (aWidget->GetNativeData(NS_JAVA_SURFACE))
-#endif
-
#if defined(XP_UNIX)
- #ifdef MOZ_WIDGET_ANDROID
- #include <android/native_window.h>
- #include <android/native_window_jni.h>
- #endif
-
- #ifdef ANDROID
- #include <android/log.h>
- #define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Android" , ## args)
- #endif
#define GLES2_LIB "libGLESv2.so"
#define GLES2_LIB2 "libGLESv2.so.2"
@@ -164,22 +151,8 @@ CreateSurfaceForWindow(nsIWidget* widget, const EGLConfig& config) {
EGLSurface newSurface = nullptr;
MOZ_ASSERT(widget);
-#ifdef MOZ_WIDGET_ANDROID
- void* javaSurface = GET_JAVA_SURFACE(widget);
- if (!javaSurface) {
- MOZ_CRASH("GFX: Failed to get Java surface.\n");
- }
- JNIEnv* const env = jni::GetEnvForThread();
- ANativeWindow* const nativeWindow = ANativeWindow_fromSurface(
- env, reinterpret_cast<jobject>(javaSurface));
- newSurface = sEGLLibrary.fCreateWindowSurface(
- sEGLLibrary.fGetDisplay(EGL_DEFAULT_DISPLAY),
- config, nativeWindow, 0);
- ANativeWindow_release(nativeWindow);
-#else
newSurface = sEGLLibrary.fCreateWindowSurface(EGL_DISPLAY(), config,
GET_NATIVE_WINDOW(widget), 0);
-#endif
return newSurface;
}
@@ -229,11 +202,6 @@ 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
if (!OpenLibrary(GLES2_LIB)) {
#if defined(XP_UNIX)
if (!OpenLibrary(GLES2_LIB2)) {
@@ -432,10 +400,8 @@ GLContextEGL::GetWSIInfo(nsCString* const out) const
out->AppendLiteral("\nEGL_EXTENSIONS: ");
out->Append((const char*)sEGLLibrary.fQueryString(EGL_DISPLAY(), LOCAL_EGL_EXTENSIONS));
-#ifndef ANDROID // This query will crash some old android.
out->AppendLiteral("\nEGL_EXTENSIONS(nullptr): ");
out->Append((const char*)sEGLLibrary.fQueryString(nullptr, LOCAL_EGL_EXTENSIONS));
-#endif
}
// hold a reference to the given surface
@@ -685,18 +651,6 @@ CreateConfig(EGLConfig* aConfig, nsIWidget* aWidget)
{
int32_t depth = gfxPlatform::GetPlatform()->GetScreenDepth();
if (!CreateConfig(aConfig, depth, aWidget)) {
-#ifdef MOZ_WIDGET_ANDROID
- // Bug 736005
- // Android doesn't always support 16 bit so also try 24 bit
- if (depth == 16) {
- return CreateConfig(aConfig, 24, aWidget);
- }
- // Bug 970096
- // Some devices that have 24 bit screens only support 16 bit OpenGL?
- if (depth == 24) {
- return CreateConfig(aConfig, 16, aWidget);
- }
-#endif
return false;
} else {
return true;
@@ -771,43 +725,6 @@ GLContextProviderEGL::CreateForWindow(nsIWidget* aWidget, bool aForceAccelerated
return gl.forget();
}
-#if defined(ANDROID)
-EGLSurface
-GLContextProviderEGL::CreateEGLSurface(void* aWindow)
-{
- nsCString discardFailureId;
- if (!sEGLLibrary.EnsureInitialized(false, &discardFailureId)) {
- MOZ_CRASH("GFX: Failed to load EGL library 4!\n");
- }
-
- EGLConfig config;
- if (!CreateConfig(&config, static_cast<nsIWidget*>(aWindow))) {
- MOZ_CRASH("GFX: Failed to create EGLConfig 2!\n");
- }
-
- MOZ_ASSERT(aWindow);
-
- EGLSurface surface = sEGLLibrary.fCreateWindowSurface(EGL_DISPLAY(), config, aWindow,
- 0);
- if (surface == EGL_NO_SURFACE) {
- MOZ_CRASH("GFX: Failed to create EGLSurface 2!\n");
- }
-
- return surface;
-}
-
-void
-GLContextProviderEGL::DestroyEGLSurface(EGLSurface surface)
-{
- nsCString discardFailureId;
- if (!sEGLLibrary.EnsureInitialized(false, &discardFailureId)) {
- MOZ_CRASH("GFX: Failed to load EGL library 5!\n");
- }
-
- sEGLLibrary.fDestroySurface(EGL_DISPLAY(), surface);
-}
-#endif // defined(ANDROID)
-
static void
FillContextAttribs(bool alpha, bool depth, bool stencil, bool bpp16,
bool es3, nsTArray<EGLint>* out)
diff --git a/gfx/gl/GLContextProviderImpl.h b/gfx/gl/GLContextProviderImpl.h
index 7b63905e64..0a5d30eaad 100644
--- a/gfx/gl/GLContextProviderImpl.h
+++ b/gfx/gl/GLContextProviderImpl.h
@@ -10,9 +10,6 @@
#ifndef GL_CONTEXT_PROVIDER_NAME
#error GL_CONTEXT_PROVIDER_NAME not defined
#endif
-#if defined(ANDROID)
-typedef void* EGLSurface;
-#endif // defined(ANDROID)
class GL_CONTEXT_PROVIDER_NAME
{
@@ -111,11 +108,6 @@ public:
static already_AddRefed<GLContext>
CreateWrappingExisting(void* aContext, void* aSurface);
-#if defined(ANDROID)
- static EGLSurface CreateEGLSurface(void* aWindow);
- static void DestroyEGLSurface(EGLSurface surface);
-#endif // defined(ANDROID)
-
/**
* Get a pointer to the global context, creating it if it doesn't exist.
*/
diff --git a/gfx/gl/GLLibraryEGL.cpp b/gfx/gl/GLLibraryEGL.cpp
index b8b53f7c27..5b95d83b2b 100644
--- a/gfx/gl/GLLibraryEGL.cpp
+++ b/gfx/gl/GLLibraryEGL.cpp
@@ -54,46 +54,6 @@ static const char* sEGLExtensionNames[] = {
"EGL_ANGLE_platform_angle_d3d"
};
-#if defined(ANDROID)
-
-static PRLibrary* LoadApitraceLibrary()
-{
- // Initialization of gfx prefs here is only needed during the unit tests...
- gfxPrefs::GetSingleton();
- if (!gfxPrefs::UseApitrace()) {
- return nullptr;
- }
-
- static PRLibrary* sApitraceLibrary = nullptr;
-
- if (sApitraceLibrary)
- return sApitraceLibrary;
-
- nsCString logFile = Preferences::GetCString("gfx.apitrace.logfile");
-
- if (logFile.IsEmpty()) {
- logFile = "firefox.trace";
- }
-
- // The firefox process can't write to /data/local, but it can write
- // to $GRE_HOME/
- nsAutoCString logPath;
- logPath.AppendPrintf("%s/%s", getenv("GRE_HOME"), logFile.get());
-
- // 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);
-
- return sApitraceLibrary;
-}
-
-#endif // ANDROID
-
#ifdef XP_WIN
// see the comment in GLLibraryEGL::EnsureInitialized() for the rationale here.
static PRLibrary*
@@ -348,13 +308,8 @@ GLLibraryEGL::EnsureInitialized(bool forceAccel, nsACString* const out_failureId
#else // !Windows
- // On non-Windows (Android) we use system copies of libEGL. We look for
- // the APITrace lib, libEGL.so, and libEGL.so.1 in that order.
-
-#if defined(ANDROID)
- if (!mEGLLibrary)
- mEGLLibrary = LoadApitraceLibrary();
-#endif
+ // On non-Windows we use system copies of libEGL. We look for
+ // libEGL.so and libEGL.so.1 in that order.
if (!mEGLLibrary) {
printf_stderr("Attempting load of libEGL.so\n");
@@ -593,24 +548,6 @@ GLLibraryEGL::EnsureInitialized(bool forceAccel, nsACString* const out_failureId
MarkExtensionUnsupported(KHR_image_pixmap);
}
- if (IsExtensionSupported(ANDROID_native_fence_sync)) {
- GLLibraryLoader::SymLoadStruct nativeFenceSymbols[] = {
- { (PRFuncPtr*) &mSymbols.fDupNativeFenceFDANDROID, { "eglDupNativeFenceFDANDROID", nullptr } },
- { nullptr, { nullptr } }
- };
-
- bool success = GLLibraryLoader::LoadSymbols(mEGLLibrary,
- &nativeFenceSymbols[0],
- lookupFunction);
- if (!success) {
- NS_ERROR("EGL supports ANDROID_native_fence_sync without exposing its functions!");
-
- MarkExtensionUnsupported(ANDROID_native_fence_sync);
-
- mSymbols.fDupNativeFenceFDANDROID = nullptr;
- }
- }
-
mInitialized = true;
return true;
}
@@ -642,12 +579,7 @@ GLLibraryEGL::InitClientExtensions()
const char* rawExtString = nullptr;
-#ifndef ANDROID
- // Bug 1209612: Crashes on a number of android drivers.
- // Ideally we would only blocklist this there, but for now we don't need the client
- // extension list on ANDROID (we mostly need it on ANGLE), and we'd rather not crash.
rawExtString = (const char*)fQueryString(nullptr, LOCAL_EGL_EXTENSIONS);
-#endif
if (!rawExtString) {
if (shouldDumpExts) {
diff --git a/gfx/gl/GLLibraryEGL.h b/gfx/gl/GLLibraryEGL.h
index 88fce067ea..e48f2e21be 100644
--- a/gfx/gl/GLLibraryEGL.h
+++ b/gfx/gl/GLLibraryEGL.h
@@ -33,17 +33,6 @@
typedef void* EGLNativePixmapType;
typedef void* EGLNativeWindowType;
- #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
#endif
#if defined(MOZ_X11)
@@ -79,28 +68,15 @@ namespace gl {
# endif
#endif
-#ifdef MOZ_WIDGET_ANDROID
-// Record the name of the GL call for better hang stacks on Android.
-#define BEFORE_GL_CALL \
- PROFILER_LABEL_FUNC( \
- js::ProfileEntry::Category::GRAPHICS);\
- BeforeGLCall(MOZ_FUNCTION_NAME)
-#else
#define BEFORE_GL_CALL do { \
BeforeGLCall(MOZ_FUNCTION_NAME); \
} while (0)
-#endif
#define AFTER_GL_CALL do { \
AfterGLCall(MOZ_FUNCTION_NAME); \
} while (0)
-#else
-#ifdef MOZ_WIDGET_ANDROID
-// Record the name of the GL call for better hang stacks on Android.
-#define BEFORE_GL_CALL PROFILER_LABEL_FUNC(js::ProfileEntry::Category::GRAPHICS)
-#else
+#else // !DEBUG
#define BEFORE_GL_CALL
-#endif
#define AFTER_GL_CALL
#endif
diff --git a/gfx/gl/moz.build b/gfx/gl/moz.build
index 4922932140..d5287ca595 100644
--- a/gfx/gl/moz.build
+++ b/gfx/gl/moz.build
@@ -16,8 +16,6 @@ elif 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
gl_provider = 'EGL'
else:
gl_provider = 'GLX'
-elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
- gl_provider = 'EGL'
if CONFIG['MOZ_GL_PROVIDER']:
gl_provider = CONFIG['MOZ_GL_PROVIDER']