summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/eglconvenience
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@nokia.com>2010-07-27 05:42:44 (GMT)
committerJørgen Lind <jorgen.lind@nokia.com>2010-07-27 07:58:07 (GMT)
commit4edb2026545574e287c3d71c272c02dec9134e89 (patch)
tree26932b2450f6fd54493bf38a07fb382184632e6c /src/plugins/platforms/eglconvenience
parentf3ae27721ad0e71923e8538370731f91acb53601 (diff)
downloadQt-4edb2026545574e287c3d71c272c02dec9134e89.zip
Qt-4edb2026545574e287c3d71c272c02dec9134e89.tar.gz
Qt-4edb2026545574e287c3d71c272c02dec9134e89.tar.bz2
Refactored the eglfs plugin
seperated the functionality into different files, and made the paintdevice belong to the windowsurface. Everything really belongs to the screen, since everything is full screen but, this makes it more on par with the other plugins.
Diffstat (limited to 'src/plugins/platforms/eglconvenience')
-rw-r--r--src/plugins/platforms/eglconvenience/qeglconvenience.cpp5
-rw-r--r--src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp47
2 files changed, 42 insertions, 10 deletions
diff --git a/src/plugins/platforms/eglconvenience/qeglconvenience.cpp b/src/plugins/platforms/eglconvenience/qeglconvenience.cpp
index 1064e47..c50101d 100644
--- a/src/plugins/platforms/eglconvenience/qeglconvenience.cpp
+++ b/src/plugins/platforms/eglconvenience/qeglconvenience.cpp
@@ -1,7 +1,5 @@
#include "qeglconvenience.h"
-#include <QtCore/QDebug>
-
QVector<EGLint> q_createConfigAttributesFromFormat(const QPlatformWindowFormat &format)
{
int redSize = format.redBufferSize();
@@ -178,7 +176,6 @@ EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QPlatformW
} else {
configureAttributes.append(EGL_OPENGL_ES2_BIT);
}
-
configureAttributes.append(EGL_NONE);
do {
@@ -228,6 +225,6 @@ EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QPlatformW
}
delete [] configs;
} while (q_reduceConfigAttributes(&configureAttributes));
- qDebug() << "RETURNING NULL!";
+ qWarning("Cant find EGLConfig, returning null config");
return 0;
}
diff --git a/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp b/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp
index 6afeb70..a72f7b2 100644
--- a/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp
+++ b/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp
@@ -43,7 +43,6 @@
#include <EGL/egl.h>
-#include <QtCore/QDebug>
#include <QtGui/QPlatformWindow>
QEGLPlatformContext::QEGLPlatformContext(EGLDisplay display, EGLConfig config, EGLint contextAttrs[], EGLSurface surface, EGLenum eglApi)
@@ -57,13 +56,18 @@ QEGLPlatformContext::QEGLPlatformContext(EGLDisplay display, EGLConfig config, E
eglBindAPI(m_eglApi);
m_eglContext = eglCreateContext(m_eglDisplay,config, 0,contextAttrs);
- if (!m_eglContext) {
- qErrnoWarning("QEGLPlatformContext could not create eglContext");
+ if (m_eglContext == EGL_NO_CONTEXT) {
+ qWarning("Could not create the egl context\n");
+ eglTerminate(m_eglDisplay);
+ qFatal("EGL error");
}
}
QEGLPlatformContext::~QEGLPlatformContext()
{
+#ifdef QEGL_EXTRA_DEBUG
+ qWarning("QEglContext::~QEglContext(): %p\n",this);
+#endif
if (m_eglSurface != EGL_NO_SURFACE) {
doneCurrent();
eglDestroySurface(m_eglDisplay, m_eglSurface);
@@ -78,27 +82,58 @@ QEGLPlatformContext::~QEGLPlatformContext()
void QEGLPlatformContext::makeCurrent()
{
+#ifdef QEGL_EXTRA_DEBUG
+ qWarning("QEglContext::makeCurrent: %p\n",this);
+#endif
eglBindAPI(m_eglApi);
bool ok = eglMakeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext);
if (!ok)
- qWarning() << "QEGLPlatformContext::makeCurrent(" << m_eglSurface << "):" << eglGetError();
+ qWarning("QEGLPlatformContext::makeCurrent: eglError: %d, this: %p \n", eglGetError(), this);
+#ifdef QEGL_EXTRA_DEBUG
+ static bool showDebug = true;
+ if (showDebug) {
+ showDebug = false;
+ const char *str = (const char*)glGetString(GL_VENDOR);
+ qWarning("Vendor %s\n", str);
+ str = (const char*)glGetString(GL_RENDERER);
+ qWarning("Renderer %s\n", str);
+ str = (const char*)glGetString(GL_VERSION);
+ qWarning("Version %s\n", str);
+
+ str = (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION);
+ qWarning("Extensions %s\n",str);
+
+ str = (const char*)glGetString(GL_EXTENSIONS);
+ qWarning("Extensions %s\n", str);
+
+ }
+#endif
}
void QEGLPlatformContext::doneCurrent()
{
+#ifdef QEGL_EXTRA_DEBUG
+ qWarning("QEglContext::doneCurrent:%p\n",this);
+#endif
eglBindAPI(m_eglApi);
bool ok = eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
if (!ok)
- qWarning() << "QEGLPlatformContext::doneCurrent():" << eglGetError();
+ qWarning("QEGLPlatformContext::doneCurrent(): eglError: %d, this: %p \n", eglGetError(), this);
}
void QEGLPlatformContext::swapBuffers()
{
+#ifdef QEGL_EXTRA_DEBUG
+ qWarning("QEglContext::swapBuffers:%p\n",this);
+#endif
eglBindAPI(m_eglApi);
bool ok = eglSwapBuffers(m_eglDisplay, m_eglSurface);
if (!ok)
- qWarning() << "QEGLPlatformContext::swapBuffers():" << eglGetError();
+ qWarning("QEGLPlatformContext::swapBuffers(): eglError: %d, this: %p \n", eglGetError(), this);
}
void* QEGLPlatformContext::getProcAddress(const QString& procName)
{
+#ifdef QEGL_EXTRA_DEBUG
+ qWarning("QEglContext::getProcAddress%p\n",this);
+#endif
eglBindAPI(m_eglApi);
return (void *)eglGetProcAddress(qPrintable(procName));
}