[x11] Fix visual artifacts during interactive resize
ClosedPublic

Authored by zzag on Sat, Jan 25, 12:24 PM.

Details

Summary

When a window is being interactively resized, its contents may jump. The
reason why that happens is because KWin renders partially resized client
window. Composite extension spec says that a window will get a new pixmap
each time it is resized or mapped. This applies to the frame window, but
not to the client window itself. If the client window is resized,
off-screen storage for the frame window won't be reallocated. Therefore,
KWin may render partially resized client window if the client doesn't
attempt to be in sync with our rendering loop. Currently, the only way
to do that is to use extended frame counters, which are not supported by
KWin.

So, in order to fix visual artifacts during interactive resize, we need
somehow forcefully re-allocate off-screen storage for the frame window.
Unfortunately, Composite extension doesn't provide any request to do
that, so the only option we have is to resize the frame window.

BUG: 415839
FIXED-IN: 5.18.0

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
zzag created this revision.Sat, Jan 25, 12:24 PM
Restricted Application added a project: KWin. · View Herald TranscriptSat, Jan 25, 12:24 PM
Restricted Application added a subscriber: kwin. · View Herald Transcript
zzag requested review of this revision.Sat, Jan 25, 12:24 PM
zzag added a comment.Sat, Jan 25, 12:25 PM

Before:

After:

zzag added a comment.Sat, Jan 25, 12:26 PM

I wish we could do xcb_composite_allocate_window_pixmap(xcb_connection_t *connection, xcb_window_t window); or something along the line in doResizeSync().

zzag edited the summary of this revision. (Show Details)Sat, Jan 25, 12:29 PM
zzag added a subscriber: fredrik.Sat, Jan 25, 12:33 PM

@fredrik If you have time, could you please take a look at this change?

zzag added a comment.Sat, Jan 25, 12:34 PM

I know it's terrible, maybe there is another nicer way to fix interactive resizing on X11.

zzag added a comment.Sat, Jan 25, 1:05 PM

This change should also fix screen tearing in Dolphin when it's being resized.

alexde added a subscriber: alexde.Mon, Jan 27, 11:00 AM

Wow, this radically improves the appearance of resizing Dolphin! Very nice.

alexde added a comment.EditedWed, Jan 29, 3:11 PM

Wow, this radically improves the appearance of resizing Dolphin! Very nice.

Yes, I can confirm it, it improves it fairly well!

zzag updated this revision to Diff 74595.Wed, Jan 29, 5:06 PM

Adjust to some of recent changes in X11Client.

The detailed description makes sense and VDG people say it's better..

lets go for it.

zzag updated this revision to Diff 74913.Mon, Feb 3, 11:36 AM

Fix a typo in X11Client::updateServerGeometry().

Do not code in the middle of a night!

zzag edited the summary of this revision. (Show Details)Mon, Feb 3, 11:44 AM
This revision was not accepted when it landed; it landed in state Needs Review.Mon, Feb 3, 12:04 PM
This revision was automatically updated to reflect the committed changes.