Avoid texture bleed rendering X11 window - New version

Authored by davidedmundson on Dec 4 2019, 1:23 PM.



We currently see a gap on transformed windows between the window and the
top decoration.

This is partly the atlas bleed on the decoration, and partly a bleed on
the window content itself.

On X11, the window we composite is the frame window - which is a larger
texture containing a transparent border where the frame normally would
be. When we sample with a linear filter we include these texels. Hence
GL_CLAMP_TO_EDGE doesn't work.

Vlad's patch to composite the correct window, not the frame was my
preferred approach, but we had to revert it as it caused an issue with
xwayland :(

Half pixel correction nearly worked, but caused blurry fonts.

This patch resolves it in the fragment shader used by effects doing
transforms. We pass the real texture geometry of the window to the
client with a half pixel correction. Any samples outside the outer half
pixel are then clamped within bounds.

Arguably a hack, but solves the problem in a comparatively
non-invasive way.

BUG: 360549
BUG: 257566

Test Plan

Using Vlad's atlas padding for decoration
Slowed animations, wobbled a dark window over a light background
No artifacts

This isn't needed. Now tested that everything still renders the same.

Diff Detail

R108 KWin
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
davidedmundson created this revision.Dec 4 2019, 1:23 PM
Restricted Application added a project: KWin. · View Herald TranscriptDec 4 2019, 1:23 PM
Restricted Application added a subscriber: kwin. · View Herald Transcript
davidedmundson requested review of this revision.Dec 4 2019, 1:23 PM
ngraham edited the summary of this revision. (Show Details)Dec 4 2019, 5:19 PM

I tried this patch in combination with https://phabricator.kde.org/D25611 and it breaks it completely.

See https://jgrulich.fedorapeople.org/Screenshot_20191206_130344.png.

You can see at the bottom and at the top some weird rendering issues. Also all applications are missing menubar. I can see menus highlighted when moving mouse over them, but no text.

Use one of the different geometry methods to get the real texture size

In case it doesn't match the toplevel geometry.

davidedmundson edited the test plan for this revision. (Show Details)Dec 6 2019, 1:42 PM

I tested this now on KWin from master and the scaling seems to work fine, but I experienced broken Plasma, which might be because I installed KWin from master. Basically all Plasma stuff (panel, notifications) were semi-transparent and unclickable.

update to only act on X11

It would conflict with wp_viewporter, and we don't have this problem with
wayland clients.

Arguably we might want this on xwayland, but we can see later

Only set on transformed X11 windows

Easiest path meant a bit of shuffling to get some members earlier

zzag accepted this revision.Jan 8 2020, 9:59 AM
zzag added a subscriber: zzag.

Don't quite like it, but I don't see any other alternative options at the moment.


stray semicolon


stray whitespace

This revision is now accepted and ready to land.Jan 8 2020, 9:59 AM
This revision was automatically updated to reflect the committed changes.