summaryrefslogtreecommitdiffstats
path: root/src/plugins/graphicssystems/meego
diff options
context:
space:
mode:
authorMichael Dominic K <mdk@codethink.co.uk>2010-11-11 07:25:09 (GMT)
committerSamuel Rødal <samuel.rodal@nokia.com>2010-11-11 07:25:09 (GMT)
commit8d6c8e95f47e6be3f8db85adc2412d55a6915ac4 (patch)
treebd9066ee18a9842d704d993a3cb4a015246d8208 /src/plugins/graphicssystems/meego
parentd964fa923394ba50fa26d36c2c39bf4ac1fda78f (diff)
downloadQt-8d6c8e95f47e6be3f8db85adc2412d55a6915ac4.zip
Qt-8d6c8e95f47e6be3f8db85adc2412d55a6915ac4.tar.gz
Qt-8d6c8e95f47e6be3f8db85adc2412d55a6915ac4.tar.bz2
Plugin-side support for creating/destroying/waiting on fence sync.
Merge-request: 2502 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/plugins/graphicssystems/meego')
-rw-r--r--src/plugins/graphicssystems/meego/qmeegographicssystem.cpp38
-rw-r--r--src/plugins/graphicssystems/meego/qmeegographicssystem.h9
-rw-r--r--src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp12
-rw-r--r--src/plugins/graphicssystems/meego/qmeegolivepixmapdata.h3
4 files changed, 49 insertions, 13 deletions
diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
index 02e1143..063af13 100644
--- a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
+++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
@@ -82,9 +82,9 @@ QWindowSurface* QMeeGoGraphicsSystem::createWindowSurface(QWidget *widget) const
QPixmapData *QMeeGoGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const
{
- // Long story short: without this it's possible to hit an
- // uninitialized paintDevice due to a Qt bug too complex to even
- // explain here... not to mention fix without going crazy.
+ // Long story short: without this it's possible to hit an
+ // unitialized paintDevice due to a Qt bug too complex to even
+ // explain here... not to mention fix without going crazy.
// MDK
QGLShareContextScope ctx(qt_gl_share_widget()->context());
@@ -218,10 +218,10 @@ QPixmapData* QMeeGoGraphicsSystem::pixmapDataFromLiveTextureHandle(Qt::HANDLE ha
return new QMeeGoLivePixmapData(handle);
}
-QImage* QMeeGoGraphicsSystem::lockLiveTexture(QPixmap* pixmap)
+QImage* QMeeGoGraphicsSystem::lockLiveTexture(QPixmap* pixmap, void* fenceSync)
{
QMeeGoLivePixmapData *pixmapData = static_cast<QMeeGoLivePixmapData*>(pixmap->data_ptr().data());
- return pixmapData->lock();
+ return pixmapData->lock(fenceSync);
}
bool QMeeGoGraphicsSystem::releaseLiveTexture(QPixmap *pixmap, QImage *image)
@@ -236,6 +236,20 @@ Qt::HANDLE QMeeGoGraphicsSystem::getLiveTextureHandle(QPixmap *pixmap)
return pixmapData->handle();
}
+void* QMeeGoGraphicsSystem::createFenceSync()
+{
+ QGLShareContextScope ctx(qt_gl_share_widget()->context());
+ QMeeGoExtensions::ensureInitialized();
+ return QMeeGoExtensions::eglCreateSyncKHR(QEgl::display(), EGL_SYNC_FENCE_KHR, NULL);
+}
+
+void QMeeGoGraphicsSystem::destroyFenceSync(void *fenceSync)
+{
+ QGLShareContextScope ctx(qt_gl_share_widget()->context());
+ QMeeGoExtensions::ensureInitialized();
+ QMeeGoExtensions::eglDestroySyncKHR(QEgl::display(), fenceSync);
+}
+
/* C API */
int qt_meego_image_to_egl_shared_image(const QImage &image)
@@ -288,9 +302,9 @@ QPixmapData* qt_meego_pixmapdata_from_live_texture_handle(Qt::HANDLE handle)
return QMeeGoGraphicsSystem::pixmapDataFromLiveTextureHandle(handle);
}
-QImage* qt_meego_live_texture_lock(QPixmap *pixmap)
+QImage* qt_meego_live_texture_lock(QPixmap *pixmap, void *fenceSync)
{
- return QMeeGoGraphicsSystem::lockLiveTexture(pixmap);
+ return QMeeGoGraphicsSystem::lockLiveTexture(pixmap, fenceSync);
}
bool qt_meego_live_texture_release(QPixmap *pixmap, QImage *image)
@@ -302,3 +316,13 @@ Qt::HANDLE qt_meego_live_texture_get_handle(QPixmap *pixmap)
{
return QMeeGoGraphicsSystem::getLiveTextureHandle(pixmap);
}
+
+void* qt_meego_create_fence_sync(void)
+{
+ return QMeeGoGraphicsSystem::createFenceSync();
+}
+
+void qt_meego_destroy_fence_sync(void* fs)
+{
+ return QMeeGoGraphicsSystem::destroyFenceSync(fs);
+}
diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.h b/src/plugins/graphicssystems/meego/qmeegographicssystem.h
index 2697f0f..1e50f00 100644
--- a/src/plugins/graphicssystems/meego/qmeegographicssystem.h
+++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.h
@@ -69,10 +69,13 @@ public:
static QPixmapData *pixmapDataWithNewLiveTexture(int w, int h, QImage::Format format);
static QPixmapData *pixmapDataFromLiveTextureHandle(Qt::HANDLE handle);
- static QImage *lockLiveTexture(QPixmap* pixmap);
+ static QImage *lockLiveTexture(QPixmap* pixmap, void* fenceSync);
static bool releaseLiveTexture(QPixmap *pixmap, QImage *image);
static Qt::HANDLE getLiveTextureHandle(QPixmap *pixmap);
+ static void* createFenceSync();
+ static void destroyFenceSync(void* fenceSync);
+
private:
static bool meeGoRunning();
static EGLSurface getSurfaceForLiveTexturePixmap(QPixmap *pixmap);
@@ -95,9 +98,11 @@ extern "C" {
Q_DECL_EXPORT void qt_meego_set_translucent(bool translucent);
Q_DECL_EXPORT QPixmapData* qt_meego_pixmapdata_with_new_live_texture(int w, int h, QImage::Format format);
Q_DECL_EXPORT QPixmapData* qt_meego_pixmapdata_from_live_texture_handle(Qt::HANDLE handle);
- Q_DECL_EXPORT QImage* qt_meego_live_texture_lock(QPixmap *pixmap);
+ Q_DECL_EXPORT QImage* qt_meego_live_texture_lock(QPixmap *pixmap, void *fenceSync);
Q_DECL_EXPORT bool qt_meego_live_texture_release(QPixmap *pixmap, QImage *image);
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);
}
#endif
diff --git a/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp b/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp
index 405b765..3ef35e1 100644
--- a/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp
+++ b/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp
@@ -40,7 +40,6 @@
****************************************************************************/
#include "qmeegolivepixmapdata.h"
-#include "qmeegoextensions.h"
#include "qmeegorasterpixmapdata.h"
#include <private/qimage_p.h>
#include <private/qwindowsurface_gl_p.h>
@@ -171,11 +170,18 @@ QPixmapData *QMeeGoLivePixmapData::createCompatiblePixmapData() const
return new QMeeGoRasterPixmapData(pixelType());
}
-QImage* QMeeGoLivePixmapData::lock()
+QImage* QMeeGoLivePixmapData::lock(EGLSyncKHR fenceSync)
{
QGLShareContextScope ctx(qt_gl_share_widget()->context());
QMeeGoExtensions::ensureInitialized();
+ if (fenceSync) {
+ QMeeGoExtensions::eglClientWaitSyncKHR(QEgl::display(),
+ fenceSync,
+ EGL_SYNC_FLUSH_COMMANDS_BIT_KHR,
+ EGL_FOREVER_KHR);
+ }
+
void *data = 0;
int pitch = 0;
EGLSurface surface = 0;
@@ -229,7 +235,7 @@ Qt::HANDLE QMeeGoLivePixmapData::handle()
bool QMeeGoLivePixmapData::scroll(int dx, int dy, const QRect &rect)
{
- lock();
+ lock(NULL);
if (!lockedImage.isNull())
qt_scrollRectInImage(lockedImage, rect, QPoint(dx, dy));
diff --git a/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.h b/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.h
index cb123da..2c6854e 100644
--- a/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.h
+++ b/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.h
@@ -43,6 +43,7 @@
#define MLIVEPIXMAPDATA_H
#include <private/qpixmapdata_gl_p.h>
+#include "qmeegoextensions.h"
class QMeeGoLivePixmapData : public QGLPixmapData
{
@@ -56,7 +57,7 @@ public:
void initializeThroughEGLImage();
- QImage* lock();
+ QImage* lock(EGLSyncKHR fenceSync);
bool release(QImage *img);
Qt::HANDLE handle();