Bug 382748 - XWayland rendering artifacts with KWIN_COMPOSE=Q
Summary: XWayland rendering artifacts with KWIN_COMPOSE=Q
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: scene-qpainter (other bugs)
Version First Reported In: git master
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL: https://phabricator.kde.org/D6952
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-26 11:34 UTC by Fabian Vogt
Modified: 2017-08-02 17:30 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:
mgraesslin: Wayland+
mgraesslin: X11-
mgraesslin: ReviewRequest+


Attachments
Screenshot (164.69 KB, image/png)
2017-07-26 11:34 UTC, Fabian Vogt
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Fabian Vogt 2017-07-26 11:34:22 UTC
With KWIN_COMPOSE=Q, Xwayland windows seem to be drawn at a size different from the native pixmap. They appear squashed and do not fill the window borders.
Screenshot attached, the konsole on the top is an X window, the konsole in the background a native wayland client.
Comment 1 Fabian Vogt 2017-07-26 11:34:40 UTC
Created attachment 106873 [details]
Screenshot
Comment 2 Martin Flöser 2017-07-26 14:46:55 UTC
is it also scaled down? I mean if you move the mouse over the menu does it highlight at the correct positions?
Comment 3 Fabian Vogt 2017-07-26 15:00:32 UTC
(In reply to Martin Flöser from comment #2)
> is it also scaled down? I mean if you move the mouse over the menu does it
> highlight at the correct positions?

It's only the drawing that's wrong, if I try xeyes, the offset between cursor and eye increases the further away the cursor is from (0/0), the top left.
Comment 4 Martin Flöser 2017-07-26 15:08:25 UTC
Just tried myself and yes only drawing is wrong.
Comment 5 Martin Flöser 2017-07-26 15:21:55 UTC
Problematic code: 
    const QRect target = QRect(toplevel->clientPos(), toplevel->clientSize());
    const QRect src = QRect(toplevel->clientPos() + toplevel->clientContentPos(), pixmap->image().size());

the image size does not match clientSize in the X11 case.
Comment 6 Martin Flöser 2017-07-27 15:10:25 UTC
Git commit 54ca2bba25a30b2ff151521bcf5f8135d7bdd69d by Martin Flöser.
Committed on 27/07/2017 at 15:09.
Pushed by graesslin into branch 'master'.

[autotests] Add test case for incorrect rendering of XWayland on SceneQPainter

M  +1    -1    autotests/integration/CMakeLists.txt
M  +86   -0    autotests/integration/scene_qpainter_test.cpp

https://commits.kde.org/kwin/54ca2bba25a30b2ff151521bcf5f8135d7bdd69d
Comment 7 Martin Flöser 2017-07-27 15:50:51 UTC
Possible patch at: https://phabricator.kde.org/D6952
Comment 8 Martin Flöser 2017-08-02 17:30:50 UTC
Git commit 20e314d151e002b85419a284a4dced9214426018 by Martin Flöser.
Committed on 02/08/2017 at 17:30.
Pushed by graesslin into branch 'master'.

Properly render XWayland windows in SceneQPainter

Summary:
The buffer for a XWayland window is larger than the actual size. Thus
we need to use the clientSize as reference, not the buffer size.

Test Plan: Test passes

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6952

M  +0    -1    autotests/integration/scene_qpainter_test.cpp
M  +6    -1    scene_qpainter.cpp

https://commits.kde.org/kwin/20e314d151e002b85419a284a4dced9214426018