зеркало из https://github.com/mozilla/gecko-dev.git
Backout Bug 594876, Bug 675474, and Bug 675532, to fix OSX64 Reftest orange, and Linux perf regression. rs+=edmorly
changeset 0a920411e64c, changeset 58147380793b, and changeset 96e052b3e845
This commit is contained in:
Родитель
ad23dcb6ad
Коммит
fec71e5e8b
|
@ -331,16 +331,6 @@ ContainerLayerOGL::GetFirstChildOGL()
|
|||
return static_cast<LayerOGL*>(mFirstChild->ImplData());
|
||||
}
|
||||
|
||||
void
|
||||
ContainerLayerOGL::Validate()
|
||||
{
|
||||
for (LayerOGL* child = GetFirstChildOGL();
|
||||
child != nsnull;
|
||||
child = mozilla::layers::GetNextSibling(child)) {
|
||||
child->Validate();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ContainerLayerOGL::RenderLayer(int aPreviousFrameBuffer,
|
||||
const nsIntPoint& aOffset)
|
||||
|
|
|
@ -89,7 +89,6 @@ public:
|
|||
|
||||
LayerOGL* GetFirstChildOGL();
|
||||
|
||||
virtual void Validate();
|
||||
virtual void RenderLayer(int aPreviousFrameBuffer,
|
||||
const nsIntPoint& aOffset);
|
||||
|
||||
|
|
|
@ -791,9 +791,6 @@ LayerManagerOGL::Render()
|
|||
mGLContext->fClearColor(0.0, 0.0, 0.0, 0.0);
|
||||
mGLContext->fClear(LOCAL_GL_COLOR_BUFFER_BIT | LOCAL_GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
RootLayer()->Validate();
|
||||
mGLContext->WaitForDrawing();
|
||||
|
||||
// Render our layers.
|
||||
RootLayer()->RenderLayer(mGLContext->IsDoubleBuffered() ? 0 : mBackBufferFBO,
|
||||
nsIntPoint(0, 0));
|
||||
|
|
|
@ -531,8 +531,6 @@ public:
|
|||
|
||||
virtual Layer* GetLayer() = 0;
|
||||
|
||||
virtual void Validate() {}
|
||||
|
||||
virtual void RenderLayer(int aPreviousFrameBuffer,
|
||||
const nsIntPoint& aOffset) = 0;
|
||||
|
||||
|
|
|
@ -734,21 +734,28 @@ ThebesLayerOGL::InvalidateRegion(const nsIntRegion &aRegion)
|
|||
}
|
||||
|
||||
void
|
||||
ThebesLayerOGL::Validate()
|
||||
ThebesLayerOGL::RenderLayer(int aPreviousFrameBuffer,
|
||||
const nsIntPoint& aOffset)
|
||||
{
|
||||
if (!mBuffer && !CreateSurface()) {
|
||||
return;
|
||||
}
|
||||
NS_ABORT_IF_FALSE(mBuffer, "should have a buffer here");
|
||||
|
||||
mOGLManager->MakeCurrent();
|
||||
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
|
||||
|
||||
TextureImage::ContentType contentType =
|
||||
CanUseOpaqueSurface() ? gfxASurface::CONTENT_COLOR :
|
||||
gfxASurface::CONTENT_COLOR_ALPHA;
|
||||
|
||||
gfxMatrix transform2d;
|
||||
PRUint32 flags = 0;
|
||||
if (!GetEffectiveTransform().Is2D(&transform2d) ||
|
||||
transform2d.HasNonIntegerTranslation()) {
|
||||
if (GetEffectiveTransform().Is2D(&transform2d)) {
|
||||
if (transform2d.HasNonIntegerTranslation()) {
|
||||
flags |= ThebesLayerBufferOGL::PAINT_WILL_RESAMPLE;
|
||||
}
|
||||
} else {
|
||||
flags |= ThebesLayerBufferOGL::PAINT_WILL_RESAMPLE;
|
||||
}
|
||||
|
||||
|
@ -776,23 +783,9 @@ ThebesLayerOGL::Validate()
|
|||
mValidRegion.Or(mValidRegion, tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ThebesLayerOGL::RenderLayer(int aPreviousFrameBuffer,
|
||||
const nsIntPoint& aOffset)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(mBuffer, "should have a buffer here");
|
||||
|
||||
gfxMatrix transform2d;
|
||||
PRUint32 flags = 0;
|
||||
if (!GetEffectiveTransform().Is2D(&transform2d) ||
|
||||
transform2d.HasNonIntegerTranslation()) {
|
||||
flags |= ThebesLayerBufferOGL::PAINT_WILL_RESAMPLE;
|
||||
}
|
||||
|
||||
// Drawing thebes layers can change the current context, reset it.
|
||||
gl()->MakeCurrent();
|
||||
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
|
||||
|
||||
gl()->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, aPreviousFrameBuffer);
|
||||
mBuffer->RenderTo(aOffset, mOGLManager, flags);
|
||||
|
|
|
@ -73,7 +73,6 @@ public:
|
|||
void Destroy();
|
||||
Layer* GetLayer();
|
||||
virtual PRBool IsEmpty();
|
||||
virtual void Validate();
|
||||
virtual void RenderLayer(int aPreviousFrameBuffer,
|
||||
const nsIntPoint& aOffset);
|
||||
|
||||
|
|
|
@ -126,7 +126,6 @@ private:
|
|||
*/
|
||||
class NS_GFX ScopedXErrorHandler
|
||||
{
|
||||
public:
|
||||
// trivial wrapper around XErrorEvent, just adding ctor initializing by zero.
|
||||
struct ErrorEvent
|
||||
{
|
||||
|
@ -138,8 +137,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
// this ScopedXErrorHandler's ErrorEvent object
|
||||
ErrorEvent mXError;
|
||||
|
||||
|
|
|
@ -71,10 +71,6 @@ switch(osName)
|
|||
}
|
||||
break;
|
||||
|
||||
case "Linux":
|
||||
isnot(acceleratedWindows, 0, "Acceleration enabled on Linux");
|
||||
break;
|
||||
|
||||
default:
|
||||
is(acceleratedWindows, 0, "Acceleration not supported on '" + osName + "'");
|
||||
}
|
||||
|
|
|
@ -649,12 +649,6 @@ public:
|
|||
*/
|
||||
virtual PRBool SwapBuffers() { return PR_FALSE; }
|
||||
|
||||
/**
|
||||
* Insert a sync point to wait for any platform specific
|
||||
* drawing to soure surfaces to complete.
|
||||
*/
|
||||
virtual void WaitForDrawing() {}
|
||||
|
||||
/**
|
||||
* Defines a two-dimensional texture image for context target surface
|
||||
*/
|
||||
|
|
|
@ -112,70 +112,65 @@ GLXLibrary::EnsureInitialized()
|
|||
reporter.SetSuccessful();
|
||||
}
|
||||
|
||||
if (PR_GetEnv("MOZ_GLX_DEBUG")) {
|
||||
mDebug = PR_TRUE;
|
||||
}
|
||||
|
||||
LibrarySymbolLoader::SymLoadStruct symbols[] = {
|
||||
/* functions that were in GLX 1.0 */
|
||||
{ (PRFuncPtr*) &xDestroyContextInternal, { "glXDestroyContext", NULL } },
|
||||
{ (PRFuncPtr*) &xMakeCurrentInternal, { "glXMakeCurrent", NULL } },
|
||||
{ (PRFuncPtr*) &xSwapBuffersInternal, { "glXSwapBuffers", NULL } },
|
||||
{ (PRFuncPtr*) &xQueryVersionInternal, { "glXQueryVersion", NULL } },
|
||||
{ (PRFuncPtr*) &xGetCurrentContextInternal, { "glXGetCurrentContext", NULL } },
|
||||
{ (PRFuncPtr*) &xWaitGLInternal, { "glXWaitGL", NULL } },
|
||||
{ (PRFuncPtr*) &xWaitXInternal, { "glXWaitX", NULL } },
|
||||
{ (PRFuncPtr*) &xDestroyContext, { "glXDestroyContext", NULL } },
|
||||
{ (PRFuncPtr*) &xMakeCurrent, { "glXMakeCurrent", NULL } },
|
||||
{ (PRFuncPtr*) &xSwapBuffers, { "glXSwapBuffers", NULL } },
|
||||
{ (PRFuncPtr*) &xQueryVersion, { "glXQueryVersion", NULL } },
|
||||
{ (PRFuncPtr*) &xGetCurrentContext, { "glXGetCurrentContext", NULL } },
|
||||
{ (PRFuncPtr*) &xWaitGL, { "glXWaitGL", NULL } },
|
||||
/* functions introduced in GLX 1.1 */
|
||||
{ (PRFuncPtr*) &xQueryExtensionsStringInternal, { "glXQueryExtensionsString", NULL } },
|
||||
{ (PRFuncPtr*) &xGetClientStringInternal, { "glXGetClientString", NULL } },
|
||||
{ (PRFuncPtr*) &xQueryServerStringInternal, { "glXQueryServerString", NULL } },
|
||||
{ (PRFuncPtr*) &xQueryExtensionsString, { "glXQueryExtensionsString", NULL } },
|
||||
{ (PRFuncPtr*) &xGetClientString, { "glXGetClientString", NULL } },
|
||||
{ (PRFuncPtr*) &xQueryServerString, { "glXQueryServerString", NULL } },
|
||||
{ NULL, { NULL } }
|
||||
};
|
||||
|
||||
LibrarySymbolLoader::SymLoadStruct symbols13[] = {
|
||||
/* functions introduced in GLX 1.3 */
|
||||
{ (PRFuncPtr*) &xChooseFBConfigInternal, { "glXChooseFBConfig", NULL } },
|
||||
{ (PRFuncPtr*) &xGetFBConfigAttribInternal, { "glXGetFBConfigAttrib", NULL } },
|
||||
{ (PRFuncPtr*) &xChooseFBConfig, { "glXChooseFBConfig", NULL } },
|
||||
{ (PRFuncPtr*) &xGetFBConfigAttrib, { "glXGetFBConfigAttrib", NULL } },
|
||||
// WARNING: xGetFBConfigs not set in symbols13_ext
|
||||
{ (PRFuncPtr*) &xGetFBConfigsInternal, { "glXGetFBConfigs", NULL } },
|
||||
{ (PRFuncPtr*) &xGetVisualFromFBConfigInternal, { "glXGetVisualFromFBConfig", NULL } },
|
||||
{ (PRFuncPtr*) &xGetFBConfigs, { "glXGetFBConfigs", NULL } },
|
||||
{ (PRFuncPtr*) &xGetVisualFromFBConfig, { "glXGetVisualFromFBConfig", NULL } },
|
||||
// WARNING: symbols13_ext sets xCreateGLXPixmapWithConfig instead
|
||||
{ (PRFuncPtr*) &xCreatePixmapInternal, { "glXCreatePixmap", NULL } },
|
||||
{ (PRFuncPtr*) &xDestroyPixmapInternal, { "glXDestroyPixmap", NULL } },
|
||||
{ (PRFuncPtr*) &xCreateNewContextInternal, { "glXCreateNewContext", NULL } },
|
||||
{ (PRFuncPtr*) &xCreatePixmap, { "glXCreatePixmap", NULL } },
|
||||
{ (PRFuncPtr*) &xDestroyPixmap, { "glXDestroyPixmap", NULL } },
|
||||
{ (PRFuncPtr*) &xCreateNewContext, { "glXCreateNewContext", NULL } },
|
||||
{ NULL, { NULL } }
|
||||
};
|
||||
|
||||
LibrarySymbolLoader::SymLoadStruct symbols13_ext[] = {
|
||||
/* extension equivalents for functions introduced in GLX 1.3 */
|
||||
// GLX_SGIX_fbconfig extension
|
||||
{ (PRFuncPtr*) &xChooseFBConfigInternal, { "glXChooseFBConfigSGIX", NULL } },
|
||||
{ (PRFuncPtr*) &xGetFBConfigAttribInternal, { "glXGetFBConfigAttribSGIX", NULL } },
|
||||
{ (PRFuncPtr*) &xChooseFBConfig, { "glXChooseFBConfigSGIX", NULL } },
|
||||
{ (PRFuncPtr*) &xGetFBConfigAttrib, { "glXGetFBConfigAttribSGIX", NULL } },
|
||||
// WARNING: no xGetFBConfigs equivalent in extensions
|
||||
{ (PRFuncPtr*) &xGetVisualFromFBConfigInternal, { "glXGetVisualFromFBConfig", NULL } },
|
||||
{ (PRFuncPtr*) &xGetVisualFromFBConfig, { "glXGetVisualFromFBConfig", NULL } },
|
||||
// WARNING: different from symbols13:
|
||||
{ (PRFuncPtr*) &xCreateGLXPixmapWithConfigInternal, { "glXCreateGLXPixmapWithConfigSGIX", NULL } },
|
||||
{ (PRFuncPtr*) &xDestroyPixmapInternal, { "glXDestroyGLXPixmap", NULL } }, // not from ext
|
||||
{ (PRFuncPtr*) &xCreateNewContextInternal, { "glXCreateContextWithConfigSGIX", NULL } },
|
||||
{ (PRFuncPtr*) &xCreateGLXPixmapWithConfig, { "glXCreateGLXPixmapWithConfigSGIX", NULL } },
|
||||
{ (PRFuncPtr*) &xDestroyPixmap, { "glXDestroyGLXPixmap", NULL } }, // not from ext
|
||||
{ (PRFuncPtr*) &xCreateNewContext, { "glXCreateContextWithConfigSGIX", NULL } },
|
||||
{ NULL, { NULL } }
|
||||
};
|
||||
|
||||
LibrarySymbolLoader::SymLoadStruct symbols14[] = {
|
||||
/* functions introduced in GLX 1.4 */
|
||||
{ (PRFuncPtr*) &xGetProcAddressInternal, { "glXGetProcAddress", NULL } },
|
||||
{ (PRFuncPtr*) &xGetProcAddress, { "glXGetProcAddress", NULL } },
|
||||
{ NULL, { NULL } }
|
||||
};
|
||||
|
||||
LibrarySymbolLoader::SymLoadStruct symbols14_ext[] = {
|
||||
/* extension equivalents for functions introduced in GLX 1.4 */
|
||||
// GLX_ARB_get_proc_address extension
|
||||
{ (PRFuncPtr*) &xGetProcAddressInternal, { "glXGetProcAddressARB", NULL } },
|
||||
{ (PRFuncPtr*) &xGetProcAddress, { "glXGetProcAddressARB", NULL } },
|
||||
{ NULL, { NULL } }
|
||||
};
|
||||
|
||||
LibrarySymbolLoader::SymLoadStruct symbols_texturefrompixmap[] = {
|
||||
{ (PRFuncPtr*) &xBindTexImageInternal, { "glXBindTexImageEXT", NULL } },
|
||||
{ (PRFuncPtr*) &xReleaseTexImageInternal, { "glXReleaseTexImageEXT", NULL } },
|
||||
{ (PRFuncPtr*) &xBindTexImage, { "glXBindTexImageEXT", NULL } },
|
||||
{ (PRFuncPtr*) &xReleaseTexImage, { "glXReleaseTexImageEXT", NULL } },
|
||||
{ NULL, { NULL } }
|
||||
};
|
||||
|
||||
|
@ -240,7 +235,7 @@ GLXLibrary::EnsureInitialized()
|
|||
|
||||
if (HasExtension(extensionsStr, "GLX_EXT_texture_from_pixmap") &&
|
||||
LibrarySymbolLoader::LoadSymbols(mOGLLibrary, symbols_texturefrompixmap,
|
||||
(LibrarySymbolLoader::PlatformLookupFunction)&xGetProcAddress))
|
||||
(LibrarySymbolLoader::PlatformLookupFunction)xGetProcAddress))
|
||||
{
|
||||
mHasTextureFromPixmap = PR_TRUE;
|
||||
} else {
|
||||
|
@ -298,7 +293,6 @@ GLXLibrary::CreatePixmap(gfxASurface* aSurface)
|
|||
"glXChooseFBConfig() failed to match our requested format and violated its spec (!)");
|
||||
|
||||
gfxXlibSurface *xs = static_cast<gfxXlibSurface*>(aSurface);
|
||||
NS_ABORT_IF_FALSE(xs->XDisplay() == display, "This is bad");
|
||||
|
||||
int pixmapAttribs[] = { GLX_TEXTURE_TARGET_EXT, GLX_TEXTURE_2D_EXT,
|
||||
GLX_TEXTURE_FORMAT_EXT, GLX_TEXTURE_FORMAT_RGBA_EXT,
|
||||
|
@ -332,6 +326,7 @@ GLXLibrary::BindTexImage(GLXPixmap aPixmap)
|
|||
|
||||
Display *display = DefaultXDisplay();
|
||||
// Make sure all X drawing to the surface has finished before binding to a texture.
|
||||
XSync(DefaultXDisplay(), False);
|
||||
xBindTexImage(display, aPixmap, GLX_FRONT_LEFT_EXT, NULL);
|
||||
}
|
||||
|
||||
|
@ -346,287 +341,6 @@ GLXLibrary::ReleaseTexImage(GLXPixmap aPixmap)
|
|||
xReleaseTexImage(display, aPixmap, GLX_FRONT_LEFT_EXT);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
static int (*sOldErrorHandler)(Display *, XErrorEvent *);
|
||||
ScopedXErrorHandler::ErrorEvent sErrorEvent;
|
||||
static int GLXErrorHandler(Display *display, XErrorEvent *ev)
|
||||
{
|
||||
if (!sErrorEvent.mError.error_code) {
|
||||
sErrorEvent.mError = *ev;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
GLXLibrary::BeforeGLXCall()
|
||||
{
|
||||
if (mDebug) {
|
||||
sOldErrorHandler = XSetErrorHandler(GLXErrorHandler);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
GLXLibrary::AfterGLXCall()
|
||||
{
|
||||
XSync(DefaultXDisplay(), False);
|
||||
if (mDebug && sErrorEvent.mError.error_code) {
|
||||
char buffer[2048];
|
||||
XGetErrorText(DefaultXDisplay(), sErrorEvent.mError.error_code, buffer, sizeof(buffer));
|
||||
printf_stderr("X ERROR: %s (%i) - Request: %i.%i, Serial: %i",
|
||||
buffer,
|
||||
sErrorEvent.mError.error_code,
|
||||
sErrorEvent.mError.request_code,
|
||||
sErrorEvent.mError.minor_code,
|
||||
sErrorEvent.mError.serial);
|
||||
NS_ABORT();
|
||||
}
|
||||
XSetErrorHandler(sOldErrorHandler);
|
||||
}
|
||||
|
||||
#define BEFORE_GLX_CALL do { \
|
||||
sGLXLibrary.BeforeGLXCall(); \
|
||||
} while (0)
|
||||
|
||||
#define AFTER_GLX_CALL do { \
|
||||
sGLXLibrary.AfterGLXCall(); \
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
|
||||
#define BEFORE_GLX_CALL do { } while(0)
|
||||
#define AFTER_GLX_CALL do { } while(0)
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
GLXLibrary::xDestroyContext(Display* display, GLXContext context)
|
||||
{
|
||||
BEFORE_GLX_CALL;
|
||||
xDestroyContextInternal(display, context);
|
||||
AFTER_GLX_CALL;
|
||||
}
|
||||
|
||||
Bool
|
||||
GLXLibrary::xMakeCurrent(Display* display,
|
||||
GLXDrawable drawable,
|
||||
GLXContext context)
|
||||
{
|
||||
BEFORE_GLX_CALL;
|
||||
Bool result = xMakeCurrentInternal(display, drawable, context);
|
||||
AFTER_GLX_CALL;
|
||||
return result;
|
||||
}
|
||||
|
||||
GLXContext
|
||||
GLXLibrary::xGetCurrentContext()
|
||||
{
|
||||
BEFORE_GLX_CALL;
|
||||
GLXContext result = xGetCurrentContextInternal();
|
||||
AFTER_GLX_CALL;
|
||||
return result;
|
||||
}
|
||||
|
||||
/* static */ void*
|
||||
GLXLibrary::xGetProcAddress(const char *procName)
|
||||
{
|
||||
BEFORE_GLX_CALL;
|
||||
void* result = sGLXLibrary.xGetProcAddressInternal(procName);
|
||||
AFTER_GLX_CALL;
|
||||
return result;
|
||||
}
|
||||
|
||||
GLXFBConfig*
|
||||
GLXLibrary::xChooseFBConfig(Display* display,
|
||||
int screen,
|
||||
const int *attrib_list,
|
||||
int *nelements)
|
||||
{
|
||||
BEFORE_GLX_CALL;
|
||||
GLXFBConfig* result = xChooseFBConfigInternal(display, screen, attrib_list, nelements);
|
||||
AFTER_GLX_CALL;
|
||||
return result;
|
||||
}
|
||||
|
||||
GLXFBConfig*
|
||||
GLXLibrary::xGetFBConfigs(Display* display,
|
||||
int screen,
|
||||
int *nelements)
|
||||
{
|
||||
BEFORE_GLX_CALL;
|
||||
GLXFBConfig* result = xGetFBConfigsInternal(display, screen, nelements);
|
||||
AFTER_GLX_CALL;
|
||||
return result;
|
||||
}
|
||||
|
||||
GLXContext
|
||||
GLXLibrary::xCreateNewContext(Display* display,
|
||||
GLXFBConfig config,
|
||||
int render_type,
|
||||
GLXContext share_list,
|
||||
Bool direct)
|
||||
{
|
||||
BEFORE_GLX_CALL;
|
||||
GLXContext result = xCreateNewContextInternal(display, config,
|
||||
render_type,
|
||||
share_list, direct);
|
||||
AFTER_GLX_CALL;
|
||||
return result;
|
||||
}
|
||||
|
||||
XVisualInfo*
|
||||
GLXLibrary::xGetVisualFromFBConfig(Display* display,
|
||||
GLXFBConfig config)
|
||||
{
|
||||
BEFORE_GLX_CALL;
|
||||
XVisualInfo* result = xGetVisualFromFBConfigInternal(display, config);
|
||||
AFTER_GLX_CALL;
|
||||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
GLXLibrary::xGetFBConfigAttrib(Display *display,
|
||||
GLXFBConfig config,
|
||||
int attribute,
|
||||
int *value)
|
||||
{
|
||||
BEFORE_GLX_CALL;
|
||||
int result = xGetFBConfigAttribInternal(display, config,
|
||||
attribute, value);
|
||||
AFTER_GLX_CALL;
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
GLXLibrary::xSwapBuffers(Display *display, GLXDrawable drawable)
|
||||
{
|
||||
BEFORE_GLX_CALL;
|
||||
xSwapBuffersInternal(display, drawable);
|
||||
AFTER_GLX_CALL;
|
||||
}
|
||||
|
||||
const char *
|
||||
GLXLibrary::xQueryExtensionsString(Display *display,
|
||||
int screen)
|
||||
{
|
||||
BEFORE_GLX_CALL;
|
||||
const char *result = xQueryExtensionsStringInternal(display, screen);
|
||||
AFTER_GLX_CALL;
|
||||
return result;
|
||||
}
|
||||
|
||||
const char *
|
||||
GLXLibrary::xGetClientString(Display *display,
|
||||
int screen)
|
||||
{
|
||||
BEFORE_GLX_CALL;
|
||||
const char *result = xGetClientStringInternal(display, screen);
|
||||
AFTER_GLX_CALL;
|
||||
return result;
|
||||
}
|
||||
|
||||
const char *
|
||||
GLXLibrary::xQueryServerString(Display *display,
|
||||
int screen, int name)
|
||||
{
|
||||
BEFORE_GLX_CALL;
|
||||
const char *result = xQueryServerStringInternal(display, screen, name);
|
||||
AFTER_GLX_CALL;
|
||||
return result;
|
||||
}
|
||||
|
||||
GLXPixmap
|
||||
GLXLibrary::xCreatePixmap(Display *display,
|
||||
GLXFBConfig config,
|
||||
Pixmap pixmap,
|
||||
const int *attrib_list)
|
||||
{
|
||||
BEFORE_GLX_CALL;
|
||||
GLXPixmap result = xCreatePixmapInternal(display, config,
|
||||
pixmap, attrib_list);
|
||||
AFTER_GLX_CALL;
|
||||
return result;
|
||||
}
|
||||
|
||||
GLXPixmap
|
||||
GLXLibrary::xCreateGLXPixmapWithConfig(Display *display,
|
||||
GLXFBConfig config,
|
||||
Pixmap pixmap)
|
||||
{
|
||||
BEFORE_GLX_CALL;
|
||||
GLXPixmap result = xCreateGLXPixmapWithConfigInternal(display, config, pixmap);
|
||||
AFTER_GLX_CALL;
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
GLXLibrary::xDestroyPixmap(Display *display, GLXPixmap pixmap)
|
||||
{
|
||||
BEFORE_GLX_CALL;
|
||||
xDestroyPixmapInternal(display, pixmap);
|
||||
AFTER_GLX_CALL;
|
||||
}
|
||||
|
||||
GLXContext
|
||||
GLXLibrary::xCreateContext(Display *display,
|
||||
XVisualInfo *vis,
|
||||
GLXContext shareList,
|
||||
Bool direct)
|
||||
{
|
||||
BEFORE_GLX_CALL;
|
||||
GLXContext result = xCreateContextInternal(display, vis, shareList, direct);
|
||||
AFTER_GLX_CALL;
|
||||
return result;
|
||||
}
|
||||
|
||||
Bool
|
||||
GLXLibrary::xQueryVersion(Display *display,
|
||||
int *major,
|
||||
int *minor)
|
||||
{
|
||||
BEFORE_GLX_CALL;
|
||||
Bool result = xQueryVersionInternal(display, major, minor);
|
||||
AFTER_GLX_CALL;
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
GLXLibrary::xBindTexImage(Display *display,
|
||||
GLXDrawable drawable,
|
||||
int buffer,
|
||||
const int *attrib_list)
|
||||
{
|
||||
BEFORE_GLX_CALL;
|
||||
xBindTexImageInternal(display, drawable, buffer, attrib_list);
|
||||
AFTER_GLX_CALL;
|
||||
}
|
||||
|
||||
void
|
||||
GLXLibrary::xReleaseTexImage(Display *display,
|
||||
GLXDrawable drawable,
|
||||
int buffer)
|
||||
{
|
||||
BEFORE_GLX_CALL;
|
||||
xReleaseTexImageInternal(display, drawable, buffer);
|
||||
AFTER_GLX_CALL;
|
||||
}
|
||||
|
||||
void
|
||||
GLXLibrary::xWaitGL()
|
||||
{
|
||||
BEFORE_GLX_CALL;
|
||||
xWaitGLInternal();
|
||||
AFTER_GLX_CALL;
|
||||
}
|
||||
|
||||
void
|
||||
GLXLibrary::xWaitX()
|
||||
{
|
||||
BEFORE_GLX_CALL;
|
||||
xWaitXInternal();
|
||||
AFTER_GLX_CALL;
|
||||
}
|
||||
|
||||
GLXLibrary sGLXLibrary;
|
||||
|
||||
class GLContextGLX : public GLContext
|
||||
|
@ -752,7 +466,7 @@ TRY_AGAIN_NO_SHARING:
|
|||
|
||||
PRBool SetupLookupFunction()
|
||||
{
|
||||
mLookupFunc = (PlatformLookupFunction)&GLXLibrary::xGetProcAddress;
|
||||
mLookupFunc = (PlatformLookupFunction)sGLXLibrary.xGetProcAddress;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -784,11 +498,6 @@ TRY_AGAIN_NO_SHARING:
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
void WaitForDrawing()
|
||||
{
|
||||
sGLXLibrary.xWaitX();
|
||||
}
|
||||
|
||||
PRBool TextureImageSupportsGetBackingSurface()
|
||||
{
|
||||
return sGLXLibrary.HasTextureFromPixmap();
|
||||
|
@ -1341,4 +1050,3 @@ GLContextProviderGLX::Shutdown()
|
|||
|
||||
} /* namespace gl */
|
||||
} /* namespace mozilla */
|
||||
|
||||
|
|
|
@ -49,64 +49,93 @@ class GLXLibrary
|
|||
{
|
||||
public:
|
||||
GLXLibrary() : mInitialized(PR_FALSE), mTriedInitializing(PR_FALSE),
|
||||
mHasTextureFromPixmap(PR_FALSE), mDebug(PR_FALSE),
|
||||
mOGLLibrary(nsnull) {}
|
||||
mHasTextureFromPixmap(PR_FALSE), mOGLLibrary(nsnull) {}
|
||||
|
||||
void xDestroyContext(Display* display, GLXContext context);
|
||||
Bool xMakeCurrent(Display* display,
|
||||
GLXDrawable drawable,
|
||||
GLXContext context);
|
||||
GLXContext xGetCurrentContext();
|
||||
static void* xGetProcAddress(const char *procName);
|
||||
GLXFBConfig* xChooseFBConfig(Display* display,
|
||||
int screen,
|
||||
const int *attrib_list,
|
||||
int *nelements);
|
||||
GLXFBConfig* xGetFBConfigs(Display* display,
|
||||
int screen,
|
||||
int *nelements);
|
||||
GLXContext xCreateNewContext(Display* display,
|
||||
GLXFBConfig config,
|
||||
int render_type,
|
||||
GLXContext share_list,
|
||||
Bool direct);
|
||||
XVisualInfo* xGetVisualFromFBConfig(Display* display,
|
||||
GLXFBConfig config);
|
||||
int xGetFBConfigAttrib(Display *display,
|
||||
GLXFBConfig config,
|
||||
int attribute,
|
||||
int *value);
|
||||
void xSwapBuffers(Display *display, GLXDrawable drawable);
|
||||
const char * xQueryExtensionsString(Display *display,
|
||||
int screen);
|
||||
const char * xGetClientString(Display *display,
|
||||
int screen);
|
||||
const char * xQueryServerString(Display *display,
|
||||
int screen, int name);
|
||||
GLXPixmap xCreatePixmap(Display *display,
|
||||
GLXFBConfig config,
|
||||
Pixmap pixmap,
|
||||
const int *attrib_list);
|
||||
GLXPixmap xCreateGLXPixmapWithConfig(Display *display,
|
||||
GLXFBConfig config,
|
||||
Pixmap pixmap);
|
||||
void xDestroyPixmap(Display *display, GLXPixmap pixmap);
|
||||
GLXContext xCreateContext(Display *display,
|
||||
XVisualInfo *vis,
|
||||
GLXContext shareList,
|
||||
Bool direct);
|
||||
Bool xQueryVersion(Display *display,
|
||||
int *major,
|
||||
int *minor);
|
||||
void xBindTexImage(Display *display,
|
||||
GLXDrawable drawable,
|
||||
int buffer,
|
||||
const int *attrib_list);
|
||||
void xReleaseTexImage(Display *display,
|
||||
GLXDrawable drawable,
|
||||
int buffer);
|
||||
void xWaitGL();
|
||||
void xWaitX();
|
||||
typedef void (GLAPIENTRY * PFNGLXDESTROYCONTEXTPROC) (Display*,
|
||||
GLXContext);
|
||||
PFNGLXDESTROYCONTEXTPROC xDestroyContext;
|
||||
typedef Bool (GLAPIENTRY * PFNGLXMAKECURRENTPROC) (Display*,
|
||||
GLXDrawable,
|
||||
GLXContext);
|
||||
PFNGLXMAKECURRENTPROC xMakeCurrent;
|
||||
typedef GLXContext (GLAPIENTRY * PFNGLXGETCURRENTCONTEXT) ();
|
||||
PFNGLXGETCURRENTCONTEXT xGetCurrentContext;
|
||||
typedef void* (GLAPIENTRY * PFNGLXGETPROCADDRESSPROC) (const char *);
|
||||
PFNGLXGETPROCADDRESSPROC xGetProcAddress;
|
||||
typedef GLXFBConfig* (GLAPIENTRY * PFNGLXCHOOSEFBCONFIG) (Display *,
|
||||
int,
|
||||
const int *,
|
||||
int *);
|
||||
PFNGLXCHOOSEFBCONFIG xChooseFBConfig;
|
||||
typedef GLXFBConfig* (GLAPIENTRY * PFNGLXGETFBCONFIGS) (Display *,
|
||||
int,
|
||||
int *);
|
||||
PFNGLXGETFBCONFIGS xGetFBConfigs;
|
||||
typedef GLXContext (GLAPIENTRY * PFNGLXCREATENEWCONTEXT) (Display *,
|
||||
GLXFBConfig,
|
||||
int,
|
||||
GLXContext,
|
||||
Bool);
|
||||
PFNGLXCREATENEWCONTEXT xCreateNewContext;
|
||||
typedef XVisualInfo* (GLAPIENTRY * PFNGLXGETVISUALFROMFBCONFIG) (Display *,
|
||||
GLXFBConfig);
|
||||
PFNGLXGETVISUALFROMFBCONFIG xGetVisualFromFBConfig;
|
||||
typedef int (GLAPIENTRY * PFNGLXGETFBCONFIGATTRIB) (Display *,
|
||||
GLXFBConfig,
|
||||
int,
|
||||
int *);
|
||||
PFNGLXGETFBCONFIGATTRIB xGetFBConfigAttrib;
|
||||
|
||||
typedef void (GLAPIENTRY * PFNGLXSWAPBUFFERS) (Display *,
|
||||
GLXDrawable);
|
||||
PFNGLXSWAPBUFFERS xSwapBuffers;
|
||||
typedef const char * (GLAPIENTRY * PFNGLXQUERYEXTENSIONSSTRING) (Display *,
|
||||
int);
|
||||
PFNGLXQUERYEXTENSIONSSTRING xQueryExtensionsString;
|
||||
typedef const char * (GLAPIENTRY * PFNGLXGETCLIENTSTRING) (Display *,
|
||||
int);
|
||||
PFNGLXGETCLIENTSTRING xGetClientString;
|
||||
typedef const char * (GLAPIENTRY * PFNGLXQUERYSERVERSTRING) (Display *,
|
||||
int,
|
||||
int);
|
||||
PFNGLXQUERYSERVERSTRING xQueryServerString;
|
||||
|
||||
typedef GLXPixmap (GLAPIENTRY * PFNGLXCREATEPIXMAP) (Display *,
|
||||
GLXFBConfig,
|
||||
Pixmap,
|
||||
const int *);
|
||||
PFNGLXCREATEPIXMAP xCreatePixmap;
|
||||
typedef GLXPixmap (GLAPIENTRY * PFNGLXCREATEGLXPIXMAPWITHCONFIG)
|
||||
(Display *,
|
||||
GLXFBConfig,
|
||||
Pixmap);
|
||||
PFNGLXCREATEGLXPIXMAPWITHCONFIG xCreateGLXPixmapWithConfig;
|
||||
typedef void (GLAPIENTRY * PFNGLXDESTROYPIXMAP) (Display *,
|
||||
GLXPixmap);
|
||||
PFNGLXDESTROYPIXMAP xDestroyPixmap;
|
||||
typedef GLXContext (GLAPIENTRY * PFNGLXCREATECONTEXT) (Display *,
|
||||
XVisualInfo *,
|
||||
GLXContext,
|
||||
Bool);
|
||||
PFNGLXCREATECONTEXT xCreateContext;
|
||||
typedef Bool (GLAPIENTRY * PFNGLXQUERYVERSION) (Display *,
|
||||
int *,
|
||||
int *);
|
||||
PFNGLXQUERYVERSION xQueryVersion;
|
||||
|
||||
typedef void (GLAPIENTRY * PFNGLXBINDTEXIMAGE) (Display *,
|
||||
GLXDrawable,
|
||||
int,
|
||||
const int *);
|
||||
PFNGLXBINDTEXIMAGE xBindTexImage;
|
||||
|
||||
typedef void (GLAPIENTRY * PFNGLXRELEASETEXIMAGE) (Display *,
|
||||
GLXDrawable,
|
||||
int);
|
||||
PFNGLXRELEASETEXIMAGE xReleaseTexImage;
|
||||
|
||||
typedef void (GLAPIENTRY * PFNGLXWAITGL) ();
|
||||
PFNGLXWAITGL xWaitGL;
|
||||
|
||||
PRBool EnsureInitialized();
|
||||
|
||||
|
@ -119,105 +148,9 @@ public:
|
|||
PRBool SupportsTextureFromPixmap(gfxASurface* aSurface);
|
||||
|
||||
private:
|
||||
|
||||
typedef void (GLAPIENTRY * PFNGLXDESTROYCONTEXTPROC) (Display*,
|
||||
GLXContext);
|
||||
PFNGLXDESTROYCONTEXTPROC xDestroyContextInternal;
|
||||
typedef Bool (GLAPIENTRY * PFNGLXMAKECURRENTPROC) (Display*,
|
||||
GLXDrawable,
|
||||
GLXContext);
|
||||
PFNGLXMAKECURRENTPROC xMakeCurrentInternal;
|
||||
typedef GLXContext (GLAPIENTRY * PFNGLXGETCURRENTCONTEXT) ();
|
||||
PFNGLXGETCURRENTCONTEXT xGetCurrentContextInternal;
|
||||
typedef void* (GLAPIENTRY * PFNGLXGETPROCADDRESSPROC) (const char *);
|
||||
PFNGLXGETPROCADDRESSPROC xGetProcAddressInternal;
|
||||
typedef GLXFBConfig* (GLAPIENTRY * PFNGLXCHOOSEFBCONFIG) (Display *,
|
||||
int,
|
||||
const int *,
|
||||
int *);
|
||||
PFNGLXCHOOSEFBCONFIG xChooseFBConfigInternal;
|
||||
typedef GLXFBConfig* (GLAPIENTRY * PFNGLXGETFBCONFIGS) (Display *,
|
||||
int,
|
||||
int *);
|
||||
PFNGLXGETFBCONFIGS xGetFBConfigsInternal;
|
||||
typedef GLXContext (GLAPIENTRY * PFNGLXCREATENEWCONTEXT) (Display *,
|
||||
GLXFBConfig,
|
||||
int,
|
||||
GLXContext,
|
||||
Bool);
|
||||
PFNGLXCREATENEWCONTEXT xCreateNewContextInternal;
|
||||
typedef XVisualInfo* (GLAPIENTRY * PFNGLXGETVISUALFROMFBCONFIG) (Display *,
|
||||
GLXFBConfig);
|
||||
PFNGLXGETVISUALFROMFBCONFIG xGetVisualFromFBConfigInternal;
|
||||
typedef int (GLAPIENTRY * PFNGLXGETFBCONFIGATTRIB) (Display *,
|
||||
GLXFBConfig,
|
||||
int,
|
||||
int *);
|
||||
PFNGLXGETFBCONFIGATTRIB xGetFBConfigAttribInternal;
|
||||
|
||||
typedef void (GLAPIENTRY * PFNGLXSWAPBUFFERS) (Display *,
|
||||
GLXDrawable);
|
||||
PFNGLXSWAPBUFFERS xSwapBuffersInternal;
|
||||
typedef const char * (GLAPIENTRY * PFNGLXQUERYEXTENSIONSSTRING) (Display *,
|
||||
int);
|
||||
PFNGLXQUERYEXTENSIONSSTRING xQueryExtensionsStringInternal;
|
||||
typedef const char * (GLAPIENTRY * PFNGLXGETCLIENTSTRING) (Display *,
|
||||
int);
|
||||
PFNGLXGETCLIENTSTRING xGetClientStringInternal;
|
||||
typedef const char * (GLAPIENTRY * PFNGLXQUERYSERVERSTRING) (Display *,
|
||||
int,
|
||||
int);
|
||||
PFNGLXQUERYSERVERSTRING xQueryServerStringInternal;
|
||||
|
||||
typedef GLXPixmap (GLAPIENTRY * PFNGLXCREATEPIXMAP) (Display *,
|
||||
GLXFBConfig,
|
||||
Pixmap,
|
||||
const int *);
|
||||
PFNGLXCREATEPIXMAP xCreatePixmapInternal;
|
||||
typedef GLXPixmap (GLAPIENTRY * PFNGLXCREATEGLXPIXMAPWITHCONFIG)
|
||||
(Display *,
|
||||
GLXFBConfig,
|
||||
Pixmap);
|
||||
PFNGLXCREATEGLXPIXMAPWITHCONFIG xCreateGLXPixmapWithConfigInternal;
|
||||
typedef void (GLAPIENTRY * PFNGLXDESTROYPIXMAP) (Display *,
|
||||
GLXPixmap);
|
||||
PFNGLXDESTROYPIXMAP xDestroyPixmapInternal;
|
||||
typedef GLXContext (GLAPIENTRY * PFNGLXCREATECONTEXT) (Display *,
|
||||
XVisualInfo *,
|
||||
GLXContext,
|
||||
Bool);
|
||||
PFNGLXCREATECONTEXT xCreateContextInternal;
|
||||
typedef Bool (GLAPIENTRY * PFNGLXQUERYVERSION) (Display *,
|
||||
int *,
|
||||
int *);
|
||||
PFNGLXQUERYVERSION xQueryVersionInternal;
|
||||
|
||||
typedef void (GLAPIENTRY * PFNGLXBINDTEXIMAGE) (Display *,
|
||||
GLXDrawable,
|
||||
int,
|
||||
const int *);
|
||||
PFNGLXBINDTEXIMAGE xBindTexImageInternal;
|
||||
|
||||
typedef void (GLAPIENTRY * PFNGLXRELEASETEXIMAGE) (Display *,
|
||||
GLXDrawable,
|
||||
int);
|
||||
PFNGLXRELEASETEXIMAGE xReleaseTexImageInternal;
|
||||
|
||||
typedef void (GLAPIENTRY * PFNGLXWAITGL) ();
|
||||
PFNGLXWAITGL xWaitGLInternal;
|
||||
|
||||
typedef void (GLAPIENTRY * PFNGLXWAITX) ();
|
||||
PFNGLXWAITGL xWaitXInternal;
|
||||
|
||||
#ifdef DEBUG
|
||||
void BeforeGLXCall();
|
||||
void AfterGLXCall();
|
||||
#endif
|
||||
|
||||
PRBool mInitialized;
|
||||
PRBool mTriedInitializing;
|
||||
PRBool mHasTextureFromPixmap;
|
||||
PRBool mDebug;
|
||||
PRLibrary *mOGLLibrary;
|
||||
};
|
||||
|
||||
|
|
|
@ -778,7 +778,7 @@ nsBaseWidget::AutoUseBasicLayerManager::~AutoUseBasicLayerManager()
|
|||
PRBool
|
||||
nsBaseWidget::GetShouldAccelerate()
|
||||
{
|
||||
#if defined(XP_WIN) || defined(ANDROID) || (MOZ_PLATFORM_MAEMO > 5) || (!defined(MOZ_PLATFORM_MAEMO) && defined(MOZ_X11))
|
||||
#if defined(XP_WIN) || defined(ANDROID) || (MOZ_PLATFORM_MAEMO > 5)
|
||||
PRBool accelerateByDefault = PR_TRUE;
|
||||
#elif defined(XP_MACOSX)
|
||||
/* quickdraw plugins don't work with OpenGL so we need to avoid OpenGL when we want to support
|
||||
|
|
Загрузка…
Ссылка в новой задаче