Renaming mesa_egl to wayland_egl
authorJørgen Lind <jorgen.lind@nokia.com>
Wed, 31 Aug 2011 13:47:20 +0000 (15:47 +0200)
committerJørgen Lind <jorgen.lind@nokia.com>
Wed, 31 Aug 2011 13:47:20 +0000 (15:47 +0200)
and a compile fix for qwidget compositor

examples/qwidget-compositor/main.cpp
src/qt-compositor/hardware_integration/hardware_integration.pri
src/qt-compositor/hardware_integration/wayland_egl/wayland_egl.pri [moved from src/qt-compositor/hardware_integration/mesa_egl/mesa_egl.pri with 52% similarity]
src/qt-compositor/hardware_integration/wayland_egl/waylandeglintegration.cpp [moved from src/qt-compositor/hardware_integration/mesa_egl/mesaeglintegration.cpp with 89% similarity]
src/qt-compositor/hardware_integration/wayland_egl/waylandeglintegration.h [moved from src/qt-compositor/hardware_integration/mesa_egl/mesaeglintegration.h with 96% similarity]

index 2217d10..8e71860 100644 (file)
@@ -81,7 +81,11 @@ class QWidgetCompositor : public QWidget, public WaylandCompositor
 {
     Q_OBJECT
 public:
-    QWidgetCompositor() : WaylandCompositor(windowHandle(),const_cast<QGLContext *>(context())), m_moveSurface(0), m_dragSourceSurface(0) {
+    QWidgetCompositor()
+        : WaylandCompositor(windowHandle(),const_cast<QGLContext *>(context())->contextHandle())
+        , m_moveSurface(0)
+        , m_dragSourceSurface(0)
+    {
         setMouseTracking(true);
         setRetainedSelectionEnabled(true);
         m_background = QImage(QLatin1String("background.jpg"));
index f7fdc05..c67d99c 100644 (file)
@@ -35,7 +35,7 @@ isEmpty(QT_WAYLAND_GL_CONFIG):QT_WAYLAND_GL_CONFIG = $$(QT_WAYLAND_GL_CONFIG)
 }
 
 mesa_egl {
-    include (mesa_egl/mesa_egl.pri)
+    include (wayland_egl/wayland_egl.pri)
 }
 dri2_xcb {
     include (dri2_xcb/dri2_xcb.pri)
@@ -3,7 +3,7 @@ LIBS += -lEGL
 DEFINES += QT_COMPOSITOR_MESA_EGL
 
 SOURCES += \
-    $$PWD/mesaeglintegration.cpp
+    $$PWD/waylandeglintegration.cpp
 
 HEADERS += \
-    $$PWD/mesaeglintegration.h
+    $$PWD/waylandeglintegration.h
 **
 ****************************************************************************/
 
-#include "mesaeglintegration.h"
+#include "waylandeglintegration.h"
 
 #include <QtGui/QPlatformNativeInterface>
 #include <QtGui/QGuiApplication>
+#include <QtGui/QOpenGLContext>
 
 #define EGL_EGLEXT_PROTOTYPES
 #include <EGL/egl.h>
@@ -96,7 +97,7 @@ void MesaEglIntegration::initializeHardware(Wayland::Display *waylandDisplay)
         if (!d->valid)
             qWarning("Failed to initialize egl display\n");
 
-        d->egl_context = nativeInterface->nativeResourceForContext("EglContext", m_compositor->glContext()->contextHandle());
+        d->egl_context = nativeInterface->nativeResourceForContext("EglContext", m_compositor->glContext());
     }
 }
 
@@ -108,18 +109,20 @@ GLuint MesaEglIntegration::createTextureFromBuffer(wl_buffer *buffer)
         return 0;
     }
 
-    EGLImageKHR image = eglCreateImageKHR(d->egl_display, d->egl_context,
-                                          EGL_WAYLAND_BUFFER_WL,
-                                          buffer, NULL);
+    if (!buffer->user_data) {
+        buffer->user_data = eglCreateImageKHR(d->egl_display, d->egl_context,
+                                              EGL_WAYLAND_BUFFER_WL,
+                                              buffer, NULL);
+    }
 
     GLuint textureId;
     glGenTextures(1,&textureId);
 
     glBindTexture(GL_TEXTURE_2D, textureId);
 
-    glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image);
+    glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, buffer->user_data);
 
-    eglDestroyImageKHR(d->egl_display, image);
+//    eglDestroyImageKHR(d->egl_display, image);
 
     return textureId;
 }
@@ -38,8 +38,8 @@
 **
 ****************************************************************************/
 
-#ifndef MESAEGLINTEGRATION_H
-#define MESAEGLINTEGRATION_H
+#ifndef WAYLANDEGLINTEGRATION_H
+#define WAYLANDEGLINTEGRATION_H
 
 #include "hardware_integration/graphicshardwareintegration.h"
 #include <QtCore/QScopedPointer>
@@ -61,4 +61,4 @@ private:
     QScopedPointer<MesaEglIntegrationPrivate> d_ptr;
 };
 
-#endif // MESAEGLINTEGRATION_H
+#endif // WAYLANDEGLINTEGRATION_H