summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorSami Kyostila <sami.kyostila@nokia.com>2011-03-28 16:08:29 (GMT)
committerSamuel Rødal <samuel.rodal@nokia.com>2011-03-28 16:26:17 (GMT)
commitf5592ef682ce18e7e6fd3770de722a5255a34ef7 (patch)
treea4b70a2693d92d20a72df14fb6e0144a5bc7c565 /src/plugins
parent45bd1e737f2f76bbc9943995734c6ecb0a23935b (diff)
downloadQt-f5592ef682ce18e7e6fd3770de722a5255a34ef7.zip
Qt-f5592ef682ce18e7e6fd3770de722a5255a34ef7.tar.gz
Qt-f5592ef682ce18e7e6fd3770de722a5255a34ef7.tar.bz2
QMeeGoLivePixmapData: Verify dimensions of locked pixmap
When a switch from HW rendering to SW rendering is done, all EGL surfaces backing a live pixmap become invalid because EGL is terminated. Thanks to a recent patch, all live images are now automatically invalidated when SW rendering is activated. Even with this mechanism in place, it is possible for the underlying EGL surface to be different than what the live pixmap is expecting. This can happen, for instance, if the X pixmap gets destroyed and a different X drawable is created using the same XID. Even though this is an unlikely scenario, it can result in a complete system failure if the surface dimensions do not match and the live pixmap user ends up writing over internal graphics driver structures. This patch adds a safeguard which disallows locking EGL surfaces with non-matching dimensions. Fixes Harmattan bug NB#237138. Merge-request: 2583 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp b/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp
index 0970b89..b6ba7ec 100644
--- a/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp
+++ b/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp
@@ -194,6 +194,8 @@ QImage* QMeeGoLivePixmapData::lock(EGLSyncKHR fenceSync)
void *data = 0;
int pitch = 0;
+ int surfaceWidth = 0;
+ int surfaceHeight = 0;
EGLSurface surface = 0;
QImage::Format format;
lockedImage = QImage();
@@ -206,9 +208,11 @@ QImage* QMeeGoLivePixmapData::lock(EGLSyncKHR fenceSync)
eglQuerySurface(QEgl::display(), surface, EGL_BITMAP_POINTER_KHR, (EGLint*) &data);
eglQuerySurface(QEgl::display(), surface, EGL_BITMAP_PITCH_KHR, (EGLint*) &pitch);
+ eglQuerySurface(QEgl::display(), surface, EGL_WIDTH, (EGLint*) &surfaceWidth);
+ eglQuerySurface(QEgl::display(), surface, EGL_HEIGHT, (EGLint*) &surfaceHeight);
// Ok, here we know we just support those two formats. Real solution would be:
- // uqery also the format.
+ // query also the format.
if (backingX11Pixmap->depth() > 16)
format = QImage::Format_ARGB32_Premultiplied;
else
@@ -219,6 +223,12 @@ QImage* QMeeGoLivePixmapData::lock(EGLSyncKHR fenceSync)
return &lockedImage;
}
+ if (width() != surfaceWidth || height() != surfaceHeight) {
+ qWarning("Live texture dimensions don't match!");
+ QMeeGoExtensions::eglUnlockSurfaceKHR(QEgl::display(), surface);
+ return &lockedImage;
+ }
+
lockedImage = QImage((uchar *) data, width(), height(), pitch, format);
return &lockedImage;
}