From a45cec6a22c70f0b0d7e066822a74b2172d5f397 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Mon, 15 Mar 2010 10:10:19 +0100 Subject: Add ultra-paranoid synchronization to QX11GLPixmapData This is completely over the top and many of these synchronisation points should be removed before doing any serious benchmarking. However, it makes sure any remaining bugs are not due to GPU & CPU being out of sync. Reviewed-By: TrustMe --- src/opengl/qpixmapdata_x11gl_egl.cpp | 66 ++++++++++++++++++++++++++++++++---- src/opengl/qpixmapdata_x11gl_p.h | 5 +++ 2 files changed, 65 insertions(+), 6 deletions(-) diff --git a/src/opengl/qpixmapdata_x11gl_egl.cpp b/src/opengl/qpixmapdata_x11gl_egl.cpp index a01eec4..2bdfe5c 100644 --- a/src/opengl/qpixmapdata_x11gl_egl.cpp +++ b/src/opengl/qpixmapdata_x11gl_egl.cpp @@ -41,19 +41,21 @@ #include -#include -#include -#include -#include +#include +#include +#include +#include #if !defined(QT_OPENGL_ES_1) -#include +#include #endif #ifndef QT_OPENGL_ES_2 -#include +#include #endif +#include + #include "qpixmapdata_x11gl_p.h" QT_BEGIN_NAMESPACE @@ -185,6 +187,58 @@ QX11GLPixmapData::~QX11GLPixmapData() delete ctx; } + +void QX11GLPixmapData::fill(const QColor &color) +{ + if (ctx) { + ctx->makeCurrent(); + glFinish(); + eglWaitClient(); + } + + QX11PixmapData::fill(color); + XSync(X11->display, False); + + if (ctx) { + ctx->makeCurrent(); + eglWaitNative(EGL_CORE_NATIVE_ENGINE); + } +} + +void QX11GLPixmapData::copy(const QPixmapData *data, const QRect &rect) +{ + if (ctx) { + ctx->makeCurrent(); + glFinish(); + eglWaitClient(); + } + + QX11PixmapData::copy(data, rect); + XSync(X11->display, False); + + if (ctx) { + ctx->makeCurrent(); + eglWaitNative(EGL_CORE_NATIVE_ENGINE); + } +} + +bool QX11GLPixmapData::scroll(int dx, int dy, const QRect &rect) +{ + if (ctx) { + ctx->makeCurrent(); + glFinish(); + eglWaitClient(); + } + + QX11PixmapData::scroll(dx, dy, rect); + XSync(X11->display, False); + + if (ctx) { + ctx->makeCurrent(); + eglWaitNative(EGL_CORE_NATIVE_ENGINE); + } +} + #if !defined(QT_OPENGL_ES_1) Q_GLOBAL_STATIC(QGL2PaintEngineEx, qt_gl_pixmap_2_engine) #endif diff --git a/src/opengl/qpixmapdata_x11gl_p.h b/src/opengl/qpixmapdata_x11gl_p.h index 83cd780..8681336 100644 --- a/src/opengl/qpixmapdata_x11gl_p.h +++ b/src/opengl/qpixmapdata_x11gl_p.h @@ -71,6 +71,11 @@ public: QX11GLPixmapData(); virtual ~QX11GLPixmapData(); + // Re-implemented from QX11PixmapData: + void fill(const QColor &color); + void copy(const QPixmapData *data, const QRect &rect); + bool scroll(int dx, int dy, const QRect &rect); + // Re-implemented from QGLPaintDevice QPaintEngine* paintEngine() const; // Also re-implements QX11PixmapData::paintEngine void beginPaint(); -- cgit v0.12