Bug 844698 Make Qt EGL port working on X11 Maemo/Meego after bug 716859 landed. r=jgilbert

--HG--
extra : rebase_source : ecd6996396379823b9eec44cb0fd20e115fa8153
This commit is contained in:
Oleg Romashin 2013-02-27 20:56:29 -08:00
parent 27d3fd60db
commit df8622c1b3

View File

@ -227,10 +227,10 @@ class GLContextEGL : public GLContext
config, config,
EGL_NO_CONTEXT, EGL_NO_CONTEXT,
attribs); attribs);
if (!context) { }
NS_WARNING("Failed to create EGLContext!"); if (!context) {
return nullptr; NS_WARNING("Failed to create EGLContext!");
} return nullptr;
} }
nsRefPtr<GLContextEGL> glContext = new GLContextEGL(caps, nsRefPtr<GLContextEGL> glContext = new GLContextEGL(caps,
@ -2034,20 +2034,25 @@ GLContextProviderEGL::CreateForWindow(nsIWidget *aWidget)
bool doubleBuffered = true; bool doubleBuffered = true;
bool hasNativeContext = aWidget->HasGLContext();
EGLContext eglContext = sEGLLibrary.fGetCurrentContext(); EGLContext eglContext = sEGLLibrary.fGetCurrentContext();
if (aWidget->HasGLContext() && eglContext) { if (hasNativeContext && eglContext) {
//int colorDepth = gfxPlatform::GetPlatform()->GetScreenDepth();
void* platformContext = eglContext; void* platformContext = eglContext;
SurfaceCaps caps = SurfaceCaps::Any();
#ifdef MOZ_WIDGET_QT #ifdef MOZ_WIDGET_QT
int depth = gfxPlatform::GetPlatform()->GetScreenDepth();
QGLContext* context = const_cast<QGLContext*>(QGLContext::currentContext()); QGLContext* context = const_cast<QGLContext*>(QGLContext::currentContext());
if (context && context->device()) { if (context && context->device()) {
depth = context->device()->depth(); depth = context->device()->depth();
} }
doubleBuffered = context->format().doubleBuffer(); const QGLFormat& format = context->format();
doubleBuffered = format.doubleBuffer();
platformContext = context; platformContext = context;
caps.bpp16 = depth == 16 ? true : false;
caps.alpha = format.rgba();
caps.depth = format.depth();
caps.stencil = format.stencil();
#endif #endif
SurfaceCaps caps = SurfaceCaps::Any();
EGLConfig config = EGL_NO_CONFIG; EGLConfig config = EGL_NO_CONFIG;
EGLSurface surface = sEGLLibrary.fGetCurrentSurface(LOCAL_EGL_DRAW); EGLSurface surface = sEGLLibrary.fGetCurrentSurface(LOCAL_EGL_DRAW);
nsRefPtr<GLContextEGL> glContext = nsRefPtr<GLContextEGL> glContext =
@ -2216,11 +2221,12 @@ CreateEGLSurfaceForXSurface(gfxASurface* aSurface, EGLConfig* aConfig)
if (!sEGLLibrary.fChooseConfig(EGL_DISPLAY(), if (!sEGLLibrary.fChooseConfig(EGL_DISPLAY(),
sEGLLibrary.HasKHRLockSurface() ? sEGLLibrary.HasKHRLockSurface() ?
pixmap_lock_config : pixmap_config, pixmap_lock_config : pixmap_config,
configs, numConfigs, &numConfigs)) configs, numConfigs, &numConfigs)
return nullptr; || numConfigs == 0)
{
if (numConfigs == 0) NS_WARNING("No EGL Config for pixmap!");
return nullptr; return nullptr;
}
int i = 0; int i = 0;
for (i = 0; i < numConfigs; ++i) { for (i = 0; i < numConfigs; ++i) {
@ -2238,6 +2244,7 @@ CreateEGLSurfaceForXSurface(gfxASurface* aSurface, EGLConfig* aConfig)
} }
if (!surface) { if (!surface) {
NS_WARNING("Failed to CreatePixmapSurface!");
return nullptr; return nullptr;
} }
@ -2288,9 +2295,9 @@ GLContextEGL::CreateEGLPixmapOffscreenContext(const gfxIntSize& size)
GLContextEGL* shareContext = GetGlobalContextEGL(); GLContextEGL* shareContext = GetGlobalContextEGL();
SurfaceCaps dummyCaps = SurfaceCaps::Any(); SurfaceCaps dummyCaps = SurfaceCaps::Any();
nsRefPtr<GLContextEGL> glContext = nsRefPtr<GLContextEGL> glContext =
GLContextEGL::CreateGLContext(dummyCaps, GLContextEGL::CreateGLContext(dummyCaps,
shareContext, true, shareContext, true,
surface, config); config, surface);
if (!glContext) { if (!glContext) {
NS_WARNING("Failed to create GLContext from XSurface"); NS_WARNING("Failed to create GLContext from XSurface");
sEGLLibrary.fDestroySurface(EGL_DISPLAY(), surface); sEGLLibrary.fDestroySurface(EGL_DISPLAY(), surface);