summaryrefslogtreecommitdiffstats
path: root/gfx/gl
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/gl')
-rw-r--r--gfx/gl/GLContext.h2
-rw-r--r--gfx/gl/GLContextCGL.h2
-rw-r--r--gfx/gl/GLContextEAGL.h2
-rw-r--r--gfx/gl/GLContextEGL.h2
-rw-r--r--gfx/gl/GLContextGLX.h2
-rw-r--r--gfx/gl/GLContextProviderCGL.mm5
-rw-r--r--gfx/gl/GLContextProviderEAGL.mm5
-rw-r--r--gfx/gl/GLContextProviderEGL.cpp18
-rw-r--r--gfx/gl/GLContextProviderGLX.cpp22
-rw-r--r--gfx/gl/GLContextProviderWGL.cpp7
-rw-r--r--gfx/gl/GLContextWGL.h2
-rw-r--r--gfx/gl/GLLibraryEGL.cpp15
-rw-r--r--gfx/gl/GLTextureImage.cpp3
-rw-r--r--gfx/gl/GLUploadHelpers.cpp31
-rw-r--r--gfx/gl/GLUploadHelpers.h2
-rw-r--r--gfx/gl/TextureImageEGL.cpp4
16 files changed, 69 insertions, 55 deletions
diff --git a/gfx/gl/GLContext.h b/gfx/gl/GLContext.h
index f20563070..c82efceda 100644
--- a/gfx/gl/GLContext.h
+++ b/gfx/gl/GLContext.h
@@ -221,6 +221,8 @@ public:
return false;
}
+ virtual void GetWSIInfo(nsCString* const out) const = 0;
+
/**
* Return true if we are running on a OpenGL core profile context
*/
diff --git a/gfx/gl/GLContextCGL.h b/gfx/gl/GLContextCGL.h
index 12da90aee..1a29f3d15 100644
--- a/gfx/gl/GLContextCGL.h
+++ b/gfx/gl/GLContextCGL.h
@@ -58,6 +58,8 @@ public:
virtual bool SupportsRobustness() const override { return false; }
virtual bool SwapBuffers() override;
+
+ virtual void GetWSIInfo(nsCString* const out) const override;
};
} // namespace gl
diff --git a/gfx/gl/GLContextEAGL.h b/gfx/gl/GLContextEAGL.h
index 86e9a5b98..df25d0f1e 100644
--- a/gfx/gl/GLContextEAGL.h
+++ b/gfx/gl/GLContextEAGL.h
@@ -55,6 +55,8 @@ public:
virtual bool SwapBuffers() override;
+ virtual void GetWSIInfo(nsCString* const out) const override;
+
virtual GLuint GetDefaultFramebuffer() override {
return mBackbufferFB;
}
diff --git a/gfx/gl/GLContextEGL.h b/gfx/gl/GLContextEGL.h
index 9755ecfe7..64b9b13fb 100644
--- a/gfx/gl/GLContextEGL.h
+++ b/gfx/gl/GLContextEGL.h
@@ -89,6 +89,8 @@ public:
virtual bool SwapBuffers() override;
+ virtual void GetWSIInfo(nsCString* const out) const override;
+
// hold a reference to the given surface
// for the lifetime of this context.
void HoldSurface(gfxASurface* aSurf);
diff --git a/gfx/gl/GLContextGLX.h b/gfx/gl/GLContextGLX.h
index ca476baec..1f2cee08d 100644
--- a/gfx/gl/GLContextGLX.h
+++ b/gfx/gl/GLContextGLX.h
@@ -59,6 +59,8 @@ public:
virtual bool SwapBuffers() override;
+ virtual void GetWSIInfo(nsCString* const out) const override;
+
// Overrides the current GLXDrawable backing the context and makes the
// context current.
bool OverrideDrawable(GLXDrawable drawable);
diff --git a/gfx/gl/GLContextProviderCGL.mm b/gfx/gl/GLContextProviderCGL.mm
index 0b8add435..ceab3046c 100644
--- a/gfx/gl/GLContextProviderCGL.mm
+++ b/gfx/gl/GLContextProviderCGL.mm
@@ -166,6 +166,11 @@ GLContextCGL::SwapBuffers()
return true;
}
+void
+GLContextCGL::GetWSIInfo(nsCString* const out) const
+{
+ out->AppendLiteral("CGL");
+}
already_AddRefed<GLContext>
GLContextProviderCGL::CreateWrappingExisting(void*, void*)
diff --git a/gfx/gl/GLContextProviderEAGL.mm b/gfx/gl/GLContextProviderEAGL.mm
index 784a3e29e..507616e2f 100644
--- a/gfx/gl/GLContextProviderEAGL.mm
+++ b/gfx/gl/GLContextProviderEAGL.mm
@@ -155,6 +155,11 @@ GLContextEAGL::SwapBuffers()
return true;
}
+void
+GLContextEAGL::GetWSIInfo(nsCString* const out) const
+{
+ out->AppendLiteral("EAGL");
+}
already_AddRefed<GLContext>
GLContextProviderEAGL::CreateWrappingExisting(void*, void*)
diff --git a/gfx/gl/GLContextProviderEGL.cpp b/gfx/gl/GLContextProviderEGL.cpp
index 098662200..7979f3bf0 100644
--- a/gfx/gl/GLContextProviderEGL.cpp
+++ b/gfx/gl/GLContextProviderEGL.cpp
@@ -418,6 +418,24 @@ GLContextEGL::SwapBuffers()
}
}
+void
+GLContextEGL::GetWSIInfo(nsCString* const out) const
+{
+ out->AppendLiteral("EGL_VENDOR: ");
+ out->Append((const char*)sEGLLibrary.fQueryString(EGL_DISPLAY(), LOCAL_EGL_VENDOR));
+
+ out->AppendLiteral("\nEGL_VERSION: ");
+ out->Append((const char*)sEGLLibrary.fQueryString(EGL_DISPLAY(), LOCAL_EGL_VERSION));
+
+ 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
// for the lifetime of this context.
void
diff --git a/gfx/gl/GLContextProviderGLX.cpp b/gfx/gl/GLContextProviderGLX.cpp
index d804f95af..539520a8c 100644
--- a/gfx/gl/GLContextProviderGLX.cpp
+++ b/gfx/gl/GLContextProviderGLX.cpp
@@ -80,7 +80,6 @@ GLXLibrary::EnsureInitialized()
if (!mOGLLibrary) {
const char* libGLfilename = nullptr;
- bool forceFeatureReport = false;
// see e.g. bug 608526: it is intrinsically interesting to know whether we have dynamically linked to libGL.so.1
// because at least the NVIDIA implementation requires an executable stack, which causes mprotect calls,
@@ -994,6 +993,27 @@ GLContextGLX::SwapBuffers()
return true;
}
+void
+GLContextGLX::GetWSIInfo(nsCString* const out) const
+{
+ Display* display = DefaultXDisplay();
+ int screen = DefaultScreen(display);
+
+ int majorVersion, minorVersion;
+ sGLXLibrary.xQueryVersion(display, &majorVersion, &minorVersion);
+
+ out->Append(nsPrintfCString("GLX %u.%u", majorVersion, minorVersion));
+
+ out->AppendLiteral("\nGLX_VENDOR(client): ");
+ out->Append(sGLXLibrary.xGetClientString(display, LOCAL_GLX_VENDOR));
+
+ out->AppendLiteral("\nGLX_VENDOR(server): ");
+ out->Append(sGLXLibrary.xQueryServerString(display, screen, LOCAL_GLX_VENDOR));
+
+ out->AppendLiteral("\nExtensions: ");
+ out->Append(sGLXLibrary.xQueryExtensionsString(display, screen));
+}
+
bool
GLContextGLX::OverrideDrawable(GLXDrawable drawable)
{
diff --git a/gfx/gl/GLContextProviderWGL.cpp b/gfx/gl/GLContextProviderWGL.cpp
index c9c3f0a54..35957259d 100644
--- a/gfx/gl/GLContextProviderWGL.cpp
+++ b/gfx/gl/GLContextProviderWGL.cpp
@@ -373,6 +373,13 @@ GLContextWGL::SwapBuffers() {
return ::SwapBuffers(mDC);
}
+void
+GLContextWGL::GetWSIInfo(nsCString* const out) const
+{
+ out->AppendLiteral("wglGetExtensionsString: ");
+ out->Append(sWGLLib.fGetExtensionsString(mDC));
+}
+
bool
GLContextWGL::SetupLookupFunction()
{
diff --git a/gfx/gl/GLContextWGL.h b/gfx/gl/GLContextWGL.h
index 9d270bf52..839b10aa7 100644
--- a/gfx/gl/GLContextWGL.h
+++ b/gfx/gl/GLContextWGL.h
@@ -57,6 +57,8 @@ public:
virtual bool SwapBuffers() override;
+ virtual void GetWSIInfo(nsCString* const out) const override;
+
virtual bool SetupLookupFunction() override;
HGLRC Context() { return mContext; }
diff --git a/gfx/gl/GLLibraryEGL.cpp b/gfx/gl/GLLibraryEGL.cpp
index 3d8da3085..75f40f13f 100644
--- a/gfx/gl/GLLibraryEGL.cpp
+++ b/gfx/gl/GLLibraryEGL.cpp
@@ -9,7 +9,6 @@
#include "gfxUtils.h"
#include "mozilla/Preferences.h"
#include "mozilla/Assertions.h"
-#include "mozilla/Telemetry.h"
#include "mozilla/Tokenizer.h"
#include "mozilla/ScopeExit.h"
#include "mozilla/Unused.h"
@@ -472,20 +471,6 @@ GLLibraryEGL::EnsureInitialized(bool forceAccel, nsACString* const out_failureId
chosenDisplay = GetAndInitDisplayForAccelANGLE(*this, out_failureId);
}
- // Report the acceleration status to telemetry
- if (!chosenDisplay) {
- if (accelAngleFailureId.IsEmpty()) {
- Telemetry::Accumulate(Telemetry::CANVAS_WEBGL_ACCL_FAILURE_ID,
- NS_LITERAL_CSTRING("FEATURE_FAILURE_ACCL_ANGLE_UNKNOWN"));
- } else {
- Telemetry::Accumulate(Telemetry::CANVAS_WEBGL_ACCL_FAILURE_ID,
- accelAngleFailureId);
- }
- } else {
- Telemetry::Accumulate(Telemetry::CANVAS_WEBGL_ACCL_FAILURE_ID,
- NS_LITERAL_CSTRING("SUCCESS"));
- }
-
// Fallback to a WARP display if ANGLE fails, or if WARP is forced
if (!chosenDisplay && shouldTryWARP) {
chosenDisplay = GetAndInitWARPDisplay(*this, EGL_DEFAULT_DISPLAY);
diff --git a/gfx/gl/GLTextureImage.cpp b/gfx/gl/GLTextureImage.cpp
index 65678432d..c91d558af 100644
--- a/gfx/gl/GLTextureImage.cpp
+++ b/gfx/gl/GLTextureImage.cpp
@@ -149,9 +149,6 @@ BasicTextureImage::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion
&uploadSize,
needInit,
aFrom);
- if (mTextureFormat == SurfaceFormat::UNKNOWN) {
- return false;
- }
if (uploadSize > 0) {
UpdateUploadSize(uploadSize);
diff --git a/gfx/gl/GLUploadHelpers.cpp b/gfx/gl/GLUploadHelpers.cpp
index ca1c890a4..75165eedf 100644
--- a/gfx/gl/GLUploadHelpers.cpp
+++ b/gfx/gl/GLUploadHelpers.cpp
@@ -27,23 +27,6 @@ DataOffset(const IntPoint& aPoint, int32_t aStride, SurfaceFormat aFormat)
return data;
}
-static bool
-CheckUploadBounds(const IntSize& aDst, const IntSize& aSrc, const IntPoint& aOffset)
-{
- if (aOffset.x < 0 || aOffset.y < 0 ||
- aOffset.x >= aSrc.width ||
- aOffset.y >= aSrc.height) {
- MOZ_ASSERT_UNREACHABLE("Offset outside source bounds");
- return false;
- }
- if (aDst.width > (aSrc.width - aOffset.x) ||
- aDst.height > (aSrc.height - aOffset.y)) {
- MOZ_ASSERT_UNREACHABLE("Source has insufficient data");
- return false;
- }
- return true;
-}
-
static GLint GetAddressAlignment(ptrdiff_t aAddress)
{
if (!(aAddress & 0x7)) {
@@ -392,7 +375,6 @@ TexImage2DHelper(GLContext* gl,
SurfaceFormat
UploadImageDataToTexture(GLContext* gl,
unsigned char* aData,
- const gfx::IntSize& aDataSize,
int32_t aStride,
SurfaceFormat aFormat,
const nsIntRegion& aDstRegion,
@@ -516,10 +498,6 @@ UploadImageDataToTexture(GLContext* gl,
// Upload each rect in the region to the texture
for (auto iter = aDstRegion.RectIter(); !iter.Done(); iter.Next()) {
const IntRect& rect = iter.Get();
- if (!CheckUploadBounds(rect.Size(), aDataSize, rect.TopLeft())) {
- return SurfaceFormat::UNKNOWN;
- }
-
const unsigned char* rectData =
aData + DataOffset(rect.TopLeft(), aStride, aFormat);
@@ -556,17 +534,10 @@ UploadSurfaceToTexture(GLContext* gl,
int32_t stride = aSurface->Stride();
SurfaceFormat format = aSurface->GetFormat();
- gfx::IntSize size = aSurface->GetSize();
- if (!CheckUploadBounds(aSize, size, aSrcPoint)) {
- return SurfaceFormat::UNKNOWN;
- }
-
unsigned char* data = aSurface->GetData() +
DataOffset(aSrcPoint, stride, format);
- size.width -= aSrcPoint.x;
- size.height -= aSrcPoint.y;
- return UploadImageDataToTexture(gl, data, size, stride, format,
+ return UploadImageDataToTexture(gl, data, stride, format,
aDstRegion, aTexture, aSize,
aOutUploadSize, aNeedInit,
aTextureUnit, aTextureTarget);
diff --git a/gfx/gl/GLUploadHelpers.h b/gfx/gl/GLUploadHelpers.h
index f732d2b38..866d44adb 100644
--- a/gfx/gl/GLUploadHelpers.h
+++ b/gfx/gl/GLUploadHelpers.h
@@ -28,7 +28,6 @@ class GLContext;
* \param gl The GL Context to use.
* \param aData Start of image data of surface to upload.
* Corresponds to the first pixel of the texture.
- * \param aDataSize The image data's size.
* \param aStride The image data's stride.
* \param aFormat The image data's format.
* \param aDstRegion Region of the texture to upload.
@@ -47,7 +46,6 @@ class GLContext;
gfx::SurfaceFormat
UploadImageDataToTexture(GLContext* gl,
unsigned char* aData,
- const gfx::IntSize& aDataSize,
int32_t aStride,
gfx::SurfaceFormat aFormat,
const nsIntRegion& aDstRegion,
diff --git a/gfx/gl/TextureImageEGL.cpp b/gfx/gl/TextureImageEGL.cpp
index 3bb2987d1..87a547c26 100644
--- a/gfx/gl/TextureImageEGL.cpp
+++ b/gfx/gl/TextureImageEGL.cpp
@@ -119,10 +119,6 @@ TextureImageEGL::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion&
&uploadSize,
needInit,
aFrom);
- if (mTextureFormat == SurfaceFormat::UNKNOWN) {
- return false;
- }
-
if (uploadSize > 0) {
UpdateUploadSize(uploadSize);
}