Initial attempt on abstracting the HW interface.
authorJørgen Lind <jorgen.lind@nokia.com>
Wed, 9 Mar 2011 08:36:30 +0000 (09:36 +0100)
committerJørgen Lind <jorgen.lind@nokia.com>
Wed, 9 Mar 2011 08:36:30 +0000 (09:36 +0100)
This is just so that we have a general setup. Something is easier to
work with than nothing :)

13 files changed:
examples/qwidget-compositor/main.cpp
examples/qwidget-compositor/qt-compositor.pro
src/qt-compositor/graphicshardwareintegration.cpp [new file with mode: 0644]
src/qt-compositor/graphicshardwareintegration.h [new file with mode: 0644]
src/qt-compositor/mesa_egl/mesaeglintegration.cpp [new file with mode: 0644]
src/qt-compositor/mesa_egl/mesaeglintegration.h [new file with mode: 0644]
src/qt-compositor/private/wlcompositor.cpp
src/qt-compositor/private/wlcompositor.h
src/qt-compositor/private/wlsurface.cpp
src/qt-compositor/private/wlsurface.h
src/qt-compositor/qt-compositor.pri
src/qt-compositor/qtcompositor.cpp
src/qt-compositor/qtcompositor.h

index ca374cc..2f06771 100644 (file)
 #include <QPainter>
 #include <QMouseEvent>
 
-#ifdef QT_COMPOSITOR_WAYLAND_EGL
+#ifdef QT_COMPOSITOR_WAYLAND_GL
 #include <QGLContext>
 #include <QGLWidget>
-#include <GLES2/gl2.h>
 #endif
 
 #include <QDebug>
 
-#ifdef QT_COMPOSITOR_WAYLAND_EGL
+#ifdef QT_COMPOSITOR_WAYLAND_GL
 class QWidgetCompositor : public QGLWidget, public WaylandCompositor
 #else
 class QWidgetCompositor : public QWidget, public WaylandCompositor
@@ -123,7 +122,7 @@ protected:
                 QImage img = image(m_surfaces.at(i).first);
                 p.drawImage(m_surfaces.at(i).second.topLeft(), img);
             }
-#ifdef QT_COMPOSITOR_WAYLAND_EGL
+#ifdef QT_COMPOSITOR_WAYLAND_GL
             else {
                 QPlatformGLContext *glcontext = platformWindow()->glContext();
                 if (glcontext) {
@@ -132,12 +131,12 @@ protected:
                     context->drawTexture(m_surfaces.at(i).second,textureId(m_surfaces.at(i).first));
                 }
             }
-#endif //QT_COMPOSITOR_WAYLAND_EGL
+#endif //QT_COMPOSITOR_WAYLAND_GL
         }
 
         frameFinished();
 
-#ifdef QT_COMPOSITOR_WAYLAND_EGL
+#ifdef QT_COMPOSITOR_WAYLAND_GL
         //jl:FIX FIX FIX:)
         update();
         glFinish();
index b4bb57c..41776f8 100644 (file)
@@ -4,12 +4,9 @@ DEPENDPATH += .
 INCLUDEPATH += .
 INCLUDEPATH += ../../src/qt-compositor/
 
-# comment out the following line to disable DRM
-CONFIG += wayland_egl
-
-wayland_egl {
-    QT += opengl
-}
+# comment out the following CONFIG lines to disable DRM
+CONFIG += wayland_gl
+CONFIG += mesa_egl
 
 DESTDIR=$$PWD/../../bin/
 
diff --git a/src/qt-compositor/graphicshardwareintegration.cpp b/src/qt-compositor/graphicshardwareintegration.cpp
new file mode 100644 (file)
index 0000000..c375983
--- /dev/null
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** This file is part of QtCompositor**
+**
+** Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+**
+** Contact:  Nokia Corporation qt-info@nokia.com
+**
+** You may use this file under the terms of the BSD license as follows:
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+**
+** Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+**
+** Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in the
+** documentation and/or other materials provided with the distribution.
+**
+** Neither the name of Nokia Corporation and its Subsidiary(-ies) nor the
+** names of its contributors may be used to endorse or promote products
+** derived from this software without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+****************************************************************************/
+
+#include "graphicshardwareintegration.h"
+
+GraphicsHardwareIntegration::GraphicsHardwareIntegration(WaylandCompositor *compositor)
+    : m_compositor(compositor)
+{
+}
diff --git a/src/qt-compositor/graphicshardwareintegration.h b/src/qt-compositor/graphicshardwareintegration.h
new file mode 100644 (file)
index 0000000..d73d07a
--- /dev/null
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** This file is part of QtCompositor**
+**
+** Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+**
+** Contact:  Nokia Corporation qt-info@nokia.com
+**
+** You may use this file under the terms of the BSD license as follows:
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+**
+** Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+**
+** Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in the
+** documentation and/or other materials provided with the distribution.
+**
+** Neither the name of Nokia Corporation and its Subsidiary(-ies) nor the
+** names of its contributors may be used to endorse or promote products
+** derived from this software without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+****************************************************************************/
+
+#ifndef GRAPHICSHARDWAREINTEGRATION_H
+#define GRAPHICSHARDWAREINTEGRATION_H
+
+#include <QtOpenGL/qgl.h>
+#include <wayland-server.h>
+
+#include "qtcompositor.h"
+
+class GraphicsHardwareIntegration
+{
+public:
+    GraphicsHardwareIntegration(WaylandCompositor *compositor);
+
+    virtual void intializeHardware(struct wl_display *waylandDisplay) = 0;
+
+    /** Bind the Wayland buffer to the textureId. The correct context is the current context,
+        so there is no need to do makeCurrent in this function.
+     **/
+    virtual void bindBufferToTexture(struct wl_buffer *buffer, GLuint textureId) = 0;
+
+protected:
+    WaylandCompositor *m_compositor;
+};
+
+#endif // GRAPHICSHARDWAREINTEGRATION_H
diff --git a/src/qt-compositor/mesa_egl/mesaeglintegration.cpp b/src/qt-compositor/mesa_egl/mesaeglintegration.cpp
new file mode 100644 (file)
index 0000000..cde348f
--- /dev/null
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** This file is part of QtCompositor**
+**
+** Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+**
+** Contact:  Nokia Corporation qt-info@nokia.com
+**
+** You may use this file under the terms of the BSD license as follows:
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+**
+** Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+**
+** Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in the
+** documentation and/or other materials provided with the distribution.
+**
+** Neither the name of Nokia Corporation and its Subsidiary(-ies) nor the
+** names of its contributors may be used to endorse or promote products
+** derived from this software without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+****************************************************************************/
+
+#include "mesaeglintegration.h"
+
+#include <QtGui/QPlatformNativeInterface>
+#include <QtGui/private/qapplication_p.h>
+
+#define EGL_EGLEXT_PROTOTYPES
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+#define GL_GLEXT_PROTOTYPES
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+
+MesaEglIntegration::MesaEglIntegration(WaylandCompositor *compositor)
+    : GraphicsHardwareIntegration(compositor)
+{
+}
+
+void MesaEglIntegration::intializeHardware(wl_display *waylandDisplay)
+{
+    QPlatformNativeInterface *nativeInterface = QApplicationPrivate::platformIntegration()->nativeInterface();
+    if (nativeInterface) {
+        EGLDisplay m_egl_display = nativeInterface->nativeResourceForWidget("EglDisplay",0);
+        if (m_egl_display) {
+            eglBindWaylandDisplayWL(m_egl_display,waylandDisplay);
+        } else {
+            fprintf(stderr, "Failed to initialize egl display");
+        }
+    }
+}
+
+void MesaEglIntegration::bindBufferToTexture(wl_buffer *buffer, GLuint textureId)
+{
+    QPlatformNativeInterface *nativeInterface = QApplicationPrivate::platformIntegration()->nativeInterface();
+    EGLDisplay eglDisplay = static_cast<EGLDisplay>(nativeInterface->nativeResourceForWidget("EglDisplay",m_compositor->topLevelWidget()));
+    EGLContext eglContext = static_cast<EGLContext>(nativeInterface->nativeResourceForWidget("EglContext",m_compositor->topLevelWidget()));
+    Q_ASSERT(eglDisplay);
+    Q_ASSERT(eglContext);
+
+    EGLImageKHR image = eglCreateImageKHR(eglDisplay, eglContext,
+                                          EGL_WAYLAND_BUFFER_WL,
+                                          buffer, NULL);
+
+    glBindTexture(GL_TEXTURE_2D, textureId);
+
+    glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image);
+
+    eglDestroyImageKHR(eglDisplay, image);
+
+
+}
diff --git a/src/qt-compositor/mesa_egl/mesaeglintegration.h b/src/qt-compositor/mesa_egl/mesaeglintegration.h
new file mode 100644 (file)
index 0000000..9cb2f11
--- /dev/null
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** This file is part of QtCompositor**
+**
+** Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+**
+** Contact:  Nokia Corporation qt-info@nokia.com
+**
+** You may use this file under the terms of the BSD license as follows:
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+**
+** Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+**
+** Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in the
+** documentation and/or other materials provided with the distribution.
+**
+** Neither the name of Nokia Corporation and its Subsidiary(-ies) nor the
+** names of its contributors may be used to endorse or promote products
+** derived from this software without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+****************************************************************************/
+
+#ifndef MESAEGLINTEGRATION_H
+#define MESAEGLINTEGRATION_H
+
+#include "../graphicshardwareintegration.h"
+
+class MesaEglIntegration : public GraphicsHardwareIntegration
+{
+public:
+    MesaEglIntegration(WaylandCompositor *compositor);
+
+    void intializeHardware(wl_display *waylandDisplay);
+
+    void bindBufferToTexture(wl_buffer *buffer, GLuint textureId);
+};
+
+#endif // MESAEGLINTEGRATION_H
index 2cea1b6..2762d9c 100644 (file)
 
 #include <wayland-server.h>
 
-#ifdef QT_COMPOSITOR_WAYLAND_EGL
-#include <private/qapplication_p.h>
-#include <QPlatformNativeInterface>
-#define EGL_EGLEXT_PROTOTYPES
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
+#ifdef QT_COMPOSITOR_MESA_EGL
+#include "../mesa_egl/mesaeglintegration.h"
 #endif
 
 namespace Wayland {
@@ -177,6 +173,9 @@ Compositor::Compositor(WaylandCompositor *qt_compositor)
     , m_last_queued_buf(-1)
     , m_qt_compositor(qt_compositor)
 {
+#ifdef QT_COMPOSITOR_MESA_EGL
+    m_graphics_hw_integration = new MesaEglIntegration(qt_compositor);
+#endif
 
     if (wl_compositor_init(base(), &compositor_interface, m_display->handle())) {
         fprintf(stderr, "Fatal: Error initializing compositor\n");
@@ -197,17 +196,9 @@ Compositor::Compositor(WaylandCompositor *qt_compositor)
         exit(EXIT_FAILURE);
     }
 
-#ifdef QT_COMPOSITOR_WAYLAND_EGL
-    QPlatformNativeInterface *nativeInterface = QApplicationPrivate::platformIntegration()->nativeInterface();
-    if (nativeInterface) {
-        EGLDisplay m_egl_display = nativeInterface->nativeResourceForWidget("EglDisplay",0);
-        if (m_egl_display) {
-            eglBindWaylandDisplayWL(m_egl_display,m_display->handle());
-        } else {
-            fprintf(stderr, "Failed to initialize egl display");
-        }
-    }
-#endif //QT_COMPOSITOR_WAYLAND_EGL
+#ifdef QT_COMPOSITOR_WAYLAND_GL
+    m_graphics_hw_integration->intializeHardware(m_display->handle());
+#endif //QT_COMPOSITOR_WAYLAND_GL
 
     m_loop = wl_display_get_event_loop(m_display->handle());
 
@@ -386,5 +377,12 @@ QWidget * Compositor::topLevelWidget() const
     return m_qt_compositor->topLevelWidget();
 }
 
+#ifdef QT_COMPOSITOR_WAYLAND_GL
+GraphicsHardwareIntegration * Compositor::gaphicsHWIntegration() const
+{
+    return m_graphics_hw_integration;
+}
+#endif
+
 }
 
index dba18c0..71495db 100644 (file)
@@ -48,6 +48,7 @@
 #include <wayland-server.h>
 
 class WaylandCompositor;
+class GraphicsHardwareIntegration;
 class QWidget;
 
 namespace Wayland {
@@ -89,6 +90,9 @@ public:
     uint currentTimeMsecs() const;
 
     QWidget *topLevelWidget() const;
+#ifdef QT_COMPOSITOR_WAYLAND_GL
+    GraphicsHardwareIntegration *gaphicsHWIntegration() const;
+#endif
 
 private slots:
     void processWaylandEvents();
@@ -115,6 +119,10 @@ private:
     wl_event_loop *m_loop;
 
     WaylandCompositor *m_qt_compositor;
+
+#ifdef QT_COMPOSITOR_WAYLAND_GL
+    GraphicsHardwareIntegration *m_graphics_hw_integration;
+#endif
 };
 
 }
index 380282e..45cafb1 100644 (file)
 
 #include <wayland-server.h>
 
-#ifdef QT_COMPOSITOR_WAYLAND_EGL
-#include <QtGui/QPlatformNativeInterface>
+#ifdef QT_COMPOSITOR_WAYLAND_GL
+#include "../graphicshardwareintegration.cpp"
 #include <QtGui/QPlatformGLContext>
-#define EGL_EGLEXT_PROTOTYPES
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
 #endif
 
 namespace Wayland {
@@ -66,7 +63,7 @@ public:
     {
         current.type = State::Invalid;
         staged.type = State::Invalid;
-#ifdef QT_COMPOSITOR_WAYLAND_EGL
+#ifdef QT_COMPOSITOR_WAYLAND_GL
         if (QWidget *topLevel = m_compositor->topLevelWidget()) {
             if (topLevel->platformWindow() && topLevel->platformWindow()->glContext()) {
                 topLevel->platformWindow()->glContext()->makeCurrent();
@@ -87,7 +84,7 @@ public:
         BufferType type;
 
         ShmBuffer *shm_buffer;
-#ifdef QT_COMPOSITOR_WAYLAND_EGL
+#ifdef QT_COMPOSITOR_WAYLAND_GL
         GLuint texture_id;
 #endif
         QRect rect;
@@ -118,9 +115,9 @@ void surface_attach(struct wl_client *client, struct wl_surface *surface,
     if (buffer->attach) {
         wayland_cast<Surface *>(surface)->attachShm(wayland_cast<ShmBuffer *>(buffer));
     }
-#ifdef QT_COMPOSITOR_WAYLAND_EGL
+#ifdef QT_COMPOSITOR_WAYLAND_GL
     else {
-        wayland_cast<Surface *>(surface)->attachEgl(buffer);
+        wayland_cast<Surface *>(surface)->attachHWBuffer(buffer);
     }
 #endif //QT_COMPOSITOR_WAYLAND_EGL
 }
@@ -198,38 +195,21 @@ QImage Surface::image() const
     return QImage();
 }
 
-#ifdef QT_COMPOSITOR_WAYLAND_EGL
-void Surface::attachEgl(wl_buffer *egl_buffer)
+#ifdef QT_COMPOSITOR_WAYLAND_GL
+
+void Surface::attachHWBuffer(struct wl_buffer *buffer)
 {
     Q_D(Surface);
-    Q_ASSERT(d->m_compositor->topLevelWidget());
-    QPlatformNativeInterface *nativeInterface = QApplicationPrivate::platformIntegration()->nativeInterface();
-    Q_ASSERT(nativeInterface);
+    d->staged.type = SurfacePrivate::State::Texture;
+    d->current.type = d->staged.type;
+    d->current.texture_id = d->staged.texture_id;
 
     //make current for the topLevel. We could have used the eglContext,
     //but then we would need to handle eglSurfaces as well.
     d->m_compositor->topLevelWidget()->platformWindow()->glContext()->makeCurrent();
 
-    EGLDisplay eglDisplay = static_cast<EGLDisplay>(nativeInterface->nativeResourceForWidget("EglDisplay",d->m_compositor->topLevelWidget()));
-    EGLContext eglContext = static_cast<EGLContext>(nativeInterface->nativeResourceForWidget("EglContext",d->m_compositor->topLevelWidget()));
-    Q_ASSERT(eglDisplay);
-    Q_ASSERT(eglContext);
-
-    EGLImageKHR image = eglCreateImageKHR(eglDisplay, eglContext,
-                               EGL_WAYLAND_BUFFER_WL,
-                               egl_buffer, NULL);
-
-     glBindTexture(GL_TEXTURE_2D, d->staged.texture_id);
-
-     glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image);
-
-     eglDestroyImageKHR(eglDisplay, image);
-
-     d->staged.type = SurfacePrivate::State::Texture;
-     d->current.type = d->staged.type;
-     d->current.texture_id = d->staged.texture_id;
-
-     d->m_compositor->surfaceResized(this,QSize(egl_buffer->width,egl_buffer->height));
+    d->m_compositor->gaphicsHWIntegration()->bindBufferToTexture(buffer,d->current.texture_id);
+    d->m_compositor->surfaceResized(this,QSize(buffer->width,buffer->height));
 }
 
 bool Surface::hasTexture() const
@@ -243,7 +223,7 @@ GLuint Surface::textureId() const
     Q_D(const Surface);
     return d->current.texture_id;
 }
-#endif // QT_COMPOSITOR_WAYLAND_EGL
+#endif // QT_COMPOSITOR_WAYLAND_GL
 
 void Surface::attachShm(Wayland::ShmBuffer *shm_buffer)
 {
index 870dc1e..57470d9 100644 (file)
@@ -51,7 +51,7 @@
 #include <QtCore/QMetaType>
 #include <QtGui/private/qapplication_p.h>
 
-#ifdef QT_COMPOSITOR_WAYLAND_EGL
+#ifdef QT_COMPOSITOR_WAYLAND_GL
 #define GL_GLEXT_PROTOTYPES
 #include <GLES2/gl2.h>
 #include <GLES2/gl2ext.h>
@@ -72,8 +72,8 @@ public:
     ~Surface();
 
     uint id() const { return base()->resource.object.id; }
-#ifdef QT_COMPOSITOR_WAYLAND_EGL
-    void attachEgl(wl_buffer *egl_buffer);
+#ifdef QT_COMPOSITOR_WAYLAND_GL
+    void attachHWBuffer(struct wl_buffer *buffer);
 #endif
     void attachShm(ShmBuffer *shm_buffer);
 
@@ -86,7 +86,7 @@ public:
     QImage image() const;
     bool hasImage() const;
 
-#ifdef QT_COMPOSITOR_WAYLAND_EGL
+#ifdef QT_COMPOSITOR_WAYLAND_GL
     bool hasTexture() const;
     GLuint textureId() const;
 #endif
index b771bfd..5296b72 100644 (file)
@@ -1,27 +1,30 @@
 LIBS += -lwayland-server -lffi
-unix {
-#    CONFIG += link_pkgconfig
-#    PKGCONFIG += libdrm
+
+wayland_gl {
+    QT += opengl
+    DEFINES += QT_COMPOSITOR_WAYLAND_GL
+}
+
+mesa_egl {
+include (mesa_egl/mesa_egl.pri)
+DEFINES += QT_COMPOSITOR_MESA_EGL
 }
 
 SOURCES += $$PWD/qtcompositor.cpp \
+        $$PWD/graphicshardwareintegration.cpp \
         $$PWD/private/wlcompositor.cpp \
         $$PWD/private/wlsurface.cpp \
         $$PWD/private/wloutput.cpp \
         $$PWD/private/wldisplay.cpp \
-        $$PWD/private/wlshmbuffer.cpp \ 
+        $$PWD/private/wlshmbuffer.cpp
 
 HEADERS += $$PWD/qtcompositor.h \
+        $$PWD/graphicshardwareintegration.h \
         $$PWD/private/wlcompositor.h \
         $$PWD/private/wlsurface.h \
         $$PWD/private/wloutput.h \
         $$PWD/private/wlshmbuffer.h \
         $$PWD/private/wldisplay.h \
-        $$PWD/private/wlobject.h \
+        $$PWD/private/wlobject.h
 
 INCLUDEPATH += $$PWD/../3rdparty/wayland
-
-wayland_egl  {
-  LIBS += -lEGL -lGLESv2
-  DEFINES += QT_COMPOSITOR_WAYLAND_EGL
-}
index 9181e84..c8f2dcd 100644 (file)
@@ -109,7 +109,7 @@ const QImage WaylandCompositor::image(uint winId) const
     return m_compositor->image(winId);
 }
 
-#ifdef QT_COMPOSITOR_WAYLAND_EGL
+#ifdef QT_COMPOSITOR_WAYLAND_GL
 GLuint WaylandCompositor::textureId(uint winId) const
 {
     return m_compositor->getSurfaceFromWinId(winId)->textureId();
index d69e5a3..ed487d2 100644 (file)
@@ -45,7 +45,7 @@
 #include <QImage>
 #include <QRect>
 
-#ifdef QT_COMPOSITOR_WAYLAND_EGL
+#ifdef QT_COMPOSITOR_WAYLAND_GL
 #define GL_GLEXT_PROTOTYPES
 #include <GLES2/gl2.h>
 #include <GLES2/gl2ext.h>
@@ -83,7 +83,7 @@ public:
     bool hasImage(uint winId) const;
     const QImage image(uint winId) const;
 
-#ifdef QT_COMPOSITOR_WAYLAND_EGL
+#ifdef QT_COMPOSITOR_WAYLAND_GL
     bool hasTexture(uint winId) const;
     GLuint textureId(uint winId) const;
 #endif