Don't silently error if damage is sent before buffer

Summary:
Firefox sends

wl_surface@37.damage(0, 0, 808, 622)
wl_surface@37.attach(wl_buffer@34, 0, 0)

Which we silently treat as an error.

There's nothing in the spec to forbid this. The only thing that matters
is the state on commit. This moves a check there.

CCBUG: 397834

Test Plan:
Had a debug in there which was being activated
Gets firefox slightly further (but not complete)

Reviewers: #kwin

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D15912
This commit is contained in:
David Edmundson 2018-09-15 18:56:11 +01:00
parent de6f5a74ff
commit 6414100de3

View file

@ -439,7 +439,7 @@ void SurfaceInterface::Private::swapStates(State *source, State *target, bool em
emit q->transformChanged(target->transform);
}
if (bufferChanged && emitChanged) {
if (!target->damage.isEmpty()) {
if (target->buffer && !target->damage.isEmpty()) {
const QRegion windowRegion = QRegion(0, 0, q->size().width(), q->size().height());
if (!windowRegion.isEmpty()) {
target->damage = windowRegion.intersected(target->damage);
@ -524,10 +524,6 @@ void SurfaceInterface::Private::commitSubSurface()
void SurfaceInterface::Private::damage(const QRect &rect)
{
if (!pending.bufferIsSet || (pending.bufferIsSet && !pending.buffer)) {
// TODO: should we send an error?
return;
}
pending.damage = pending.damage.united(rect);
}