summaryrefslogtreecommitdiff
path: root/src/plugins/graphicssystems
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-03-07 22:55:27 +1000
committerQt Continuous Integration System <qt-info@nokia.com>2011-03-07 22:55:27 +1000
commit2e5edf27acc6eb522d4036de9f82896228887d55 (patch)
treebf7019bbdc7f128b3c2adf7b2235c8f1b3ee800f /src/plugins/graphicssystems
parentdda11ee48e323f4f4c6490822aa8921d5d6e3e69 (diff)
parentd55aa14630bbb4130017f38177b20c850d556371 (diff)
downloadqt4-tools-2e5edf27acc6eb522d4036de9f82896228887d55.tar.gz
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Invalidate the EGL surface of QMeeGoLivePixmapData when switching to Raster
Diffstat (limited to 'src/plugins/graphicssystems')
-rw-r--r--src/plugins/graphicssystems/meego/qmeegographicssystem.cpp5
-rw-r--r--src/plugins/graphicssystems/meego/qmeegographicssystem.h1
-rw-r--r--src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp21
-rw-r--r--src/plugins/graphicssystems/meego/qmeegolivepixmapdata.h7
4 files changed, 34 insertions, 0 deletions
diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
index 6b8d2b368d..13eab7f88f 100644
--- a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
+++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
@@ -335,3 +335,8 @@ void qt_meego_destroy_fence_sync(void* fs)
{
return QMeeGoGraphicsSystem::destroyFenceSync(fs);
}
+
+void qt_meego_invalidate_live_surfaces(void)
+{
+ return QMeeGoLivePixmapData::invalidateSurfaces();
+}
diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.h b/src/plugins/graphicssystems/meego/qmeegographicssystem.h
index 323ce1fcb9..27a4e7a8c6 100644
--- a/src/plugins/graphicssystems/meego/qmeegographicssystem.h
+++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.h
@@ -103,6 +103,7 @@ extern "C" {
Q_DECL_EXPORT Qt::HANDLE qt_meego_live_texture_get_handle(QPixmap *pixmap);
Q_DECL_EXPORT void* qt_meego_create_fence_sync(void);
Q_DECL_EXPORT void qt_meego_destroy_fence_sync(void* fs);
+ Q_DECL_EXPORT void qt_meego_invalidate_live_surfaces(void);
}
#endif
diff --git a/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp b/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp
index e4f1900566..2a2a0989e4 100644
--- a/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp
+++ b/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp
@@ -49,6 +49,8 @@
#include <private/qpixmap_x11_p.h>
#include <stdio.h>
+static QMeeGoLivePixmapDataList all_live_pixmaps;
+
static EGLint lock_attribs[] = {
EGL_MAP_PRESERVE_PIXELS_KHR, EGL_TRUE,
EGL_LOCK_USAGE_HINT_KHR, EGL_READ_SURFACE_BIT_KHR | EGL_WRITE_SURFACE_BIT_KHR,
@@ -118,21 +120,29 @@ QMeeGoLivePixmapData::QMeeGoLivePixmapData(int w, int h, QImage::Format format)
backingX11Pixmap = new QPixmap(pmd);
initializeThroughEGLImage();
+
+ pos = all_live_pixmaps.insert(all_live_pixmaps.begin(), this);
}
QMeeGoLivePixmapData::QMeeGoLivePixmapData(Qt::HANDLE h) : QGLPixmapData(QPixmapData::PixmapType)
{
backingX11Pixmap = new QPixmap(QPixmap::fromX11Pixmap(h));
initializeThroughEGLImage();
+
+ pos = all_live_pixmaps.insert(all_live_pixmaps.begin(), this);
}
QMeeGoLivePixmapData::~QMeeGoLivePixmapData()
{
delete backingX11Pixmap;
+ all_live_pixmaps.erase(pos);
}
void QMeeGoLivePixmapData::initializeThroughEGLImage()
{
+ if (texture()->id != 0)
+ return;
+
QGLShareContextScope ctx(qt_gl_share_widget()->context());
QMeeGoExtensions::ensureInitialized();
@@ -245,6 +255,8 @@ bool QMeeGoLivePixmapData::scroll(int dx, int dy, const QRect &rect)
EGLSurface QMeeGoLivePixmapData::getSurfaceForBackingPixmap()
{
+ initializeThroughEGLImage();
+
// This code is a crative remix of the stuff that can be found in the
// Qt's TFP implementation in /src/opengl/qgl_x11egl.cpp ::bindiTextureFromNativePixmap
QX11PixmapData *pixmapData = static_cast<QX11PixmapData*>(backingX11Pixmap->data_ptr().data());
@@ -290,3 +302,12 @@ void QMeeGoLivePixmapData::destroySurfaceForPixmapData(QPixmapData* pmd)
pixmapData->gl_surface = 0;
}
}
+
+void QMeeGoLivePixmapData::invalidateSurfaces()
+{
+ foreach (QMeeGoLivePixmapData *data, all_live_pixmaps) {
+ QX11PixmapData *pixmapData = static_cast<QX11PixmapData*>(data->backingX11Pixmap->data_ptr().data());
+ *data->texture() = QGLTexture();
+ pixmapData->gl_surface = 0;
+ }
+}
diff --git a/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.h b/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.h
index 484028e61d..616b33cc95 100644
--- a/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.h
+++ b/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.h
@@ -42,9 +42,13 @@
#ifndef MLIVEPIXMAPDATA_H
#define MLIVEPIXMAPDATA_H
+#include <QLinkedList>
#include <private/qpixmapdata_gl_p.h>
#include "qmeegoextensions.h"
+class QMeeGoLivePixmapData;
+typedef QLinkedList<QMeeGoLivePixmapData *> QMeeGoLivePixmapDataList;
+
class QMeeGoLivePixmapData : public QGLPixmapData
{
public:
@@ -66,6 +70,9 @@ public:
QPixmap *backingX11Pixmap;
QImage lockedImage;
+ QMeeGoLivePixmapDataList::Iterator pos;
+
+ static void invalidateSurfaces();
};
#endif