<table><tr><td style="">zzag created this revision.<br />zzag added a reviewer: KWin.<br />Herald added a project: KWin.<br />Herald added a subscriber: kwin.<br />zzag requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D29250">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>Currently, synchronized resizing for X11 clients on Wayland is disabled<br />
because updateXTime() is implemented only for the standalone X11 platform.<br />
We cannot make roundtrips to Xwayland to query its current X11 time stamp<br />
because we may end up in a dead lock. On the other hand, we cannot query<br />
the time stamp asynchronously because doing so may introduce a lot of<br />
regressions. The best option what we've got is to guess Xwayland's X11<br />
time stamp. Fortunately, we know that Xwayland uses the system monotonic<br />
time for time stamps. So, we can query the monotonic time in<br />
updateXTime(). Note that when KWin is not running as a Wayland window<br />
manager, it still does roundtrips to the X server.</p>

<p>Unfortunately, providing an implementation for updateXTime() and moving<br />
the sync alarm filter to the toplevel directory is not enough. The latest<br />
stable release of Xwayland (1.20.8) doesn't use multiple window buffers.<br />
So, it's quite possible that an X11 client may update the buffer after<br />
it's been committed and not released by the compositor yet. In our case,<br />
when the frame window is resized, the buffer will be destroyed. This in<br />
its turn _may_ render the previous and the current window pixmap invalid.</p>

<p>There are several ways to work around the window pixmap issue. (a) Just<br />
ignore it. We probably don't want to do it because visual artifacts<br />
caused by invalid window pixmaps are relatively severe. (b) Scratch the<br />
contents of the buffer when the surface is committed rather than late in<br />
the rendering process. The main drawback of this approach is that it<br />
means we need to perform unnecessary copy operations if the client has<br />
attached more than one shm buffer during a vblank interval. (c) Enable<br />
synchronize resizing for Xwayland that uses multiple window buffers.</p>

<p>Even with all of its drawbacks, the option (b) is quite tempting since<br />
it makes window pixmap management a little bit robust. However, it'd<br />
require changes in the buffer management code, which I personally would<br />
like to avoid. So, instead, I've picked the option (c). With the addition<br />
of multiple window buffers in Xwayland 1.21, there should not be any<br />
severe visual artifacts during a resize operation and we don't have to<br />
tweak our buffer management code.</p>

<p>In order to disable synchronized resizing for Xwayland clients, this<br />
patch series has introduced a new client class - XwaylandClient. The new<br />
class is used to represent X11 clients that are connected to Xwayland.<br />
The X11Client class is used to represent X11 clients when KWin runs as<br />
not a Wayland window manager. The new class also allows to specialize<br />
some code that is irrelevant to X11Client.</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Built xserver from git, resized an X11 client that supports<br />
_NET_WM_SYNC_REQUEST.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R108 KWin</div></div></div><br /><div><strong>BRANCH</strong><div><div>xwayland-synchronized-resize</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D29250">https://phabricator.kde.org/D29250</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>CMakeLists.txt<br />
platform.cpp<br />
platform.h<br />
plugins/platforms/x11/standalone/CMakeLists.txt<br />
plugins/platforms/x11/standalone/sync_filter.cpp<br />
plugins/platforms/x11/standalone/sync_filter.h<br />
plugins/platforms/x11/standalone/x11_platform.cpp<br />
plugins/platforms/x11/standalone/x11_platform.h<br />
syncalarmx11filter.cpp<br />
syncalarmx11filter.h<br />
workspace.cpp<br />
workspace.h<br />
x11client.cpp<br />
x11client.h<br />
xwaylandclient.cpp<br />
xwaylandclient.h</div></div></div><br /><div><strong>To: </strong>zzag, KWin<br /><strong>Cc: </strong>kwin, Orage, cacarry, LeGast00n, The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, mkulinski, ragreen, jackyalcine, iodelay, crozbo, bwowk, ZrenBot, ngraham, alexeymin, himcesjf, lesliezhai, ali-mohamed, hardening, romangg, jensreuterberg, abetts, sebas, apol, ahiemstra, mart<br /></div>