summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@nokia.com>2011-03-24 08:57:38 (GMT)
committerJørgen Lind <jorgen.lind@nokia.com>2011-03-24 08:58:16 (GMT)
commitbbdc68b95bcec6e1a369df6b99df8ea499284d21 (patch)
treedf86ab8fdb0b88043af3a068e9c239da5ae6dfff
parent8debf8fb8bc18dc4b125aa7ac1ee4980f5ac146c (diff)
downloadQt-bbdc68b95bcec6e1a369df6b99df8ea499284d21.zip
Qt-bbdc68b95bcec6e1a369df6b99df8ea499284d21.tar.gz
Qt-bbdc68b95bcec6e1a369df6b99df8ea499284d21.tar.bz2
Lighthouse: Wayland. Added glx backend for gl integration
-rw-r--r--src/plugins/platforms/glxconvenience/glxconvenience.pri7
-rw-r--r--src/plugins/platforms/glxconvenience/qglxconvenience.cpp202
-rw-r--r--src/plugins/platforms/glxconvenience/qglxconvenience.h15
-rw-r--r--src/plugins/platforms/wayland/gl_integration/gl_integration.pri4
-rw-r--r--src/plugins/platforms/wayland/gl_integration/qwaylandglwindowsurface.cpp3
-rw-r--r--src/plugins/platforms/wayland/gl_integration/xpixmap_egl/qwaylandxpixmapwindow.cpp4
-rw-r--r--src/plugins/platforms/wayland/gl_integration/xpixmap_egl/qwaylandxpixmapwindow.h2
-rw-r--r--src/plugins/platforms/wayland/gl_integration/xpixmap_glx/qwaylandxpixmapglxcontext.cpp98
-rw-r--r--src/plugins/platforms/wayland/gl_integration/xpixmap_glx/qwaylandxpixmapglxcontext.h38
-rw-r--r--src/plugins/platforms/wayland/gl_integration/xpixmap_glx/qwaylandxpixmapglxintegration.cpp53
-rw-r--r--src/plugins/platforms/wayland/gl_integration/xpixmap_glx/qwaylandxpixmapglxintegration.h39
-rw-r--r--src/plugins/platforms/wayland/gl_integration/xpixmap_glx/qwaylandxpixmapglxwindow.cpp32
-rw-r--r--src/plugins/platforms/wayland/gl_integration/xpixmap_glx/qwaylandxpixmapglxwindow.h24
-rw-r--r--src/plugins/platforms/wayland/gl_integration/xpixmap_glx/xpixmap_glx.pri10
-rw-r--r--src/plugins/platforms/wayland/wayland.pro12
15 files changed, 533 insertions, 10 deletions
diff --git a/src/plugins/platforms/glxconvenience/glxconvenience.pri b/src/plugins/platforms/glxconvenience/glxconvenience.pri
new file mode 100644
index 0000000..5734ff7
--- /dev/null
+++ b/src/plugins/platforms/glxconvenience/glxconvenience.pri
@@ -0,0 +1,7 @@
+INCLUDEPATH = $$PWD
+
+HEADERS += \
+ $$PWD/qglxconvenience.h
+
+SOURCES += \
+ $$PWD/qglxconvenience.cpp
diff --git a/src/plugins/platforms/glxconvenience/qglxconvenience.cpp b/src/plugins/platforms/glxconvenience/qglxconvenience.cpp
new file mode 100644
index 0000000..5088691
--- /dev/null
+++ b/src/plugins/platforms/glxconvenience/qglxconvenience.cpp
@@ -0,0 +1,202 @@
+#include "qglxconvenience.h"
+
+#include <QtCore/QVector>
+
+enum {
+ XFocusOut = FocusOut,
+ XFocusIn = FocusIn,
+ XKeyPress = KeyPress,
+ XKeyRelease = KeyRelease,
+ XNone = None,
+ XRevertToParent = RevertToParent,
+ XGrayScale = GrayScale,
+ XCursorShape = CursorShape
+};
+#undef FocusOut
+#undef FocusIn
+#undef KeyPress
+#undef KeyRelease
+#undef None
+#undef RevertToParent
+#undef GrayScale
+#undef CursorShape
+
+#ifdef FontChange
+#undef FontChange
+#endif
+
+QVector<int> buildSpec(const QPlatformWindowFormat &format)
+{
+ QVector<int> spec(48);
+ int i = 0;
+
+ spec[i++] = GLX_LEVEL;
+ spec[i++] = 0;
+ spec[i++] = GLX_DRAWABLE_TYPE; spec[i++] = GLX_WINDOW_BIT;
+
+ if (format.rgba()) {
+ spec[i++] = GLX_RENDER_TYPE; spec[i++] = GLX_RGBA_BIT;
+ spec[i++] = GLX_RED_SIZE; spec[i++] = (format.redBufferSize() == -1) ? 1 : format.redBufferSize();
+ spec[i++] = GLX_GREEN_SIZE; spec[i++] = (format.greenBufferSize() == -1) ? 1 : format.greenBufferSize();
+ spec[i++] = GLX_BLUE_SIZE; spec[i++] = (format.blueBufferSize() == -1) ? 1 : format.blueBufferSize();
+ if (format.alpha()) {
+ spec[i++] = GLX_ALPHA_SIZE; spec[i++] = (format.alphaBufferSize() == -1) ? 1 : format.alphaBufferSize();
+ }
+
+ spec[i++] = GLX_ACCUM_RED_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize();
+ spec[i++] = GLX_ACCUM_GREEN_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize();
+ spec[i++] = GLX_ACCUM_BLUE_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize();
+
+ if (format.alpha()) {
+ spec[i++] = GLX_ACCUM_ALPHA_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize();
+ }
+
+ } else {
+ spec[i++] = GLX_RENDER_TYPE; spec[i++] = GLX_COLOR_INDEX_BIT; //I'm really not sure if this works....
+ spec[i++] = GLX_BUFFER_SIZE; spec[i++] = 8;
+ }
+
+ spec[i++] = GLX_DOUBLEBUFFER; spec[i++] = format.doubleBuffer() ? True : False;
+ spec[i++] = GLX_STEREO; spec[i++] = format.stereo() ? True : False;
+
+ if (format.depth()) {
+ spec[i++] = GLX_DEPTH_SIZE; spec[i++] = (format.depthBufferSize() == -1) ? 1 : format.depthBufferSize();
+ }
+
+ if (format.stencil()) {
+ spec[i++] = GLX_STENCIL_SIZE; spec[i++] = (format.stencilBufferSize() == -1) ? 1 : format.stencilBufferSize();
+ }
+ if (format.sampleBuffers()) {
+ spec[i++] = GLX_SAMPLE_BUFFERS_ARB;
+ spec[i++] = 1;
+ spec[i++] = GLX_SAMPLES_ARB;
+ spec[i++] = format.samples() == -1 ? 4 : format.samples();
+ }
+
+ spec[i++] = XNone;
+ return spec;
+}
+
+GLXFBConfig findConfig(Display *display, int screen , const QPlatformWindowFormat &format)
+{
+ bool reduced = true;
+ GLXFBConfig chosenConfig = 0;
+ QPlatformWindowFormat reducedFormat = format;
+ while (!chosenConfig && reduced) {
+ QVector<int> spec = buildSpec(reducedFormat);
+ int confcount = 0;
+ GLXFBConfig *configs;
+ configs = glXChooseFBConfig(display, screen,spec.constData(),&confcount);
+ if (confcount)
+ {
+ for (int i = 0; i < confcount; i++) {
+ chosenConfig = configs[i];
+ // Make sure we try to get an ARGB visual if the format asked for an alpha:
+ if (reducedFormat.alpha()) {
+ int alphaSize;
+ glXGetFBConfigAttrib(display,configs[i],GLX_ALPHA_SIZE,&alphaSize);
+ if (alphaSize > 0)
+ break;
+ } else {
+ break; // Just choose the first in the list if there's no alpha requested
+ }
+ }
+
+ XFree(configs);
+ }
+ reducedFormat = reducePlatformWindowFormat(reducedFormat,&reduced);
+ }
+
+ if (!chosenConfig)
+ qWarning("Warning no context created");
+
+ return chosenConfig;
+}
+
+XVisualInfo *findVisualInfo(Display *display, int screen, const QPlatformWindowFormat &format)
+{
+ GLXFBConfig config = findConfig(display,screen,format);
+ XVisualInfo *visualInfo = glXGetVisualFromFBConfig(display,config);
+ return visualInfo;
+}
+
+QPlatformWindowFormat platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext ctx)
+{
+ QPlatformWindowFormat format;
+ int redSize = 0;
+ int greenSize = 0;
+ int blueSize = 0;
+ int alphaSize = 0;
+ int depthSize = 0;
+ int stencilSize = 0;
+ int sampleBuffers = 0;
+ int sampleCount = 0;
+ int level = 0;
+ int rgba = 0;
+ int stereo = 0;
+ int accumSizeA = 0;
+ int accumSizeR = 0;
+ int accumSizeG = 0;
+ int accumSizeB = 0;
+
+ XVisualInfo *vi = glXGetVisualFromFBConfig(display,config);
+ glXGetConfig(display,vi,GLX_RGBA,&rgba);
+ XFree(vi);
+ glXGetFBConfigAttrib(display, config, GLX_RED_SIZE, &redSize);
+ glXGetFBConfigAttrib(display, config, GLX_GREEN_SIZE, &greenSize);
+ glXGetFBConfigAttrib(display, config, GLX_BLUE_SIZE, &blueSize);
+ glXGetFBConfigAttrib(display, config, GLX_ALPHA_SIZE, &alphaSize);
+ glXGetFBConfigAttrib(display, config, GLX_DEPTH_SIZE, &depthSize);
+ glXGetFBConfigAttrib(display, config, GLX_STENCIL_SIZE, &stencilSize);
+ glXGetFBConfigAttrib(display, config, GLX_SAMPLES, &sampleBuffers);
+ glXGetFBConfigAttrib(display, config, GLX_LEVEL, &level);
+ glXGetFBConfigAttrib(display, config, GLX_STEREO, &stereo);
+ glXGetFBConfigAttrib(display, config, GLX_ACCUM_ALPHA_SIZE, &accumSizeA);
+ glXGetFBConfigAttrib(display, config, GLX_ACCUM_RED_SIZE, &accumSizeR);
+ glXGetFBConfigAttrib(display, config, GLX_ACCUM_GREEN_SIZE, &accumSizeG);
+ glXGetFBConfigAttrib(display, config, GLX_ACCUM_BLUE_SIZE, &accumSizeB);
+
+ format.setRedBufferSize(redSize);
+ format.setGreenBufferSize(greenSize);
+ format.setBlueBufferSize(blueSize);
+ format.setAlphaBufferSize(alphaSize);
+ format.setDepthBufferSize(depthSize);
+ format.setStencilBufferSize(stencilSize);
+ format.setSampleBuffers(sampleBuffers);
+ if (format.sampleBuffers()) {
+ glXGetFBConfigAttrib(display, config, GLX_SAMPLES_ARB, &sampleCount);
+ format.setSamples(sampleCount);
+ }
+
+ format.setDirectRendering(glXIsDirect(display, ctx));
+ format.setRgba(rgba);
+ format.setStereo(stereo);
+ format.setAccumBufferSize(accumSizeB);
+
+ return format;
+}
+
+QPlatformWindowFormat reducePlatformWindowFormat(const QPlatformWindowFormat &format, bool *reduced)
+{
+ QPlatformWindowFormat retFormat = format;
+ *reduced = true;
+
+ if (retFormat.sampleBuffers()) {
+ retFormat.setSampleBuffers(false);
+ } else if (retFormat.stereo()) {
+ retFormat.setStereo(false);
+ } else if (retFormat.accum()) {
+ retFormat.setAccum(false);
+ }else if (retFormat.stencil()) {
+ retFormat.setStencil(false);
+ }else if (retFormat.alpha()) {
+ retFormat.setAlpha(false);
+ }else if (retFormat.depth()) {
+ retFormat.setDepth(false);
+ }else if (retFormat.doubleBuffer()) {
+ retFormat.setDoubleBuffer(false);
+ }else{
+ *reduced = false;
+ }
+ return retFormat;
+}
diff --git a/src/plugins/platforms/glxconvenience/qglxconvenience.h b/src/plugins/platforms/glxconvenience/qglxconvenience.h
new file mode 100644
index 0000000..b2a775e
--- /dev/null
+++ b/src/plugins/platforms/glxconvenience/qglxconvenience.h
@@ -0,0 +1,15 @@
+#ifndef QGLXCONVENIENCE_H
+#define QGLXCONVENIENCE_H
+
+#include <QPlatformWindowFormat>
+
+#include <X11/Xlib.h>
+#include <GL/glx.h>
+
+XVisualInfo *findVisualInfo(const Display *display, int screen, const QPlatformWindowFormat &format);
+GLXFBConfig findConfig(Display *display, int screen, const QPlatformWindowFormat &format);
+QPlatformWindowFormat platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext context);
+QVector<int> buildSpec(const QPlatformWindowFormat &format);
+QPlatformWindowFormat reducePlatformWindowFormat(const QPlatformWindowFormat &format, bool *reduced);
+
+#endif // QGLXCONVENIENCE_H
diff --git a/src/plugins/platforms/wayland/gl_integration/gl_integration.pri b/src/plugins/platforms/wayland/gl_integration/gl_integration.pri
index ed2b021..10567cd 100644
--- a/src/plugins/platforms/wayland/gl_integration/gl_integration.pri
+++ b/src/plugins/platforms/wayland/gl_integration/gl_integration.pri
@@ -14,4 +14,6 @@ xpixmap_egl {
include ($$PWD/xpixmap_egl/xpixmap_egl.pri)
}
-
+xpixmap_glx {
+ include ($$PWD/xpixmap_glx/xpixmap_glx.pri)
+}
diff --git a/src/plugins/platforms/wayland/gl_integration/qwaylandglwindowsurface.cpp b/src/plugins/platforms/wayland/gl_integration/qwaylandglwindowsurface.cpp
index 8c83128..ebe4c7b 100644
--- a/src/plugins/platforms/wayland/gl_integration/qwaylandglwindowsurface.cpp
+++ b/src/plugins/platforms/wayland/gl_integration/qwaylandglwindowsurface.cpp
@@ -54,6 +54,9 @@ QT_BEGIN_NAMESPACE
static void drawTexture(const QRectF &rect, GLuint tex_id, const QSize &texSize, const QRectF &br)
{
+#if !defined(QT_OPENGL_ES_2)
+ QGLContext *ctx = const_cast<QGLContext *>(QGLContext::currentContext());
+#endif
const GLenum target = GL_TEXTURE_2D;
QRectF src = br.isEmpty()
? QRectF(QPointF(), texSize)
diff --git a/src/plugins/platforms/wayland/gl_integration/xpixmap_egl/qwaylandxpixmapwindow.cpp b/src/plugins/platforms/wayland/gl_integration/xpixmap_egl/qwaylandxpixmapwindow.cpp
index add30d8..35ce41a 100644
--- a/src/plugins/platforms/wayland/gl_integration/xpixmap_egl/qwaylandxpixmapwindow.cpp
+++ b/src/plugins/platforms/wayland/gl_integration/xpixmap_egl/qwaylandxpixmapwindow.cpp
@@ -24,10 +24,6 @@ QPlatformGLContext *QWaylandXPixmapWindow::glContext() const
return mContext;
}
-void QWaylandXPixmapWindow::newSurfaceCreated()
-{
-}
-
void QWaylandXPixmapWindow::setGeometry(const QRect &rect)
{
QPlatformWindow::setGeometry(rect);
diff --git a/src/plugins/platforms/wayland/gl_integration/xpixmap_egl/qwaylandxpixmapwindow.h b/src/plugins/platforms/wayland/gl_integration/xpixmap_egl/qwaylandxpixmapwindow.h
index 919e29d..1f10112 100644
--- a/src/plugins/platforms/wayland/gl_integration/xpixmap_egl/qwaylandxpixmapwindow.h
+++ b/src/plugins/platforms/wayland/gl_integration/xpixmap_egl/qwaylandxpixmapwindow.h
@@ -16,8 +16,6 @@ public:
QPlatformGLContext *glContext() const;
void setGeometry(const QRect &rect);
-protected:
- void newSurfaceCreated();
private:
QWaylandXPixmapEglIntegration *mEglIntegration;
diff --git a/src/plugins/platforms/wayland/gl_integration/xpixmap_glx/qwaylandxpixmapglxcontext.cpp b/src/plugins/platforms/wayland/gl_integration/xpixmap_glx/qwaylandxpixmapglxcontext.cpp
new file mode 100644
index 0000000..c8b5fba
--- /dev/null
+++ b/src/plugins/platforms/wayland/gl_integration/xpixmap_glx/qwaylandxpixmapglxcontext.cpp
@@ -0,0 +1,98 @@
+#include "qwaylandxpixmapglxcontext.h"
+
+#include "qwaylandshmsurface.h"
+#include "qwaylandxpixmapglxwindow.h"
+
+#include <QtCore/QDebug>
+
+QWaylandXPixmapGLXContext::QWaylandXPixmapGLXContext(QWaylandXPixmapGLXIntegration *glxIntegration, QWaylandXPixmapGLXWindow *window)
+ : QPlatformGLContext()
+ , mGlxIntegration(glxIntegration)
+ , mWindow(window)
+ , mBuffer(0)
+ , mPixmap(0)
+ , mConfig(findConfig(glxIntegration->xDisplay(),glxIntegration->screen(),window->widget()->platformWindowFormat()))
+ , mGlxPixmap(0)
+{
+ XVisualInfo *visualInfo = glXGetVisualFromFBConfig(glxIntegration->xDisplay(),mConfig);
+ mContext = glXCreateContext(glxIntegration->xDisplay(),visualInfo,0,TRUE);
+
+ geometryChanged();
+}
+
+void QWaylandXPixmapGLXContext::makeCurrent()
+{
+ QPlatformGLContext::makeCurrent();
+
+ while(mWindow->waitingForFrameSync()) {
+ mGlxIntegration->waylandDisplay()->iterate();
+ }
+
+ glXMakeCurrent(mGlxIntegration->xDisplay(),mGlxPixmap,mContext);
+}
+
+void QWaylandXPixmapGLXContext::doneCurrent()
+{
+ QPlatformGLContext::doneCurrent();
+}
+
+void QWaylandXPixmapGLXContext::swapBuffers()
+{
+ if (QPlatformGLContext::currentContext() != this) {
+ makeCurrent();
+ }
+
+ QSize size = mWindow->geometry().size();
+
+ QImage img(size,QImage::Format_ARGB32);
+ const uchar *constBits = img.bits();
+ void *pixels = const_cast<uchar *>(constBits);
+
+ glReadPixels(0,0, size.width(), size.height(), GL_RGBA,GL_UNSIGNED_BYTE, pixels);
+
+ img = img.mirrored();
+ constBits = img.bits();
+
+ const uchar *constDstBits = mBuffer->image()->bits();
+ uchar *dstBits = const_cast<uchar *>(constDstBits);
+ memcpy(dstBits,constBits,(img.width()*4) * img.height());
+
+
+ mWindow->damage(QRegion(QRect(QPoint(0,0),size)));
+
+}
+
+void * QWaylandXPixmapGLXContext::getProcAddress(const QString &procName)
+{
+ return (void *) glXGetProcAddress(reinterpret_cast<GLubyte *>(procName.toLatin1().data()));
+}
+
+QPlatformWindowFormat QWaylandXPixmapGLXContext::platformWindowFormat() const
+{
+ return platformWindowFromGLXFBConfig(mGlxIntegration->xDisplay(),mConfig,mContext);
+}
+
+void QWaylandXPixmapGLXContext::geometryChanged()
+{
+ while (mWindow->waitingForFrameSync())
+ mGlxIntegration->waylandDisplay()->iterate();
+
+ QSize size(mWindow->geometry().size());
+ delete mBuffer;
+ if (mPixmap)
+ XFreePixmap(mGlxIntegration->xDisplay(),mPixmap);
+ if (mGlxPixmap)
+ glXDestroyPixmap(mGlxIntegration->xDisplay(),mGlxPixmap);
+
+ mBuffer = new QWaylandShmBuffer(mGlxIntegration->waylandDisplay(),size,QImage::Format_ARGB32);
+ mWindow->attach(mBuffer);
+ int depth = XDefaultDepth(mGlxIntegration->xDisplay(),mGlxIntegration->screen());
+ mPixmap = XCreatePixmap(mGlxIntegration->xDisplay(),mGlxIntegration->rootWindow(),size.width(),size.height(),depth);
+ XSync(mGlxIntegration->xDisplay(),False);
+
+ mGlxPixmap = glXCreatePixmap(mGlxIntegration->xDisplay(),mConfig,mPixmap,0);
+
+ if (!mGlxPixmap) {
+ qDebug() << "Could not make egl surface out of pixmap :(";
+ }
+}
diff --git a/src/plugins/platforms/wayland/gl_integration/xpixmap_glx/qwaylandxpixmapglxcontext.h b/src/plugins/platforms/wayland/gl_integration/xpixmap_glx/qwaylandxpixmapglxcontext.h
new file mode 100644
index 0000000..c4c3796
--- /dev/null
+++ b/src/plugins/platforms/wayland/gl_integration/xpixmap_glx/qwaylandxpixmapglxcontext.h
@@ -0,0 +1,38 @@
+#ifndef QWAYLANDXPIXMAPGLXCONTEXT_H
+#define QWAYLANDXPIXMAPGLXCONTEXT_H
+
+#include <QPlatformGLContext>
+
+#include "qwaylandxpixmapglxintegration.h"
+
+#include "qglxconvenience.h"
+
+class QWaylandXPixmapGLXWindow;
+class QWaylandShmBuffer;
+
+class QWaylandXPixmapGLXContext : public QPlatformGLContext
+{
+public:
+ QWaylandXPixmapGLXContext(QWaylandXPixmapGLXIntegration *glxIntegration, QWaylandXPixmapGLXWindow *window);
+
+ void makeCurrent();
+ void doneCurrent();
+ void swapBuffers();
+ void* getProcAddress(const QString& procName);
+
+ QPlatformWindowFormat platformWindowFormat() const;
+
+ void geometryChanged();
+
+private:
+ QWaylandXPixmapGLXIntegration *mGlxIntegration;
+ QWaylandXPixmapGLXWindow *mWindow;
+ QWaylandShmBuffer *mBuffer;
+
+ Pixmap mPixmap;
+ GLXFBConfig mConfig;
+ GLXContext mContext;
+ GLXPixmap mGlxPixmap;
+};
+
+#endif // QWAYLANDXPIXMAPGLXCONTEXT_H
diff --git a/src/plugins/platforms/wayland/gl_integration/xpixmap_glx/qwaylandxpixmapglxintegration.cpp b/src/plugins/platforms/wayland/gl_integration/xpixmap_glx/qwaylandxpixmapglxintegration.cpp
new file mode 100644
index 0000000..17593d7
--- /dev/null
+++ b/src/plugins/platforms/wayland/gl_integration/xpixmap_glx/qwaylandxpixmapglxintegration.cpp
@@ -0,0 +1,53 @@
+#include "qwaylandxpixmapglxintegration.h"
+
+#include "qwaylandxpixmapglxwindow.h"
+
+QWaylandXPixmapGLXIntegration::QWaylandXPixmapGLXIntegration(QWaylandDisplay * waylandDispaly)
+ : QWaylandGLIntegration()
+ , mWaylandDisplay(waylandDispaly)
+{
+ char *display_name = getenv("DISPLAY");
+ mDisplay = XOpenDisplay(display_name);
+ mScreen = XDefaultScreen(mDisplay);
+ mRootWindow = XDefaultRootWindow(mDisplay);
+ XSync(mDisplay, False);
+}
+
+QWaylandXPixmapGLXIntegration::~QWaylandXPixmapGLXIntegration()
+{
+ XCloseDisplay(mDisplay);
+}
+
+void QWaylandXPixmapGLXIntegration::initialize()
+{
+}
+
+QWaylandWindow * QWaylandXPixmapGLXIntegration::createEglWindow(QWidget *widget)
+{
+ return new QWaylandXPixmapGLXWindow(widget,this);
+}
+
+QWaylandGLIntegration * QWaylandGLIntegration::createGLIntegration(QWaylandDisplay *waylandDisplay)
+{
+ return new QWaylandXPixmapGLXIntegration(waylandDisplay);
+}
+
+Display * QWaylandXPixmapGLXIntegration::xDisplay() const
+{
+ return mDisplay;
+}
+
+int QWaylandXPixmapGLXIntegration::screen() const
+{
+ return mScreen;
+}
+
+Window QWaylandXPixmapGLXIntegration::rootWindow() const
+{
+ return mRootWindow;
+}
+
+QWaylandDisplay * QWaylandXPixmapGLXIntegration::waylandDisplay() const
+{
+ return mWaylandDisplay;
+}
diff --git a/src/plugins/platforms/wayland/gl_integration/xpixmap_glx/qwaylandxpixmapglxintegration.h b/src/plugins/platforms/wayland/gl_integration/xpixmap_glx/qwaylandxpixmapglxintegration.h
new file mode 100644
index 0000000..c48abb4
--- /dev/null
+++ b/src/plugins/platforms/wayland/gl_integration/xpixmap_glx/qwaylandxpixmapglxintegration.h
@@ -0,0 +1,39 @@
+#ifndef QWAYLANDXPIXMAPGLXINTEGRATION_H
+#define QWAYLANDXPIXMAPGLXINTEGRATION_H
+
+#include "gl_integration/qwaylandglintegration.h"
+
+#include <QtCore/QTextStream>
+#include <QtCore/QDataStream>
+#include <QtCore/QMetaType>
+#include <QtCore/QVariant>
+#include <QtGui/QWidget>
+
+#include <X11/Xlib.h>
+
+class QWaylandXPixmapGLXIntegration : public QWaylandGLIntegration
+{
+public:
+ QWaylandXPixmapGLXIntegration(QWaylandDisplay * waylandDispaly);
+ ~QWaylandXPixmapGLXIntegration();
+
+ void initialize();
+
+ QWaylandWindow *createEglWindow(QWidget *widget);
+
+ QWaylandDisplay *waylandDisplay() const;
+
+ Display *xDisplay() const;
+ int screen() const;
+ Window rootWindow() const;
+
+private:
+ QWaylandDisplay *mWaylandDisplay;
+
+ Display *mDisplay;
+ int mScreen;
+ Window mRootWindow;
+
+};
+
+#endif // QWAYLANDXPIXMAPGLXINTEGRATION_H
diff --git a/src/plugins/platforms/wayland/gl_integration/xpixmap_glx/qwaylandxpixmapglxwindow.cpp b/src/plugins/platforms/wayland/gl_integration/xpixmap_glx/qwaylandxpixmapglxwindow.cpp
new file mode 100644
index 0000000..a191320
--- /dev/null
+++ b/src/plugins/platforms/wayland/gl_integration/xpixmap_glx/qwaylandxpixmapglxwindow.cpp
@@ -0,0 +1,32 @@
+#include "qwaylandxpixmapglxwindow.h"
+
+QWaylandXPixmapGLXWindow::QWaylandXPixmapGLXWindow(QWidget *window, QWaylandXPixmapGLXIntegration *glxIntegration)
+ : QWaylandShmWindow(window)
+ , mGlxIntegration(glxIntegration)
+ , mContext(0)
+{
+}
+
+QWaylandWindow::WindowType QWaylandXPixmapGLXWindow::windowType() const
+{
+ //yeah. this type needs a new name
+ return QWaylandWindow::Egl;
+}
+
+QPlatformGLContext * QWaylandXPixmapGLXWindow::glContext() const
+{
+ if (!mContext) {
+ QWaylandXPixmapGLXWindow *that = const_cast<QWaylandXPixmapGLXWindow *>(this);
+ that->mContext = new QWaylandXPixmapGLXContext(mGlxIntegration,that);
+ }
+ return mContext;
+}
+
+void QWaylandXPixmapGLXWindow::setGeometry(const QRect &rect)
+{
+ QWaylandShmWindow::setGeometry(rect);
+
+ if (mContext) {
+ mContext->geometryChanged();
+ }
+}
diff --git a/src/plugins/platforms/wayland/gl_integration/xpixmap_glx/qwaylandxpixmapglxwindow.h b/src/plugins/platforms/wayland/gl_integration/xpixmap_glx/qwaylandxpixmapglxwindow.h
new file mode 100644
index 0000000..6aba21c
--- /dev/null
+++ b/src/plugins/platforms/wayland/gl_integration/xpixmap_glx/qwaylandxpixmapglxwindow.h
@@ -0,0 +1,24 @@
+#ifndef QWAYLANDXPIXMAPGLXWINDOW_H
+#define QWAYLANDXPIXMAPGLXWINDOW_H
+
+#include "qwaylandshmwindow.h"
+#include "qwaylandxpixmapglxintegration.h"
+#include "qwaylandxpixmapglxcontext.h"
+
+class QWaylandXPixmapGLXWindow : public QWaylandShmWindow
+{
+public:
+ QWaylandXPixmapGLXWindow(QWidget *window, QWaylandXPixmapGLXIntegration *glxIntegration);
+ WindowType windowType() const;
+
+ QPlatformGLContext *glContext() const;
+
+ void setGeometry(const QRect &rect);
+
+private:
+ QWaylandXPixmapGLXIntegration *mGlxIntegration;
+ QWaylandXPixmapGLXContext *mContext;
+
+};
+
+#endif // QWAYLANDXPIXMAPGLXWINDOW_H
diff --git a/src/plugins/platforms/wayland/gl_integration/xpixmap_glx/xpixmap_glx.pri b/src/plugins/platforms/wayland/gl_integration/xpixmap_glx/xpixmap_glx.pri
new file mode 100644
index 0000000..07654df
--- /dev/null
+++ b/src/plugins/platforms/wayland/gl_integration/xpixmap_glx/xpixmap_glx.pri
@@ -0,0 +1,10 @@
+include (../../../glxconvenience/glxconvenience.pri)
+HEADERS += \
+ $$PWD/qwaylandxpixmapglxintegration.h \
+ gl_integration/xpixmap_glx/qwaylandxpixmapglxwindow.h \
+ gl_integration/xpixmap_glx/qwaylandxpixmapglxcontext.h
+
+SOURCES += \
+ $$PWD/qwaylandxpixmapglxintegration.cpp \
+ gl_integration/xpixmap_glx/qwaylandxpixmapglxwindow.cpp \
+ gl_integration/xpixmap_glx/qwaylandxpixmapglxcontext.cpp
diff --git a/src/plugins/platforms/wayland/wayland.pro b/src/plugins/platforms/wayland/wayland.pro
index f2d9d6b..45457fc 100644
--- a/src/plugins/platforms/wayland/wayland.pro
+++ b/src/plugins/platforms/wayland/wayland.pro
@@ -31,12 +31,18 @@ QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_WAYLAND
INCLUDEPATH += $$PWD
-contains(QT_CONFIG, opengles2) {
+contains(QT_CONFIG, opengl) {
DEFINES += QT_WAYLAND_GL_SUPPORT
QT += opengl
- CONFIG += wayland_egl
-# CONFIG += xpixmap_egl
+ contains(QT_CONFIG, opengles2) {
+ CONFIG += wayland_egl
+ #CONFIG += xpixmap_egl
+ } else {
+ message("HELLO")
+ CONFIG += xpixmap_glx
+ }
+
include ($$PWD/gl_integration/gl_integration.pri)
}