2012-03-17 02:24:12 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "GLLibraryEGL.h"
|
|
|
|
|
|
|
|
#include "gfxCrashReporterUtils.h"
|
|
|
|
#include "mozilla/Preferences.h"
|
2012-05-15 22:55:50 +04:00
|
|
|
#include "nsDirectoryServiceDefs.h"
|
2012-07-07 08:44:48 +04:00
|
|
|
#include "nsDirectoryServiceUtils.h"
|
|
|
|
#include "nsPrintfCString.h"
|
2012-07-17 19:26:12 +04:00
|
|
|
#include "prenv.h"
|
2013-02-14 03:26:24 +04:00
|
|
|
#include "GLContext.h"
|
2014-02-28 21:59:38 +04:00
|
|
|
#include "gfxPrefs.h"
|
2012-03-17 02:24:12 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace gl {
|
|
|
|
|
2013-10-11 17:16:44 +04:00
|
|
|
GLLibraryEGL sEGLLibrary;
|
|
|
|
|
2012-06-13 01:39:18 +04:00
|
|
|
// should match the order of EGLExtensions, and be null-terminated.
|
2013-11-20 01:54:09 +04:00
|
|
|
static const char *sEGLExtensionNames[] = {
|
2012-06-13 01:39:18 +04:00
|
|
|
"EGL_KHR_image_base",
|
|
|
|
"EGL_KHR_image_pixmap",
|
|
|
|
"EGL_KHR_gl_texture_2D_image",
|
|
|
|
"EGL_KHR_lock_surface",
|
|
|
|
"EGL_ANGLE_surface_d3d_texture_2d_share_handle",
|
|
|
|
"EGL_EXT_create_context_robustness",
|
|
|
|
"EGL_KHR_image",
|
2012-06-13 01:39:43 +04:00
|
|
|
"EGL_KHR_fence_sync",
|
2012-07-30 18:20:58 +04:00
|
|
|
nullptr
|
2012-06-13 01:39:18 +04:00
|
|
|
};
|
|
|
|
|
2012-05-15 22:55:50 +04:00
|
|
|
#if defined(ANDROID)
|
|
|
|
|
2012-03-17 02:24:12 +04:00
|
|
|
static PRLibrary* LoadApitraceLibrary()
|
|
|
|
{
|
2014-02-28 21:59:38 +04:00
|
|
|
if (!gfxPrefs::UseApitrace()) {
|
2013-07-30 22:54:29 +04:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2013-07-20 12:48:55 +04:00
|
|
|
static PRLibrary* sApitraceLibrary = nullptr;
|
2012-03-17 02:24:12 +04:00
|
|
|
|
|
|
|
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/
|
2012-09-02 06:35:17 +04:00
|
|
|
nsAutoCString logPath;
|
2012-03-17 02:24:12 +04:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2012-05-15 22:55:50 +04:00
|
|
|
#endif // ANDROID
|
|
|
|
|
2012-07-07 08:44:48 +04:00
|
|
|
#ifdef XP_WIN
|
|
|
|
// see the comment in GLLibraryEGL::EnsureInitialized() for the rationale here.
|
|
|
|
static PRLibrary*
|
|
|
|
LoadLibraryForEGLOnWindows(const nsAString& filename)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIFile> file;
|
|
|
|
nsresult rv = NS_GetSpecialDirectory(NS_GRE_DIR, getter_AddRefs(file));
|
|
|
|
if (NS_FAILED(rv))
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2012-07-07 08:44:48 +04:00
|
|
|
|
|
|
|
file->Append(filename);
|
2012-07-30 18:20:58 +04:00
|
|
|
PRLibrary* lib = nullptr;
|
2012-07-07 08:44:48 +04:00
|
|
|
rv = file->Load(&lib);
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
nsPrintfCString msg("Failed to load %s - Expect EGL initialization to fail",
|
|
|
|
NS_LossyConvertUTF16toASCII(filename).get());
|
|
|
|
NS_WARNING(msg.get());
|
|
|
|
}
|
|
|
|
return lib;
|
|
|
|
}
|
|
|
|
#endif // XP_WIN
|
|
|
|
|
2012-03-17 02:24:12 +04:00
|
|
|
bool
|
|
|
|
GLLibraryEGL::EnsureInitialized()
|
|
|
|
{
|
|
|
|
if (mInitialized) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ScopedGfxFeatureReporter reporter("EGL");
|
|
|
|
|
|
|
|
#ifdef XP_WIN
|
2012-07-11 06:32:59 +04:00
|
|
|
#ifdef MOZ_WEBGL
|
2012-03-17 02:24:12 +04:00
|
|
|
if (!mEGLLibrary) {
|
2012-07-07 08:44:48 +04:00
|
|
|
// On Windows, the GLESv2, EGL and DXSDK libraries are shipped with libxul and
|
2012-05-15 22:55:50 +04:00
|
|
|
// we should look for them there. We have to load the libs in this
|
2012-07-07 08:44:48 +04:00
|
|
|
// order, because libEGL.dll depends on libGLESv2.dll which depends on the DXSDK
|
|
|
|
// libraries. This matters especially for WebRT apps which are in a different directory.
|
|
|
|
// See bug 760323 and bug 749459
|
2012-05-15 22:55:50 +04:00
|
|
|
|
2012-07-07 08:44:48 +04:00
|
|
|
#ifndef MOZ_D3DCOMPILER_DLL
|
|
|
|
#error MOZ_D3DCOMPILER_DLL should have been defined by the Makefile
|
|
|
|
#endif
|
|
|
|
LoadLibraryForEGLOnWindows(NS_LITERAL_STRING(NS_STRINGIFY(MOZ_D3DCOMPILER_DLL)));
|
|
|
|
// intentionally leak the D3DCOMPILER_DLL library
|
2012-05-15 22:55:50 +04:00
|
|
|
|
2012-07-07 08:44:48 +04:00
|
|
|
LoadLibraryForEGLOnWindows(NS_LITERAL_STRING("libGLESv2.dll"));
|
|
|
|
// intentionally leak the libGLESv2.dll library
|
2012-05-15 22:55:50 +04:00
|
|
|
|
2012-07-07 08:44:48 +04:00
|
|
|
mEGLLibrary = LoadLibraryForEGLOnWindows(NS_LITERAL_STRING("libEGL.dll"));
|
2012-05-15 22:55:50 +04:00
|
|
|
|
2012-07-07 08:44:48 +04:00
|
|
|
if (!mEGLLibrary)
|
2012-05-15 22:55:50 +04:00
|
|
|
return false;
|
|
|
|
}
|
2012-07-11 06:32:59 +04:00
|
|
|
#endif // MOZ_WEBGL
|
2012-05-15 22:55:50 +04:00
|
|
|
#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)
|
2012-03-17 02:24:12 +04:00
|
|
|
mEGLLibrary = LoadApitraceLibrary();
|
2012-05-15 22:55:50 +04:00
|
|
|
#endif
|
2012-03-17 02:24:12 +04:00
|
|
|
|
2012-05-15 22:55:50 +04:00
|
|
|
if (!mEGLLibrary) {
|
|
|
|
printf_stderr("Attempting load of libEGL.so\n");
|
|
|
|
mEGLLibrary = PR_LoadLibrary("libEGL.so");
|
|
|
|
}
|
2012-03-17 02:24:12 +04:00
|
|
|
#if defined(XP_UNIX)
|
2012-05-15 22:55:50 +04:00
|
|
|
if (!mEGLLibrary) {
|
|
|
|
mEGLLibrary = PR_LoadLibrary("libEGL.so.1");
|
2012-03-17 02:24:12 +04:00
|
|
|
}
|
2012-05-15 22:55:50 +04:00
|
|
|
#endif
|
2012-03-17 02:24:12 +04:00
|
|
|
|
|
|
|
if (!mEGLLibrary) {
|
|
|
|
NS_WARNING("Couldn't load EGL LIB.");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-05-15 22:55:50 +04:00
|
|
|
#endif // !Windows
|
|
|
|
|
2012-03-17 02:24:12 +04:00
|
|
|
#define SYMBOL(name) \
|
2013-07-20 12:48:55 +04:00
|
|
|
{ (PRFuncPtr*) &mSymbols.f##name, { "egl" #name, nullptr } }
|
2012-03-17 02:24:12 +04:00
|
|
|
|
|
|
|
GLLibraryLoader::SymLoadStruct earlySymbols[] = {
|
|
|
|
SYMBOL(GetDisplay),
|
|
|
|
SYMBOL(GetCurrentSurface),
|
|
|
|
SYMBOL(GetCurrentContext),
|
|
|
|
SYMBOL(MakeCurrent),
|
|
|
|
SYMBOL(DestroyContext),
|
|
|
|
SYMBOL(CreateContext),
|
|
|
|
SYMBOL(DestroySurface),
|
|
|
|
SYMBOL(CreateWindowSurface),
|
|
|
|
SYMBOL(CreatePbufferSurface),
|
|
|
|
SYMBOL(CreatePixmapSurface),
|
|
|
|
SYMBOL(BindAPI),
|
|
|
|
SYMBOL(Initialize),
|
|
|
|
SYMBOL(ChooseConfig),
|
|
|
|
SYMBOL(GetError),
|
|
|
|
SYMBOL(GetConfigs),
|
|
|
|
SYMBOL(GetConfigAttrib),
|
|
|
|
SYMBOL(WaitNative),
|
|
|
|
SYMBOL(GetProcAddress),
|
|
|
|
SYMBOL(SwapBuffers),
|
|
|
|
SYMBOL(CopyBuffers),
|
|
|
|
SYMBOL(QueryString),
|
|
|
|
SYMBOL(QueryContext),
|
|
|
|
SYMBOL(BindTexImage),
|
|
|
|
SYMBOL(ReleaseTexImage),
|
|
|
|
SYMBOL(QuerySurface),
|
2013-07-20 12:48:55 +04:00
|
|
|
{ nullptr, { nullptr } }
|
2012-03-17 02:24:12 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
if (!GLLibraryLoader::LoadSymbols(mEGLLibrary, &earlySymbols[0])) {
|
|
|
|
NS_WARNING("Couldn't find required entry points in EGL library (early init)");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
mEGLDisplay = fGetDisplay(EGL_DEFAULT_DISPLAY);
|
2013-07-20 12:48:55 +04:00
|
|
|
if (!fInitialize(mEGLDisplay, nullptr, nullptr))
|
2012-03-17 02:24:12 +04:00
|
|
|
return false;
|
|
|
|
|
|
|
|
const char *vendor = (const char*) fQueryString(mEGLDisplay, LOCAL_EGL_VENDOR);
|
|
|
|
if (vendor && (strstr(vendor, "TransGaming") != 0 || strstr(vendor, "Google Inc.") != 0)) {
|
|
|
|
mIsANGLE = true;
|
|
|
|
}
|
|
|
|
|
2012-06-13 01:39:18 +04:00
|
|
|
InitExtensions();
|
2012-03-17 02:24:12 +04:00
|
|
|
|
2012-06-13 01:39:18 +04:00
|
|
|
GLLibraryLoader::PlatformLookupFunction lookupFunction =
|
|
|
|
(GLLibraryLoader::PlatformLookupFunction)mSymbols.fGetProcAddress;
|
2012-03-17 02:24:12 +04:00
|
|
|
|
2012-06-13 01:39:18 +04:00
|
|
|
if (IsExtensionSupported(KHR_lock_surface)) {
|
2012-03-17 02:24:12 +04:00
|
|
|
GLLibraryLoader::SymLoadStruct lockSymbols[] = {
|
2012-07-30 18:20:58 +04:00
|
|
|
{ (PRFuncPtr*) &mSymbols.fLockSurface, { "eglLockSurfaceKHR", nullptr } },
|
|
|
|
{ (PRFuncPtr*) &mSymbols.fUnlockSurface, { "eglUnlockSurfaceKHR", nullptr } },
|
|
|
|
{ nullptr, { nullptr } }
|
2012-03-17 02:24:12 +04:00
|
|
|
};
|
|
|
|
|
2012-06-13 01:39:18 +04:00
|
|
|
bool success = GLLibraryLoader::LoadSymbols(mEGLLibrary,
|
|
|
|
&lockSymbols[0],
|
|
|
|
lookupFunction);
|
|
|
|
if (!success) {
|
|
|
|
NS_ERROR("EGL supports KHR_lock_surface without exposing its functions!");
|
2012-03-17 02:24:12 +04:00
|
|
|
|
2012-06-13 01:39:18 +04:00
|
|
|
MarkExtensionUnsupported(KHR_lock_surface);
|
|
|
|
|
2012-07-30 18:20:58 +04:00
|
|
|
mSymbols.fLockSurface = nullptr;
|
|
|
|
mSymbols.fUnlockSurface = nullptr;
|
2012-06-13 01:39:18 +04:00
|
|
|
}
|
2012-03-17 02:24:12 +04:00
|
|
|
}
|
|
|
|
|
2012-06-13 01:39:18 +04:00
|
|
|
if (IsExtensionSupported(ANGLE_surface_d3d_texture_2d_share_handle)) {
|
2012-03-17 02:24:12 +04:00
|
|
|
GLLibraryLoader::SymLoadStruct d3dSymbols[] = {
|
2012-07-30 18:20:58 +04:00
|
|
|
{ (PRFuncPtr*) &mSymbols.fQuerySurfacePointerANGLE, { "eglQuerySurfacePointerANGLE", nullptr } },
|
|
|
|
{ nullptr, { nullptr } }
|
2012-03-17 02:24:12 +04:00
|
|
|
};
|
|
|
|
|
2012-06-13 01:39:18 +04:00
|
|
|
bool success = GLLibraryLoader::LoadSymbols(mEGLLibrary,
|
|
|
|
&d3dSymbols[0],
|
|
|
|
lookupFunction);
|
|
|
|
if (!success) {
|
|
|
|
NS_ERROR("EGL supports ANGLE_surface_d3d_texture_2d_share_handle without exposing its functions!");
|
2012-03-17 02:24:12 +04:00
|
|
|
|
2012-06-13 01:39:18 +04:00
|
|
|
MarkExtensionUnsupported(ANGLE_surface_d3d_texture_2d_share_handle);
|
|
|
|
|
2012-07-30 18:20:58 +04:00
|
|
|
mSymbols.fQuerySurfacePointerANGLE = nullptr;
|
2012-06-13 01:39:18 +04:00
|
|
|
}
|
2012-03-17 02:24:12 +04:00
|
|
|
}
|
|
|
|
|
2012-06-13 01:39:43 +04:00
|
|
|
if (IsExtensionSupported(KHR_fence_sync)) {
|
|
|
|
GLLibraryLoader::SymLoadStruct syncSymbols[] = {
|
2012-07-30 18:20:58 +04:00
|
|
|
{ (PRFuncPtr*) &mSymbols.fCreateSync, { "eglCreateSyncKHR", nullptr } },
|
|
|
|
{ (PRFuncPtr*) &mSymbols.fDestroySync, { "eglDestroySyncKHR", nullptr } },
|
|
|
|
{ (PRFuncPtr*) &mSymbols.fClientWaitSync, { "eglClientWaitSyncKHR", nullptr } },
|
|
|
|
{ (PRFuncPtr*) &mSymbols.fGetSyncAttrib, { "eglGetSyncAttribKHR", nullptr } },
|
|
|
|
{ nullptr, { nullptr } }
|
2012-06-13 01:39:43 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
bool success = GLLibraryLoader::LoadSymbols(mEGLLibrary,
|
|
|
|
&syncSymbols[0],
|
|
|
|
lookupFunction);
|
|
|
|
if (!success) {
|
|
|
|
NS_ERROR("EGL supports KHR_fence_sync without exposing its functions!");
|
|
|
|
|
|
|
|
MarkExtensionUnsupported(KHR_fence_sync);
|
|
|
|
|
2012-07-30 18:20:58 +04:00
|
|
|
mSymbols.fCreateSync = nullptr;
|
|
|
|
mSymbols.fDestroySync = nullptr;
|
|
|
|
mSymbols.fClientWaitSync = nullptr;
|
|
|
|
mSymbols.fGetSyncAttrib = nullptr;
|
2012-06-13 01:39:43 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-14 03:26:24 +04:00
|
|
|
if (IsExtensionSupported(KHR_image) || IsExtensionSupported(KHR_image_base)) {
|
|
|
|
GLLibraryLoader::SymLoadStruct imageSymbols[] = {
|
|
|
|
{ (PRFuncPtr*) &mSymbols.fCreateImage, { "eglCreateImageKHR", nullptr } },
|
|
|
|
{ (PRFuncPtr*) &mSymbols.fDestroyImage, { "eglDestroyImageKHR", nullptr } },
|
|
|
|
{ nullptr, { nullptr } }
|
|
|
|
};
|
|
|
|
|
|
|
|
bool success = GLLibraryLoader::LoadSymbols(mEGLLibrary,
|
|
|
|
&imageSymbols[0],
|
|
|
|
lookupFunction);
|
|
|
|
if (!success) {
|
|
|
|
NS_ERROR("EGL supports KHR_image(_base) without exposing its functions!");
|
|
|
|
|
|
|
|
MarkExtensionUnsupported(KHR_image);
|
|
|
|
MarkExtensionUnsupported(KHR_image_base);
|
|
|
|
MarkExtensionUnsupported(KHR_image_pixmap);
|
|
|
|
|
|
|
|
mSymbols.fCreateImage = nullptr;
|
|
|
|
mSymbols.fDestroyImage = nullptr;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
MarkExtensionUnsupported(KHR_image_pixmap);
|
|
|
|
}
|
|
|
|
|
2012-03-17 02:24:12 +04:00
|
|
|
mInitialized = true;
|
|
|
|
reporter.SetSuccessful();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-06-13 01:39:18 +04:00
|
|
|
void
|
|
|
|
GLLibraryEGL::InitExtensions()
|
|
|
|
{
|
|
|
|
const char *extensions = (const char*)fQueryString(mEGLDisplay, LOCAL_EGL_EXTENSIONS);
|
|
|
|
|
|
|
|
if (!extensions) {
|
|
|
|
NS_WARNING("Failed to load EGL extension list!");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-07-17 19:26:12 +04:00
|
|
|
bool debugMode = false;
|
2012-06-13 01:39:18 +04:00
|
|
|
#ifdef DEBUG
|
2012-07-17 19:26:12 +04:00
|
|
|
if (PR_GetEnv("MOZ_GL_DEBUG"))
|
|
|
|
debugMode = true;
|
|
|
|
|
|
|
|
static bool firstRun = true;
|
2012-06-13 01:39:18 +04:00
|
|
|
#else
|
|
|
|
// Non-DEBUG, so never spew.
|
2012-07-17 19:26:12 +04:00
|
|
|
const bool firstRun = false;
|
2012-06-13 01:39:18 +04:00
|
|
|
#endif
|
|
|
|
|
2013-11-20 01:54:09 +04:00
|
|
|
GLContext::InitializeExtensionsBitSet(mAvailableExtensions, extensions, sEGLExtensionNames, firstRun && debugMode);
|
2012-06-13 01:39:18 +04:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
2012-07-17 19:26:12 +04:00
|
|
|
firstRun = false;
|
2012-06-13 01:39:18 +04:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2012-03-17 02:24:12 +04:00
|
|
|
void
|
|
|
|
GLLibraryEGL::DumpEGLConfig(EGLConfig cfg)
|
|
|
|
{
|
|
|
|
int attrval;
|
|
|
|
int err;
|
|
|
|
|
|
|
|
#define ATTR(_x) do { \
|
|
|
|
fGetConfigAttrib(mEGLDisplay, cfg, LOCAL_EGL_##_x, &attrval); \
|
|
|
|
if ((err = fGetError()) != 0x3000) { \
|
|
|
|
printf_stderr(" %s: ERROR (0x%04x)\n", #_x, err); \
|
|
|
|
} else { \
|
|
|
|
printf_stderr(" %s: %d (0x%04x)\n", #_x, attrval, attrval); \
|
|
|
|
} \
|
|
|
|
} while(0)
|
|
|
|
|
|
|
|
printf_stderr("EGL Config: %d [%p]\n", (int)(intptr_t)cfg, cfg);
|
|
|
|
|
|
|
|
ATTR(BUFFER_SIZE);
|
|
|
|
ATTR(ALPHA_SIZE);
|
|
|
|
ATTR(BLUE_SIZE);
|
|
|
|
ATTR(GREEN_SIZE);
|
|
|
|
ATTR(RED_SIZE);
|
|
|
|
ATTR(DEPTH_SIZE);
|
|
|
|
ATTR(STENCIL_SIZE);
|
|
|
|
ATTR(CONFIG_CAVEAT);
|
|
|
|
ATTR(CONFIG_ID);
|
|
|
|
ATTR(LEVEL);
|
|
|
|
ATTR(MAX_PBUFFER_HEIGHT);
|
|
|
|
ATTR(MAX_PBUFFER_PIXELS);
|
|
|
|
ATTR(MAX_PBUFFER_WIDTH);
|
|
|
|
ATTR(NATIVE_RENDERABLE);
|
|
|
|
ATTR(NATIVE_VISUAL_ID);
|
|
|
|
ATTR(NATIVE_VISUAL_TYPE);
|
|
|
|
ATTR(PRESERVED_RESOURCES);
|
|
|
|
ATTR(SAMPLES);
|
|
|
|
ATTR(SAMPLE_BUFFERS);
|
|
|
|
ATTR(SURFACE_TYPE);
|
|
|
|
ATTR(TRANSPARENT_TYPE);
|
|
|
|
ATTR(TRANSPARENT_RED_VALUE);
|
|
|
|
ATTR(TRANSPARENT_GREEN_VALUE);
|
|
|
|
ATTR(TRANSPARENT_BLUE_VALUE);
|
|
|
|
ATTR(BIND_TO_TEXTURE_RGB);
|
|
|
|
ATTR(BIND_TO_TEXTURE_RGBA);
|
|
|
|
ATTR(MIN_SWAP_INTERVAL);
|
|
|
|
ATTR(MAX_SWAP_INTERVAL);
|
|
|
|
ATTR(LUMINANCE_SIZE);
|
|
|
|
ATTR(ALPHA_MASK_SIZE);
|
|
|
|
ATTR(COLOR_BUFFER_TYPE);
|
|
|
|
ATTR(RENDERABLE_TYPE);
|
|
|
|
ATTR(CONFORMANT);
|
|
|
|
|
|
|
|
#undef ATTR
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
GLLibraryEGL::DumpEGLConfigs()
|
|
|
|
{
|
|
|
|
int nc = 0;
|
2013-07-20 12:48:55 +04:00
|
|
|
fGetConfigs(mEGLDisplay, nullptr, 0, &nc);
|
2012-03-17 02:24:12 +04:00
|
|
|
EGLConfig *ec = new EGLConfig[nc];
|
|
|
|
fGetConfigs(mEGLDisplay, ec, nc, &nc);
|
|
|
|
|
|
|
|
for (int i = 0; i < nc; ++i) {
|
|
|
|
printf_stderr ("========= EGL Config %d ========\n", i);
|
|
|
|
DumpEGLConfig(ec[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
delete [] ec;
|
|
|
|
}
|
|
|
|
|
2013-09-04 16:14:52 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
/*static*/ void
|
|
|
|
GLLibraryEGL::BeforeGLCall(const char* glFunction)
|
|
|
|
{
|
|
|
|
if (GLContext::DebugMode()) {
|
|
|
|
if (GLContext::DebugMode() & GLContext::DebugTrace)
|
|
|
|
printf_stderr("[egl] > %s\n", glFunction);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*static*/ void
|
|
|
|
GLLibraryEGL::AfterGLCall(const char* glFunction)
|
|
|
|
{
|
|
|
|
if (GLContext::DebugMode() & GLContext::DebugTrace) {
|
|
|
|
printf_stderr("[egl] < %s\n", glFunction);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-03-17 02:24:12 +04:00
|
|
|
} /* namespace gl */
|
|
|
|
} /* namespace mozilla */
|
|
|
|
|