Fix crash when using kwin on windowed mode
ClosedPublic

Authored by apol on Mar 26 2019, 2:18 AM.

Details

Summary

Used to get:
kwin_wayland: kwin/composite.cpp:646: void KWin::Compositor::aboutToSwapBuffers(): Assertion "!m_bufferSwapPending' failed."

Test Plan

Ran kwin_wayland --socket dave --output-count 2 konsole

Diff Detail

Repository
R108 KWin
Branch
master
Lint
Lint SkippedExcuse: no cppcheck
Unit
No Unit Test Coverage
Build Status
Buildable 10138
Build 10156: arc lint + arc unit
apol created this revision.Mar 26 2019, 2:18 AM
Restricted Application added a project: KWin. · View Herald TranscriptMar 26 2019, 2:18 AM
Restricted Application added a subscriber: kwin. · View Herald Transcript
apol requested review of this revision.Mar 26 2019, 2:18 AM
zzag added a subscriber: zzag.Mar 26 2019, 7:17 AM

Could you please provide more context?

apol added a comment.Mar 26 2019, 11:56 AM
In D20056#438474, @zzag wrote:

Could you please provide more context?

The context is, kwin_wayland --socket dave --output-count 2 konsole crashes for me here. I wanted to use it to debug the multiple display rotation but it crashes at start.

Now the present function is much more similar to EglGbmBackend::present.

zzag added a comment.Mar 26 2019, 2:17 PM

Argh, me being lame at English... I asked for more context why the crash happens.

apol edited the summary of this revision. (Show Details)Mar 26 2019, 2:18 PM
apol edited the summary of this revision. (Show Details)
apol added a comment.Mar 26 2019, 2:24 PM
In D20056#438704, @zzag wrote:

Argh, me being lame at English... I asked for more context why the crash happens.

The crash happens because nobody is setting m_bufferSwapPending to false after presenting per screen. My guess is that D18465 didn't took multiscreen windowed mode into account.

zzag added a comment.EditedMar 26 2019, 2:37 PM

Hmm, WaylandBackend::checkBufferSwap should call Compositor::bufferSwapComplete after all outputs are rendered. Most likely we're hitting the TODO comment in WaylandBackend::checkBufferSwap, can you check that?

zzag added a comment.Mar 26 2019, 2:56 PM

I wonder if we could check whether there is an output with pending frame callback instead.

apol added a comment.Mar 26 2019, 3:07 PM
In D20056#438727, @zzag wrote:

Hmm, WaylandBackend::checkBufferSwap should call Compositor::bufferSwapComplete after all outputs are rendered. Most likely we're hitting the TODO comment in WaylandBackend::checkBufferSwap, can you check that?

I checked, and no, it's not being hit.

In D20056#438736, @zzag wrote:

I wonder if we could check whether there is an output with pending frame callback instead.

I don't really understand why you want to try something different. This is using the same behaviour we have on the Egl backend, which this should be mimicking, AFAIU.

apol updated this revision to Diff 54861.Mar 26 2019, 4:06 PM

Discussed it further with vlad

zzag accepted this revision.Mar 26 2019, 4:11 PM

Hmm, the crash goes away. Though now screen content is not updated when there are 2 or more outputs (in either case it seems to be unrelated to this patch).

This revision is now accepted and ready to land.Mar 26 2019, 4:11 PM
apol added a comment.Mar 26 2019, 4:19 PM
In D20056#438753, @zzag wrote:

Hmm, the crash goes away. Though now screen content is not updated when there are 2 or more outputs (in either case it seems to be unrelated to this patch).

The former approach to fix the issue didn't have this behaviour... I'll take another look.

apol added a comment.Mar 26 2019, 5:13 PM

Yes, seems unrelated, for some reason Surface stops emitting frameRendered, I don't really know why.

zzag added a comment.EditedMar 26 2019, 6:16 PM

The reason why it stops emitting frameRendered signal is that the damage region gets occluded for the first output. Thus, the egl backend won't call presentOnSurface. In other words, we are hitting the TODO comment now.

This revision was automatically updated to reflect the committed changes.