summaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/gui/kernel/qplatformscreen_qpa.h2
-rw-r--r--src/plugins/platforms/eglconvenience/qeglconvenience.cpp5
-rw-r--r--src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp47
-rw-r--r--src/plugins/platforms/eglfs/eglfs.pro17
-rw-r--r--src/plugins/platforms/eglfs/main.cpp2
-rw-r--r--src/plugins/platforms/eglfs/qeglfsintegration.cpp412
-rw-r--r--src/plugins/platforms/eglfs/qeglfsintegration.h13
-rw-r--r--src/plugins/platforms/eglfs/qeglfsscreen.cpp174
-rw-r--r--src/plugins/platforms/eglfs/qeglfsscreen.h75
-rw-r--r--src/plugins/platforms/eglfs/qeglfswindow.cpp83
-rw-r--r--src/plugins/platforms/eglfs/qeglfswindow.h69
-rw-r--r--src/plugins/platforms/eglfs/qeglfswindowsurface.cpp103
-rw-r--r--src/plugins/platforms/eglfs/qeglfswindowsurface.h66
13 files changed, 655 insertions, 413 deletions
diff --git a/src/gui/kernel/qplatformscreen_qpa.h b/src/gui/kernel/qplatformscreen_qpa.h
index 7d0e28d..f603db5 100644
--- a/src/gui/kernel/qplatformscreen_qpa.h
+++ b/src/gui/kernel/qplatformscreen_qpa.h
@@ -59,7 +59,7 @@ public:
virtual ~QPlatformScreen() { }
virtual QRect geometry() const = 0;
- virtual QRect availableGeometry() const {return geometry();};
+ virtual QRect availableGeometry() const {return geometry();}
virtual int depth() const = 0;
virtual QImage::Format format() const = 0;
virtual QSize physicalSize() const;
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));
}
diff --git a/src/plugins/platforms/eglfs/eglfs.pro b/src/plugins/platforms/eglfs/eglfs.pro
index 2cc5997..5d1318a 100644
--- a/src/plugins/platforms/eglfs/eglfs.pro
+++ b/src/plugins/platforms/eglfs/eglfs.pro
@@ -6,11 +6,24 @@ QT += opengl
QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms
+#DEFINES += QEGL_EXTRA_DEBUG
+
+#DEFINES += Q_OPENKODE
+
SOURCES = main.cpp \
qeglfsintegration.cpp \
- ../eglconvenience/qeglconvenience.cpp
+ ../eglconvenience/qeglconvenience.cpp \
+ ../eglconvenience/qeglplatformcontext.cpp \
+ qeglfswindow.cpp \
+ qeglfswindowsurface.cpp \
+ qeglfsscreen.cpp
+
HEADERS = qeglfsintegration.h \
- ../eglconvenience/qeglconvenience.h
+ ../eglconvenience/qeglconvenience.h \
+ ../eglconvenience/qeglplatformcontext.h \
+ qeglfswindow.h \
+ qeglfswindowsurface.h \
+ qeglfsscreen.h
target.path += $$[QT_INSTALL_PLUGINS]/platforms
INSTALLS += target
diff --git a/src/plugins/platforms/eglfs/main.cpp b/src/plugins/platforms/eglfs/main.cpp
index e1731e8..d0a82b7 100644
--- a/src/plugins/platforms/eglfs/main.cpp
+++ b/src/plugins/platforms/eglfs/main.cpp
@@ -62,7 +62,7 @@ QPlatformIntegration* QEglIntegrationPlugin::create(const QString& system, const
{
Q_UNUSED(paramList);
if (system.toLower() == "eglfs")
- return new QEglIntegration;
+ return new QEglFSIntegration;
return 0;
}
diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
index 4d17980..2b673ae 100644
--- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
@@ -41,429 +41,53 @@
#include "qeglfsintegration.h"
+#include "qeglfswindow.h"
+#include "qeglfswindowsurface.h"
+
#include <QtGui/QPlatformWindow>
-#include <QtOpenGL/private/qwindowsurface_gl_p.h>
+#include <QtGui/QPlatformWindowFormat>
#include <QtOpenGL/private/qpixmapdata_gl_p.h>
-#include <QtOpenGL/private/qpaintengine_opengl_p.h>
-#include <stdio.h>
#include <EGL/egl.h>
-#include <QDebug>
-#include <QWindowSystemInterface>
-
-#include "../eglconvenience/qeglconvenience.h"
-
-//#define QEGL_EXTRA_DEBUG
-#ifdef QEGL_EXTRA_DEBUG
-struct AttrInfo { EGLint attr; const char *name; };
-static struct AttrInfo attrs[] = {
- {EGL_BUFFER_SIZE, "EGL_BUFFER_SIZE"},
- {EGL_ALPHA_SIZE, "EGL_ALPHA_SIZE"},
- {EGL_BLUE_SIZE, "EGL_BLUE_SIZE"},
- {EGL_GREEN_SIZE, "EGL_GREEN_SIZE"},
- {EGL_RED_SIZE, "EGL_RED_SIZE"},
- {EGL_DEPTH_SIZE, "EGL_DEPTH_SIZE"},
- {EGL_STENCIL_SIZE, "EGL_STENCIL_SIZE"},
- {EGL_CONFIG_CAVEAT, "EGL_CONFIG_CAVEAT"},
- {EGL_CONFIG_ID, "EGL_CONFIG_ID"},
- {EGL_LEVEL, "EGL_LEVEL"},
- {EGL_MAX_PBUFFER_HEIGHT, "EGL_MAX_PBUFFER_HEIGHT"},
- {EGL_MAX_PBUFFER_PIXELS, "EGL_MAX_PBUFFER_PIXELS"},
- {EGL_MAX_PBUFFER_WIDTH, "EGL_MAX_PBUFFER_WIDTH"},
- {EGL_NATIVE_RENDERABLE, "EGL_NATIVE_RENDERABLE"},
- {EGL_NATIVE_VISUAL_ID, "EGL_NATIVE_VISUAL_ID"},
- {EGL_NATIVE_VISUAL_TYPE, "EGL_NATIVE_VISUAL_TYPE"},
- {EGL_SAMPLES, "EGL_SAMPLES"},
- {EGL_SAMPLE_BUFFERS, "EGL_SAMPLE_BUFFERS"},
- {EGL_SURFACE_TYPE, "EGL_SURFACE_TYPE"},
- {EGL_TRANSPARENT_TYPE, "EGL_TRANSPARENT_TYPE"},
- {EGL_TRANSPARENT_BLUE_VALUE, "EGL_TRANSPARENT_BLUE_VALUE"},
- {EGL_TRANSPARENT_GREEN_VALUE, "EGL_TRANSPARENT_GREEN_VALUE"},
- {EGL_TRANSPARENT_RED_VALUE, "EGL_TRANSPARENT_RED_VALUE"},
- {EGL_BIND_TO_TEXTURE_RGB, "EGL_BIND_TO_TEXTURE_RGB"},
- {EGL_BIND_TO_TEXTURE_RGBA, "EGL_BIND_TO_TEXTURE_RGBA"},
- {EGL_MIN_SWAP_INTERVAL, "EGL_MIN_SWAP_INTERVAL"},
- {EGL_MAX_SWAP_INTERVAL, "EGL_MAX_SWAP_INTERVAL"},
- {-1, 0}};
-#endif //QEGL_EXTRA_DEBUG
-
-
-class QEglScreen;
-
-class QEglContext : public QPlatformGLContext
-{
-public:
- QEglContext(QGLFormat& format, QPlatformGLContext* shareContext = 0);
- ~QEglContext();
-
- virtual void makeCurrent();
- virtual void doneCurrent();
- virtual void swapBuffers();
- virtual void* getProcAddress(const QString& procName);
-
- EGLContext eglContext() {return m_context;}
- QSize size() const { return m_size; }
-
- QGLFormat format() const { return m_format; }
-private:
-
- EGLContext m_context;
- EGLDisplay m_dpy;
- EGLSurface m_surface;
- QSize m_size;
- static bool singleton_watch;
- QGLFormat m_format;
-};
-
-bool QEglContext::singleton_watch = false;
-
-QEglContext::QEglContext(QGLFormat& format, QPlatformGLContext* shareContext)
-{
- if (singleton_watch)
- qFatal("There can be only one");
- singleton_watch = true;
-
- Q_UNUSED(shareContext);
- Q_UNUSED(format);
-
- EGLint major, minor;
-#ifdef QEGL_EXTRA_DEBUG
- EGLint index;
-#endif
- if (!eglBindAPI(EGL_OPENGL_ES_API)) {
- fprintf(stderr, "Could not bind GL_ES API\n");
- qFatal("EGL error");
- }
-
- m_dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- if (m_dpy == EGL_NO_DISPLAY) {
- fprintf(stderr, "Could not open egl display\n");
- qFatal("EGL error");
- }
- fprintf(stderr, "Opened display %p\n", m_dpy);
-
- if (!eglInitialize(m_dpy, &major, &minor)) {
- fprintf(stderr, "Could not initialize egl display\n");
- qFatal("EGL error");
- }
-
- fprintf(stderr, "Initialized display %d %d\n", major, minor);
-
- QPlatformWindowFormat platformFormat;
- platformFormat.setDepth(16);
- platformFormat.setWindowApi(QPlatformWindowFormat::OpenGL);
- platformFormat.setRedBufferSize(5);
- platformFormat.setGreenBufferSize(6);
- platformFormat.setBlueBufferSize(5);
- EGLConfig config = q_configFromQPlatformWindowFormat(m_dpy, platformFormat);
-
-#ifdef QEGL_EXTRA_DEBUG
- fprintf(stderr, "Configuration %d matches requirements\n", (int)config);
-
- for (index = 0; attrs[index].attr != -1; ++index) {
- EGLint value;
- if (eglGetConfigAttrib(m_dpy, config, attrs[index].attr, &value)) {
- printf("\t%s: %d\n", attrs[index].name, (int)value);
- }
- }
- printf("\n");
-#endif
- EGLint temp;
- EGLint attribList[32];
-
- temp = 0;
-
- attribList[temp++] = EGL_CONTEXT_CLIENT_VERSION;
- attribList[temp++] = 2; // GLES version 2
- attribList[temp++] = EGL_NONE;
-
-
- m_context = eglCreateContext(m_dpy, config, NULL, attribList);
- if (m_context == EGL_NO_CONTEXT) {
- fprintf(stderr, "Could not create the egl context\n");
- eglTerminate(m_dpy);
- qFatal("EGL error");
- }
-
- m_surface = eglCreateWindowSurface(m_dpy, config, 0, NULL);
- if (m_surface == EGL_NO_SURFACE) {
- fprintf(stderr, "Could not create the egl surface: error = 0x%x\n", eglGetError());
- eglTerminate(m_dpy);
- qFatal("EGL error");
- }
-
- EGLint w,h;
-
- eglQuerySurface(m_dpy, m_surface, EGL_WIDTH, &w);
- eglQuerySurface(m_dpy, m_surface, EGL_HEIGHT, &h);
- fprintf(stderr, "Created surface %dx%d\n", w, h);
-
- m_size = QSize(w,h);
+QT_BEGIN_NAMESPACE
-}
-
-QEglContext::~QEglContext()
-{
-#ifdef QEGL_EXTRA_DEBUG
- qDebug() << "QEglContext::~QEglContext()";
-#endif
-}
-
-void QEglContext::makeCurrent()
-{
-#ifdef QEGL_EXTRA_DEBUG
- fprintf(stderr, "QEglContext::makeCurrent\n");
-#endif
- if (!eglMakeCurrent(m_dpy, m_surface, m_surface, m_context))
- fprintf(stderr, "Could not make the egl context current\n");
-
-#ifdef QEGL_EXTRA_DEBUG
- static bool showDebug = true;
- if (showDebug) {
- showDebug = false;
- const char *str = (const char*)glGetString(GL_VENDOR);
- qDebug() << "Vendor" << str;
- printf("Vendor %s\n", str);
- str = (const char*)glGetString(GL_RENDERER);
- qDebug() << "Renderer" << str;
- printf("Renderer %s\n", str);
- str = (const char*)glGetString(GL_VERSION);
- qDebug() << "Version" << str;
- printf("Version %s\n", str);
-
- str = (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION);
- qDebug() << "Shader version" << str;
-
- str = (const char*)glGetString(GL_EXTENSIONS);
- qDebug() << "Extensions" << str;
- printf("Extensions %s\n", str);
-
- }
-#endif
-}
-
-void QEglContext::doneCurrent()
+QEglFSIntegration::QEglFSIntegration()
{
-#ifdef QEGL_EXTRA_DEBUG
- fprintf(stderr, "QEglContext::doneCurrent\n");
-#endif
- if (!eglMakeCurrent(m_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT))
- fprintf(stderr, "Could not release the egl context\n");
-}
-
-void QEglContext::swapBuffers()
-{
-#ifdef QEGL_EXTRA_DEBUG
- fprintf(stderr, "QEglContext::swapBuffers\n");
-#endif
- eglSwapBuffers(m_dpy, m_surface);
-}
-
-void* QEglContext::getProcAddress(const QString& procName)
-{
-#ifdef QEGL_EXTRA_DEBUG
- fprintf(stderr, "QEglContext::getProcAddress\n");
-#endif
- return (void*)eglGetProcAddress(qPrintable(procName));
-}
-
-
-class QEglPaintDevice;
-class QEglScreen : public QPlatformScreen
-{
-public:
- QEglScreen();
- ~QEglScreen() {}
-
- QRect geometry() const { return m_geometry; }
- int depth() const { return m_depth; }
- QImage::Format format() const { return m_format; }
- //QSize physicalSize() const { return m_physicalSize; } //###
-
-public:
- QRect m_geometry;
- int m_depth;
- QImage::Format m_format;
- //QSize m_physicalSize;
- QEglContext * m_platformContext;
-};
-
-
-class QEglWindow : public QPlatformWindow
-{
-public:
- QEglWindow(QWidget *w, QEglScreen *screen);
- QPlatformGLContext *glContext();
-
- void setGeometry(const QRect &);
- WId winId() const;
-
- QGLContext *context() { return m_context; }
- QEglPaintDevice *paintDevice() { return m_pd; }
-private:
- QEglScreen *m_screen;
- QEglPaintDevice *m_pd;
- QGLContext *m_context;
- WId m_winid;
-};
-
-class QEglPaintDevice : public QGLPaintDevice
-{
-public:
- QEglPaintDevice(QEglScreen *screen, QEglWindow *window);
-
- QSize size() const { return m_screen->geometry().size(); }
- QGLContext* context() const { return m_window->context();}
-
- QPaintEngine *paintEngine() const { return qt_qgl_paint_engine(); }
-
- void beginPaint(){
- QGLPaintDevice::beginPaint();
- }
-private:
- QEglScreen *m_screen;
- QEglWindow * m_window;
-};
-
-
-
-
-QEglScreen::QEglScreen()
- : m_depth(16), m_format(QImage::Format_RGB16), m_platformContext(0)
-{
-#ifdef QEGL_EXTRA_DEBUG
- fprintf(stderr, "QEglScreen %p\n", this);
-#endif
- QGLFormat format = QGLFormat::defaultFormat();
- m_platformContext = new QEglContext(format);
-
-
- m_geometry = QRect(QPoint(), m_platformContext->size());
-
-}
-
-
-
-
-QEglPaintDevice::QEglPaintDevice(QEglScreen *screen, QEglWindow *window)
- :QGLPaintDevice(), m_screen(screen), m_window(window)
-{
-#ifdef QEGL_EXTRA_DEBUG
- qDebug() << "QEglPaintDevice" << this << screen << window;
-#endif
-}
-
-
-
-QEglWindow::QEglWindow(QWidget *w, QEglScreen *screen)
- : QPlatformWindow(w), m_screen(screen), m_pd(0), m_context(0)
-{
- static int serialNo = 0;
- m_winid = ++serialNo;
-#ifdef QEGL_EXTRA_DEBUG
- fprintf(stderr, "QEglWindow %p: %p %p 0x%x\n", this, w, screen, uint(m_winid));
-#endif
- m_pd = new QEglPaintDevice(screen, this);
- m_context = new QGLContext( screen->m_platformContext->format(), w);
- m_context->create();
-}
-
-
-void QEglWindow::setGeometry(const QRect &)
-{
- // We only support full-screen windows
- QRect rect(m_screen->availableGeometry());
- QWindowSystemInterface::handleGeometryChange(this->widget(), rect);
-
- QPlatformWindow::setGeometry(rect);
-}
-
-WId QEglWindow::winId() const
-{
- return m_winid;
-}
-
-
-
-QPlatformGLContext *QEglWindow::glContext()
-{
-#ifdef QEGL_EXTRA_DEBUG
- fprintf(stderr, "QEglWindow::glContext %p\n", m_screen->m_platformContext);
-#endif
- Q_ASSERT(m_screen);
- return m_screen->m_platformContext;
-}
-
-QEglIntegration::QEglIntegration()
-{
- m_primaryScreen = new QEglScreen();
+ m_primaryScreen = new QEglFSScreen(EGL_DEFAULT_DISPLAY);
mScreens.append(m_primaryScreen);
#ifdef QEGL_EXTRA_DEBUG
- fprintf(stderr, "QEglIntegration\n");
+ qWarning("QEglIntegration\n");
#endif
}
-QPixmapData *QEglIntegration::createPixmapData(QPixmapData::PixelType type) const
+QPixmapData *QEglFSIntegration::createPixmapData(QPixmapData::PixelType type) const
{
#ifdef QEGL_EXTRA_DEBUG
- fprintf(stderr, "QEglIntegration::createPixmapData %d\n", type);
+ qWarning("QEglIntegration::createPixmapData %d\n", type);
#endif
return new QGLPixmapData(type);
}
-QPlatformWindow *QEglIntegration::createPlatformWindow(QWidget *widget, WId winId) const
+QPlatformWindow *QEglFSIntegration::createPlatformWindow(QWidget *widget, WId winId) const
{
Q_UNUSED(winId);
#ifdef QEGL_EXTRA_DEBUG
- qDebug() << "QEglIntegration::createPlatformWindow" << widget;
+ qWarning("QEglIntegration::createPlatformWindow %p\n",widget);
#endif
- return new QEglWindow(widget, m_primaryScreen);
+ return new QEglFSWindow(widget, m_primaryScreen);
}
-class QEglWindowSurface : public QWindowSurface
-{
-public:
- QEglWindowSurface(QWidget *window, QEglScreen *screen);
- ~QEglWindowSurface() {}
-
- QPaintDevice *paintDevice() { return m_window->paintDevice(); }
- void flush(QWidget *widget, const QRegion &region, const QPoint &offset);
- void resize(const QSize &size) {}
-private:
- QEglScreen *m_screen;
- QEglWindow *m_window;
-};
-
-QEglWindowSurface::QEglWindowSurface(QWidget *window, QEglScreen *screen)
- :QWindowSurface(window), m_screen(screen), m_window(0)
-{
-#ifdef QEGL_EXTRA_DEBUG
- qDebug() << "QEglWindowSurface" << window << screen;
-#endif
- m_window = static_cast<QEglWindow*>(window->platformWindow());
-}
-
-
-void QEglWindowSurface::flush(QWidget *widget, const QRegion &region, const QPoint &offset)
-{
- Q_UNUSED(widget);
- Q_UNUSED(region);
- Q_UNUSED(offset);
-#ifdef QEGL_EXTRA_DEBUG
- qDebug() << "QEglWindowSurface::flush";
-#endif
- m_screen->m_platformContext->swapBuffers();
-}
-
-QWindowSurface *QEglIntegration::createWindowSurface(QWidget *widget, WId winId) const
+QWindowSurface *QEglFSIntegration::createWindowSurface(QWidget *widget, WId winId) const
{
Q_UNUSED(winId);
#ifdef QEGL_EXTRA_DEBUG
- qDebug() << "QEglIntegration::createWindowSurface" << widget;
+ qWarning("QEglIntegration::createWindowSurface %p\n",widget);
#endif
- return new QEglWindowSurface(widget, m_primaryScreen);
+ return new QEglFSWindowSurface(m_primaryScreen,widget);
}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.h b/src/plugins/platforms/eglfs/qeglfsintegration.h
index 7b9b8cf..f15b6b2 100644
--- a/src/plugins/platforms/eglfs/qeglfsintegration.h
+++ b/src/plugins/platforms/eglfs/qeglfsintegration.h
@@ -42,16 +42,19 @@
#ifndef EGLINTEGRATION_H
#define EGLINTEGRATION_H
+#include "qeglfsscreen.h"
+
#include <QtGui/QPlatformIntegration>
#include <QtGui/QPlatformScreen>
+QT_BEGIN_HEADER
+
QT_BEGIN_NAMESPACE
-class QEglScreen;
-class QEglIntegration : public QPlatformIntegration
+class QEglFSIntegration : public QPlatformIntegration
{
public:
- QEglIntegration();
+ QEglFSIntegration();
QPixmapData *createPixmapData(QPixmapData::PixelType type) const;
QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const;
@@ -61,10 +64,10 @@ public:
private:
QList<QPlatformScreen *> mScreens;
- QEglScreen *m_primaryScreen;
+ QEglFSScreen *m_primaryScreen;
};
QT_END_NAMESPACE
-
+QT_END_HEADER
#endif
diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/qeglfsscreen.cpp
new file mode 100644
index 0000000..a390106
--- /dev/null
+++ b/src/plugins/platforms/eglfs/qeglfsscreen.cpp
@@ -0,0 +1,174 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtOpenVG module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "qeglfsscreen.h"
+
+#include "../eglconvenience/qeglconvenience.h"
+#include "../eglconvenience/qeglplatformcontext.h"
+
+#ifdef Q_OPENKODE
+#include <KD/kd.h>
+#include <KD/NV_initialize.h>
+#endif //Q_OPENKODE
+
+QT_BEGIN_NAMESPACE
+
+#ifdef QEGL_EXTRA_DEBUG
+struct AttrInfo { EGLint attr; const char *name; };
+static struct AttrInfo attrs[] = {
+ {EGL_BUFFER_SIZE, "EGL_BUFFER_SIZE"},
+ {EGL_ALPHA_SIZE, "EGL_ALPHA_SIZE"},
+ {EGL_BLUE_SIZE, "EGL_BLUE_SIZE"},
+ {EGL_GREEN_SIZE, "EGL_GREEN_SIZE"},
+ {EGL_RED_SIZE, "EGL_RED_SIZE"},
+ {EGL_DEPTH_SIZE, "EGL_DEPTH_SIZE"},
+ {EGL_STENCIL_SIZE, "EGL_STENCIL_SIZE"},
+ {EGL_CONFIG_CAVEAT, "EGL_CONFIG_CAVEAT"},
+ {EGL_CONFIG_ID, "EGL_CONFIG_ID"},
+ {EGL_LEVEL, "EGL_LEVEL"},
+ {EGL_MAX_PBUFFER_HEIGHT, "EGL_MAX_PBUFFER_HEIGHT"},
+ {EGL_MAX_PBUFFER_PIXELS, "EGL_MAX_PBUFFER_PIXELS"},
+ {EGL_MAX_PBUFFER_WIDTH, "EGL_MAX_PBUFFER_WIDTH"},
+ {EGL_NATIVE_RENDERABLE, "EGL_NATIVE_RENDERABLE"},
+ {EGL_NATIVE_VISUAL_ID, "EGL_NATIVE_VISUAL_ID"},
+ {EGL_NATIVE_VISUAL_TYPE, "EGL_NATIVE_VISUAL_TYPE"},
+ {EGL_SAMPLES, "EGL_SAMPLES"},
+ {EGL_SAMPLE_BUFFERS, "EGL_SAMPLE_BUFFERS"},
+ {EGL_SURFACE_TYPE, "EGL_SURFACE_TYPE"},
+ {EGL_TRANSPARENT_TYPE, "EGL_TRANSPARENT_TYPE"},
+ {EGL_TRANSPARENT_BLUE_VALUE, "EGL_TRANSPARENT_BLUE_VALUE"},
+ {EGL_TRANSPARENT_GREEN_VALUE, "EGL_TRANSPARENT_GREEN_VALUE"},
+ {EGL_TRANSPARENT_RED_VALUE, "EGL_TRANSPARENT_RED_VALUE"},
+ {EGL_BIND_TO_TEXTURE_RGB, "EGL_BIND_TO_TEXTURE_RGB"},
+ {EGL_BIND_TO_TEXTURE_RGBA, "EGL_BIND_TO_TEXTURE_RGBA"},
+ {EGL_MIN_SWAP_INTERVAL, "EGL_MIN_SWAP_INTERVAL"},
+ {EGL_MAX_SWAP_INTERVAL, "EGL_MAX_SWAP_INTERVAL"},
+ {-1, 0}};
+#endif //QEGL_EXTRA_DEBUG
+
+QEglFSScreen::QEglFSScreen(EGLNativeDisplayType display)
+ : m_depth(16), m_format(QImage::Format_RGB16), m_platformContext(0)
+{
+#ifdef QEGL_EXTRA_DEBUG
+ qWarning("QEglScreen %p\n", this);
+#endif
+
+ EGLint major, minor;
+#ifdef QEGL_EXTRA_DEBUG
+ EGLint index;
+#endif
+ if (!eglBindAPI(EGL_OPENGL_ES_API)) {
+ qWarning("Could not bind GL_ES API\n");
+ qFatal("EGL error");
+ }
+
+ m_dpy = eglGetDisplay(display);
+ if (m_dpy == EGL_NO_DISPLAY) {
+ qWarning("Could not open egl display\n");
+ qFatal("EGL error");
+ }
+ qWarning("Opened display %p\n", m_dpy);
+
+ if (!eglInitialize(m_dpy, &major, &minor)) {
+ qWarning("Could not initialize egl display\n");
+ qFatal("EGL error");
+ }
+
+ qWarning("Initialized display %d %d\n", major, minor);
+
+ QPlatformWindowFormat platformFormat;
+ platformFormat.setDepth(16);
+ platformFormat.setWindowApi(QPlatformWindowFormat::OpenGL);
+ platformFormat.setRedBufferSize(8);
+ platformFormat.setGreenBufferSize(8);
+ platformFormat.setBlueBufferSize(8);
+ EGLConfig config = q_configFromQPlatformWindowFormat(m_dpy, platformFormat);
+
+ EGLNativeWindowType eglWindow = 0;
+#ifdef Q_OPENKODE
+ if (kdInitializeNV() == KD_ENOTINITIALIZED) {
+ qFatal("Did not manage to initialize openkode");
+ }
+ KDWindow *window = kdCreateWindow(m_dpy,config,0);
+
+ kdRealizeWindow(window,&eglWindow);
+#endif
+
+ m_surface = eglCreateWindowSurface(m_dpy, config, eglWindow, NULL);
+ if (m_surface == EGL_NO_SURFACE) {
+ qWarning("Could not create the egl surface: error = 0x%x\n", eglGetError());
+ eglTerminate(m_dpy);
+ qFatal("EGL error");
+ }
+ // qWarning("Created surface %dx%d\n", w, h);
+
+#ifdef QEGL_EXTRA_DEBUG
+ qWarning("Configuration %d matches requirements\n", (int)config);
+
+ for (index = 0; attrs[index].attr != -1; ++index) {
+ EGLint value;
+ if (eglGetConfigAttrib(m_dpy, config, attrs[index].attr, &value)) {
+ qWarning("\t%s: %d\n", attrs[index].name, (int)value);
+ }
+ }
+ qWarning("\n");
+#endif
+
+ EGLint temp;
+ EGLint attribList[32];
+
+ temp = 0;
+
+ attribList[temp++] = EGL_CONTEXT_CLIENT_VERSION;
+ attribList[temp++] = 2; // GLES version 2
+ attribList[temp++] = EGL_NONE;
+
+ m_platformContext = new QEGLPlatformContext(m_dpy,config,attribList,m_surface,EGL_OPENGL_ES_API);
+
+// qWarning("Created platformcontext");
+ EGLint w,h;
+
+ eglQuerySurface(m_dpy, m_surface, EGL_WIDTH, &w);
+ eglQuerySurface(m_dpy, m_surface, EGL_HEIGHT, &h);
+
+ m_geometry = QRect(0,0,w,h);
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.h b/src/plugins/platforms/eglfs/qeglfsscreen.h
new file mode 100644
index 0000000..f68ab14
--- /dev/null
+++ b/src/plugins/platforms/eglfs/qeglfsscreen.h
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtOpenVG module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QEGLSCREEN_H
+#define QEGLSCREEN_H
+
+#include <QPlatformScreen>
+
+
+#include <EGL/egl.h>
+
+QT_BEGIN_NAMESPACE
+
+class QPlatformGLContext;
+
+class QEglFSScreen : public QPlatformScreen //huh: FullScreenScreen ;) just to follow namespace
+{
+public:
+ QEglFSScreen(EGLNativeDisplayType display);
+ ~QEglFSScreen() {}
+
+ QRect geometry() const { return m_geometry; }
+ int depth() const { return m_depth; }
+ QImage::Format format() const { return m_format; }
+
+ QPlatformGLContext *platformContext() const { return m_platformContext; }
+
+private:
+ QRect m_geometry;
+ int m_depth;
+ QImage::Format m_format;
+ QPlatformGLContext *m_platformContext;
+ EGLDisplay m_dpy;
+ EGLSurface m_surface;
+};
+
+QT_END_NAMESPACE
+#endif // QEGLSCREEN_H
diff --git a/src/plugins/platforms/eglfs/qeglfswindow.cpp b/src/plugins/platforms/eglfs/qeglfswindow.cpp
new file mode 100644
index 0000000..db15862
--- /dev/null
+++ b/src/plugins/platforms/eglfs/qeglfswindow.cpp
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtOpenVG module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "qeglfswindow.h"
+
+#include <QtGui/QWindowSystemInterface>
+
+QT_BEGIN_NAMESPACE
+
+QEglFSWindow::QEglFSWindow(QWidget *w, QEglFSScreen *screen)
+ : QPlatformWindow(w), m_screen(screen)
+{
+ static int serialNo = 0;
+ m_winid = ++serialNo;
+#ifdef QEGL_EXTRA_DEBUG
+ qWarning("QEglWindow %p: %p %p 0x%x\n", this, w, screen, uint(m_winid));
+#endif
+}
+
+
+void QEglFSWindow::setGeometry(const QRect &)
+{
+ // We only support full-screen windows
+ QRect rect(m_screen->availableGeometry());
+ QWindowSystemInterface::handleGeometryChange(this->widget(), rect);
+
+ QPlatformWindow::setGeometry(rect);
+}
+
+WId QEglFSWindow::winId() const
+{
+ return m_winid;
+}
+
+
+
+QPlatformGLContext *QEglFSWindow::glContext()
+{
+#ifdef QEGL_EXTRA_DEBUG
+ qWarning("QEglWindow::glContext %p\n", m_screen->platformContext());
+#endif
+ Q_ASSERT(m_screen);
+ return m_screen->platformContext();
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfswindow.h b/src/plugins/platforms/eglfs/qeglfswindow.h
new file mode 100644
index 0000000..f605cf4
--- /dev/null
+++ b/src/plugins/platforms/eglfs/qeglfswindow.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtOpenVG module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QEGLWINDOW_H
+#define QEGLWINDOW_H
+
+#include "qeglfsintegration.h"
+#include "qeglfsscreen.h"
+
+
+#include <QPlatformWindow>
+#include <QtGui/QWidget>
+
+#include <EGL/egl.h>
+
+QT_BEGIN_NAMESPACE
+
+class QEglFSWindow : public QPlatformWindow
+{
+public:
+ QEglFSWindow(QWidget *w, QEglFSScreen *screen);
+ QPlatformGLContext *glContext();
+
+ void setGeometry(const QRect &);
+ WId winId() const;
+
+private:
+ QEglFSScreen *m_screen;
+ WId m_winid;
+};
+QT_END_NAMESPACE
+#endif // QEGLWINDOW_H
diff --git a/src/plugins/platforms/eglfs/qeglfswindowsurface.cpp b/src/plugins/platforms/eglfs/qeglfswindowsurface.cpp
new file mode 100644
index 0000000..a613dda
--- /dev/null
+++ b/src/plugins/platforms/eglfs/qeglfswindowsurface.cpp
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtOpenVG module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "qeglfswindowsurface.h"
+
+#include <QtGui/QPlatformGLContext>
+
+#include <QtOpenGL/private/qgl_p.h>
+#include <QtOpenGL/private/qglpaintdevice_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QEglFSPaintDevice : public QGLPaintDevice
+{
+public:
+ QEglFSPaintDevice(QEglFSScreen *screen, QWidget *widget)
+ :QGLPaintDevice(), m_screen(screen)
+ {
+ #ifdef QEGL_EXTRA_DEBUG
+ qWarning("QEglPaintDevice %p, %p, %p",this, screen, widget);
+ #endif
+ QGLFormat format;
+ m_context = new QGLContext(format, widget);
+ m_context->create();
+ }
+
+ QSize size() const { return m_screen->geometry().size(); }
+ QGLContext* context() const { return m_context;}
+
+ QPaintEngine *paintEngine() const { return qt_qgl_paint_engine(); }
+
+ void beginPaint(){
+ QGLPaintDevice::beginPaint();
+ }
+private:
+ QEglFSScreen *m_screen;
+ QGLContext *m_context;
+};
+
+
+QEglFSWindowSurface::QEglFSWindowSurface( QEglFSScreen *screen, QWidget *window )
+ :QWindowSurface(window)
+{
+#ifdef QEGL_EXTRA_DEBUG
+ qWarning("QEglWindowSurface %p, %p", window, screen);
+#endif
+ m_paintDevice = new QEglFSPaintDevice(screen,window);
+}
+
+void QEglFSWindowSurface::flush(QWidget *widget, const QRegion &region, const QPoint &offset)
+{
+ Q_UNUSED(widget);
+ Q_UNUSED(region);
+ Q_UNUSED(offset);
+#ifdef QEGL_EXTRA_DEBUG
+ qWarning("QEglWindowSurface::flush %p",widget);
+#endif
+ widget->platformWindow()->glContext()->swapBuffers();
+}
+
+void QEglFSWindowSurface::resize(const QSize &size)
+{
+ Q_UNUSED(size);
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfswindowsurface.h b/src/plugins/platforms/eglfs/qeglfswindowsurface.h
new file mode 100644
index 0000000..571b9bd
--- /dev/null
+++ b/src/plugins/platforms/eglfs/qeglfswindowsurface.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtOpenVG module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QEGLWINDOWSURFACE_H
+#define QEGLWINDOWSURFACE_H
+
+#include "qeglfsintegration.h"
+#include "qeglfswindow.h"
+
+#include <QtGui/private/qwindowsurface_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QEglFSWindowSurface : public QWindowSurface
+{
+public:
+ QEglFSWindowSurface(QEglFSScreen *screen, QWidget *window);
+ ~QEglFSWindowSurface() {}
+
+ QPaintDevice *paintDevice() { return m_paintDevice; }
+ void flush(QWidget *widget, const QRegion &region, const QPoint &offset);
+ void resize(const QSize &size);
+private:
+ QPaintDevice *m_paintDevice;
+};
+
+QT_END_NAMESPACE
+
+#endif // QEGLWINDOWSURFACE_H