Improve scaled buffer rendering
Closed, ResolvedPublic

Description

In wayland buffer sizes don't always match the output resolution size.

This can happen due to wayland high DPI support, or potentially wl_viewport (when that gets added) where a video player/gamer will render content in whatever size it's most comfortable with and we adjust for the screen.

Right now we just use a regular copying shader with linear filtering.

Kwin does have a lanczos filter that's used during some effects, but not during regular scene painting.

That might be worth enabling. Alternatively other scaling options might be better for the 2x case We might want different min and mag filters.

I used a super super lazy bodge to enable lanczos on random windows:

https://phabricator.kde.org/P319

It's enabled when there's a "10000" in the window title, so could open two different bugs.kde.org bugs in different windows and compare directly.

IMHO the slight blur looks worse than the current state.

zzag added a subscriber: zzag.Feb 15 2019, 3:37 PM

I personally think it's not worth that. Upscaled pixmaps still will be blurry... though we could try some sophisticated deep learning-based approach to upscale images, but that would be way too crazy, running a CNN or a GAN per each frame would require some computational power.

Though it's worth to mention that recent NVIDIA's GPUs do something similar to speedup raytracing.

Yeah, that's crazy, I'm not trying to go into that.

I'm thinking more of: "do we want to set the filtering to linear or nearest."
For downscaling we also have various mipmap options.

zzag added a comment.Feb 18 2019, 8:56 AM

I'm thinking more of: "do we want to set the filtering to linear or nearest."

Well, given that majority of clients have text it's hard to say what we have to use. It would be worth to have some comparison. (I personally would prefer nearest neighbor filtering)

romangg claimed this task.EditedSep 16 2019, 11:03 AM
romangg closed this task as Resolved.
romangg moved this task from Backlog to Done on the KWin board.
romangg added a subscriber: romangg.

Forcing linear filter as in D23986 looks to be enough for downscaling. Mipmaps could still make sense for improving the quality of downscaling further. For upscaling Lanczos filter could make sense but in perfect conditions there is no upscaling needed on Wayland.

Closing this task as resolved therefore. If user feedback says quality of downscaling is lacking, let's create new task especially for mipmap downscaling.