[server] Workaround for QtWayland bug https://bugreports.qt.io/browse/QTBUG-52192
Summary: QtWayland doesn't map the parent sub-surfaces in a sub-surface tree. According to the spec this would mean also the child sub-surface is not mapped. But being strict according to the spec will make applications like SystemSettings fail badly. Embedded child windows will not be rendered and QtWayland is going to hard freeze. This is not acceptable, thus we need to workaround this QtWayland bug till it's fixed. It's worth mentioning that Weston as the reference compositor also doesn't handle this situation according to spec and renders the sub-surface. See https://bugs.freedesktop.org/show_bug.cgi?id=94735 The difficult part for the workaround is to determine whether a surface should be considered unmapped. E.g. when the parent gets unmapped we need to really unmap it. But what's the difference between an unmapped parent surface which should be considered mapped and an unmapped parent surface which should be considered unmapped? The implementation goes with considering a new sub-surface always as mapped - independently of whether it ever got a buffer attached. As soon as it had a buffer attached and it gets unmapped again, it will go back to a standard conform way. The behavior now is not standard conform, thus the autotest is adjusted to have QEXPECT_FAIL for the now no longer standard conform areas. Reviewers: #plasma Subscribers: plasma-devel Projects: #plasma Differential Revision: https://phabricator.kde.org/D1250
This commit is contained in:
parent
7053e4fce6
commit
d727d2e477
3 changed files with 15 additions and 1 deletions
|
@ -869,8 +869,11 @@ void TestSubSurface::testMappingOfSurfaceTree()
|
|||
QVERIFY(parentSpy.wait());
|
||||
QVERIFY(parentServerSurface->isMapped());
|
||||
// children should not yet be mapped
|
||||
QEXPECT_FAIL("", "Workaround for QtWayland bug https://bugreports.qt.io/browse/QTBUG-52192", Continue);
|
||||
QVERIFY(!child->surface()->isMapped());
|
||||
QEXPECT_FAIL("", "Workaround for QtWayland bug https://bugreports.qt.io/browse/QTBUG-52192", Continue);
|
||||
QVERIFY(!child2->surface()->isMapped());
|
||||
QEXPECT_FAIL("", "Workaround for QtWayland bug https://bugreports.qt.io/browse/QTBUG-52192", Continue);
|
||||
QVERIFY(!child3->surface()->isMapped());
|
||||
|
||||
// next level
|
||||
|
@ -882,8 +885,11 @@ void TestSubSurface::testMappingOfSurfaceTree()
|
|||
QVERIFY(child2DamageSpy.wait());
|
||||
QVERIFY(parentServerSurface->isMapped());
|
||||
// children should not yet be mapped
|
||||
QEXPECT_FAIL("", "Workaround for QtWayland bug https://bugreports.qt.io/browse/QTBUG-52192", Continue);
|
||||
QVERIFY(!child->surface()->isMapped());
|
||||
QEXPECT_FAIL("", "Workaround for QtWayland bug https://bugreports.qt.io/browse/QTBUG-52192", Continue);
|
||||
QVERIFY(!child2->surface()->isMapped());
|
||||
QEXPECT_FAIL("", "Workaround for QtWayland bug https://bugreports.qt.io/browse/QTBUG-52192", Continue);
|
||||
QVERIFY(!child3->surface()->isMapped());
|
||||
|
||||
// last but not least the first child level, which should map all our subsurfaces
|
||||
|
|
|
@ -343,6 +343,7 @@ void SurfaceInterface::Private::swapStates(State *source, State *target, bool em
|
|||
if (!windowRegion.isEmpty()) {
|
||||
target->damage = windowRegion.intersected(target->damage);
|
||||
if (emitChanged) {
|
||||
subSurfaceIsMapped = true;
|
||||
emit q->damaged(target->damage);
|
||||
// workaround for https://bugreports.qt.io/browse/QTBUG-52092
|
||||
// if the surface is a sub-surface, but the main surface is not yet mapped, fake frame rendered
|
||||
|
@ -352,6 +353,7 @@ void SurfaceInterface::Private::swapStates(State *source, State *target, bool em
|
|||
}
|
||||
}
|
||||
} else if (!target->buffer && emitChanged) {
|
||||
subSurfaceIsMapped = false;
|
||||
emit q->unmapped();
|
||||
}
|
||||
}
|
||||
|
@ -672,7 +674,7 @@ bool SurfaceInterface::isMapped() const
|
|||
if (d->subSurface) {
|
||||
// from spec:
|
||||
// "A sub-surface becomes mapped, when a non-NULL wl_buffer is applied and the parent surface is mapped."
|
||||
return d->current.buffer && !d->subSurface->parentSurface().isNull() && d->subSurface->parentSurface()->isMapped();
|
||||
return d->subSurfaceIsMapped && !d->subSurface->parentSurface().isNull() && d->subSurface->parentSurface()->isMapped();
|
||||
}
|
||||
return d->current.buffer != nullptr;
|
||||
}
|
||||
|
|
|
@ -82,6 +82,12 @@ public:
|
|||
State subSurfacePending;
|
||||
QPointer<SubSurfaceInterface> subSurface;
|
||||
|
||||
// workaround for https://bugreports.qt.io/browse/QTBUG-52192
|
||||
// A subsurface needs to be considered mapped even if it doesn't have a buffer attached
|
||||
// Otherwise Qt's sub-surfaces will never be visible and the client will freeze due to
|
||||
// waiting on the frame callback of the never visible surface
|
||||
bool subSurfaceIsMapped = true;
|
||||
|
||||
private:
|
||||
SurfaceInterface *q_func() {
|
||||
return reinterpret_cast<SurfaceInterface *>(q);
|
||||
|
|
Loading…
Reference in a new issue