Bug 667885 - about:support causes screen freeze. r=chrislord

This commit is contained in:
Florian Haenel 2011-09-14 21:14:43 +02:00
parent 22acbaaabb
commit 348c5227d7
2 changed files with 15 additions and 8 deletions

View File

@ -169,7 +169,11 @@ typedef void *EGLCastToRelevantPtr;
typedef void *EGLImageKHR; typedef void *EGLImageKHR;
typedef void *GLeglImageOES; typedef void *GLeglImageOES;
#ifdef MOZ_WIDGET_QT
#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)QX11Info::display())
#else
#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0) #define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0)
#endif
#define EGL_NO_CONTEXT ((EGLContext)0) #define EGL_NO_CONTEXT ((EGLContext)0)
#define EGL_NO_DISPLAY ((EGLDisplay)0) #define EGL_NO_DISPLAY ((EGLDisplay)0)
#define EGL_NO_SURFACE ((EGLSurface)0) #define EGL_NO_SURFACE ((EGLSurface)0)
@ -242,6 +246,8 @@ public:
typedef EGLDisplay (GLAPIENTRY * pfnGetDisplay)(void *display_id); typedef EGLDisplay (GLAPIENTRY * pfnGetDisplay)(void *display_id);
pfnGetDisplay fGetDisplay; pfnGetDisplay fGetDisplay;
typedef EGLSurface (GLAPIENTRY * pfnGetCurrentSurface)(EGLint);
pfnGetCurrentSurface fGetCurrentSurface;
typedef EGLContext (GLAPIENTRY * pfnGetCurrentContext)(void); typedef EGLContext (GLAPIENTRY * pfnGetCurrentContext)(void);
pfnGetCurrentContext fGetCurrentContext; pfnGetCurrentContext fGetCurrentContext;
typedef EGLBoolean (GLAPIENTRY * pfnMakeCurrent)(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx); typedef EGLBoolean (GLAPIENTRY * pfnMakeCurrent)(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
@ -364,6 +370,7 @@ public:
LibrarySymbolLoader::SymLoadStruct earlySymbols[] = { LibrarySymbolLoader::SymLoadStruct earlySymbols[] = {
SYMBOL(GetDisplay), SYMBOL(GetDisplay),
SYMBOL(GetCurrentSurface),
SYMBOL(GetCurrentContext), SYMBOL(GetCurrentContext),
SYMBOL(MakeCurrent), SYMBOL(MakeCurrent),
SYMBOL(DestroyContext), SYMBOL(DestroyContext),
@ -693,7 +700,7 @@ public:
#endif #endif
sEGLLibrary.fDestroyContext(EGL_DISPLAY(), mContext); sEGLLibrary.fDestroyContext(EGL_DISPLAY(), mContext);
if (mSurface) { if (mSurface && !mPlatformContext) {
sEGLLibrary.fDestroySurface(EGL_DISPLAY(), mSurface); sEGLLibrary.fDestroySurface(EGL_DISPLAY(), mSurface);
} }
} }
@ -825,17 +832,15 @@ public:
} }
#endif #endif
#ifndef MOZ_WIDGET_QT
virtual void virtual void
ReleaseSurface() { ReleaseSurface() {
if (mSurface) { if (mSurface && !mPlatformContext) {
sEGLLibrary.fMakeCurrent(EGL_DISPLAY(), EGL_NO_SURFACE, EGL_NO_SURFACE, sEGLLibrary.fMakeCurrent(EGL_DISPLAY(), EGL_NO_SURFACE, EGL_NO_SURFACE,
EGL_NO_CONTEXT); EGL_NO_CONTEXT);
sEGLLibrary.fDestroySurface(EGL_DISPLAY(), mSurface); sEGLLibrary.fDestroySurface(EGL_DISPLAY(), mSurface);
mSurface = NULL; mSurface = NULL;
} }
} }
#endif
PRBool SetupLookupFunction() PRBool SetupLookupFunction()
{ {
@ -856,7 +861,7 @@ public:
PRBool SwapBuffers() PRBool SwapBuffers()
{ {
if (mSurface) { if (mSurface && !mPlatformContext) {
return sEGLLibrary.fSwapBuffers(EGL_DISPLAY(), mSurface); return sEGLLibrary.fSwapBuffers(EGL_DISPLAY(), mSurface);
} else { } else {
return PR_FALSE; return PR_FALSE;
@ -1063,7 +1068,7 @@ GLContextEGL::ResizeOffscreen(const gfxIntSize& aNewSize)
SetOffscreenSize(aNewSize, pbsize); SetOffscreenSize(aNewSize, pbsize);
if (mSurface) { if (mSurface && !mPlatformContext) {
sEGLLibrary.fDestroySurface(EGL_DISPLAY(), mSurface); sEGLLibrary.fDestroySurface(EGL_DISPLAY(), mSurface);
} }
@ -1733,7 +1738,8 @@ GLContextProviderEGL::CreateForWindow(nsIWidget *aWidget)
nsRefPtr<GLContextEGL> glContext = nsRefPtr<GLContextEGL> glContext =
new GLContextEGL(ContextFormat(DepthToGLFormat(context->device()->depth())), new GLContextEGL(ContextFormat(DepthToGLFormat(context->device()->depth())),
NULL, NULL,
NULL, NULL, NULL,
sEGLLibrary.fGetCurrentSurface(LOCAL_EGL_DRAW), // just use same surface for read and draw
sEGLLibrary.fGetCurrentContext(), sEGLLibrary.fGetCurrentContext(),
PR_FALSE); PR_FALSE);

View File

@ -3198,5 +3198,6 @@ typedef ptrdiff_t GLintptr;
#define LOCAL_EGL_WRITE_SURFACE_BIT_KHR 0x0002 #define LOCAL_EGL_WRITE_SURFACE_BIT_KHR 0x0002
#define LOCAL_EGL_LOCK_SURFACE_BIT_KHR 0x0080 #define LOCAL_EGL_LOCK_SURFACE_BIT_KHR 0x0080
#define LOCAL_EGL_CORE_NATIVE_ENGINE 0x305B #define LOCAL_EGL_CORE_NATIVE_ENGINE 0x305B
#define LOCAL_EGL_READ 0x305A
#define LOCAL_EGL_DRAW 0x3059
#endif #endif