Fix widget texture list locking to avoid animation issues on eglfs

QWidgetBackingStore::sync() has two variants. The widget texture list
logic was only present in one of them. This led to problems on eglfs
in cases when the other variant got invoked. (for instance using the
scroll area in the qopenglwidget example)

eglfs relies on the texture lists's lock status to properly serialize
its somewhat asynchronous built-in compositing mechanism and therefore
is the only platform affected. The patch moves the code to be invoked
from both sync() variants.

Task-number: QTBUG-50668
Change-Id: I4c62987b7bb3cc40f98a4e94447368d2f740dbfd
Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
bb10
Laszlo Agocs 2016-01-26 12:28:45 +01:00 committed by Simon Hausmann
parent 3f482fad3c
commit 0192ab52e2
2 changed files with 31 additions and 22 deletions

View File

@ -1059,6 +1059,31 @@ static inline bool discardSyncRequest(QWidget *tlw, QTLWExtra *tlwExtra)
return false;
}
bool QWidgetBackingStore::syncAllowed()
{
#ifndef QT_NO_OPENGL
QTLWExtra *tlwExtra = tlw->d_func()->maybeTopData();
if (textureListWatcher && !textureListWatcher->isLocked()) {
textureListWatcher->deleteLater();
textureListWatcher = 0;
} else if (!tlwExtra->widgetTextures.isEmpty()) {
bool skipSync = false;
foreach (QPlatformTextureList *tl, tlwExtra->widgetTextures) {
if (tl->isLocked()) {
if (!textureListWatcher)
textureListWatcher = new QPlatformTextureListWatcher(this);
if (!textureListWatcher->isLocked())
textureListWatcher->watch(tl);
skipSync = true;
}
}
if (skipSync) // cannot compose due to widget textures being in use
return false;
}
#endif
return true;
}
/*!
Synchronizes the \a exposedRegion of the \a exposedWidget with the backing store.
@ -1089,7 +1114,8 @@ void QWidgetBackingStore::sync(QWidget *exposedWidget, const QRegion &exposedReg
else
markDirtyOnScreen(exposedRegion, exposedWidget, QPoint());
doSync();
if (syncAllowed())
doSync();
}
/*!
@ -1115,27 +1141,8 @@ void QWidgetBackingStore::sync()
return;
}
#ifndef QT_NO_OPENGL
if (textureListWatcher && !textureListWatcher->isLocked()) {
textureListWatcher->deleteLater();
textureListWatcher = 0;
} else if (!tlwExtra->widgetTextures.isEmpty()) {
bool skipSync = false;
foreach (QPlatformTextureList *tl, tlwExtra->widgetTextures) {
if (tl->isLocked()) {
if (!textureListWatcher)
textureListWatcher = new QPlatformTextureListWatcher(this);
if (!textureListWatcher->isLocked())
textureListWatcher->watch(tl);
skipSync = true;
}
}
if (skipSync) // cannot compose due to widget textures being in use
return;
}
#endif
doSync();
if (syncAllowed())
doSync();
}
void QWidgetBackingStore::doSync()

View File

@ -164,6 +164,8 @@ private:
void updateLists(QWidget *widget);
bool syncAllowed();
inline void addDirtyWidget(QWidget *widget, const QRegion &rgn)
{
if (widget && !widget->d_func()->inDirtyList && !widget->data->in_destructor) {