stephane-13 / gnome-shell-extension-dim-background-windows

A gnome shell extension dimming background / non-focused windows
20 stars 3 forks source link

Blur on wayland fractional scaling #27

Open Susensio opened 3 months ago

Susensio commented 3 months ago

I'm getting some blur on Wayland hidpi displays using fractional scaling. It does not look too bad but I think this is not the intended behaviour.

Here I'm toggling the extension, brightness and saturation is at 100, so no changes should be seen. A slight change in focus is seen. Screencast from 2024-07-22 08-33-05.webm

stephane-13 commented 2 months ago

Thanks for your feedback.

I think the issue is some unwanted interaction between the fractional scaling itself, the Wayland compositor and the GPU driver. The dimming shader of the extension has no specific control on the blur effect that you have recorded. The shader is executed on the graphic card, and there is no code that would lead to a blur effect in any way, it only affects the color of each fragment (pixel) individually, without any blending with adjacent fragments.

I set my own display to a 100% and then 125% fractional scaling and I saw no blur effect when toggling the extension on and off with any of those settings. I even used a magnifying glass to make sure that my eyes weren't the problem :smile:.

For the record, I'm using Wayland with an AMD graphic card and a 4K@60Hz HDMI monitor.

If you're using a Nvidia card, you may want to try the proprietary driver vs the nouveau driver, it might have an impact. And if you're using the proprietary driver, you might want to check the quality settings in the Nvidia control panel and see if it makes a difference.

Susensio commented 2 months ago

I'm using a integrated graphics card on an Intel i3-8140U, so no AMD drivers problem. I don't know how to debug this.. lately the blurrines has worsen. I'll try to make a screenshot.

For the record, I'm using Wayland with an AMD graphic card and a 4K@60Hz HDMI monitor.

what size? do you not use fractional scaling on those resolutions?

stephane-13 commented 2 months ago

My monitor is a 55", so I don't need to use fractional scaling. But that didn't prevent me for enabling it and testing 100% and 125%, and I couldn't see any blur effect with the extension on or off.

Maybe you can try to see if the blur effect only happens on some specific application(s), like QT for example. Fractional scaling support is not yet perfect. It's slightly worse on newer things like Plasma 6, but Wayland had it's share of issues in the past years - fractional support is fairly recent. So I'm not entirely surprised that it's not working perfectly under some circumstances.

As far as fixing this blur issue in the extension goes, my options are quite limited. On Gnome the dimming has to be done with a shader, which has to be executed by the GPU. If that introduces blur because - for example - the graphic driver decides to decrease the image quality a bit to favor performance, there is not much I can do in the code. While such performance vs quality tweak wouldn't be noticeable in games, it can obviously become a problem with sharp text on a desktop.

Susensio commented 2 months ago

image

stephane-13 commented 2 months ago

That definitely looks awful, and it really looks like the shader is applied with a strongly decreased rendering quality. It would be interesting to see if other users using Intel integrated graphics have the same issue. I will continue to investigate this, but so far I didn't find anything conclusive.

Susensio commented 2 months ago

Thanks you @stephane-13 . Let me know if I can do anything to debug this. I must say that this level of blurriness is not instantaneous and it only happens sometimes.

When focus is lost, a slight nearly imperceptible blur appears. Sometimes, after some time (or some event that I've have not figured out yet), it get worse as seen in the last picture.