summaryrefslogtreecommitdiff
path: root/gfx/gl/GLContext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/gl/GLContext.cpp')
-rw-r--r--gfx/gl/GLContext.cpp93
1 files changed, 4 insertions, 89 deletions
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);
}