wslg icon indicating copy to clipboard operation
wslg copied to clipboard

WSLg does not seem to support fractional scaling

Open EndPositive opened this issue 3 years ago • 71 comments

Environment

Microsoft Windows [Version 10.0.21364.1] 
kali-linux 2021.1
1.0.17.1]

Steps to reproduce

Set display scaling to 150%. Open a graphical application on that monitor (or move it to that monitor).

Expected behavior

The application scales according to the windows display scaling settings.

Actual behavior

wslg only seems to support 100% and 200% as display scales.

EndPositive avatar Apr 21 '21 21:04 EndPositive

@EndPositive, this is currently disabled by default, it can be enabled by WESTON_RDP_DISABLE_FRACTIONAL_HI_DPI_SCALING=false. This is disabled due to scaling quality in RDP client software.

hideyukn88 avatar Apr 21 '21 22:04 hideyukn88

I am also having this issue on my surface go 2 at 150% scale. I attempted to use WESTON_RDP_DISABLE_FRACTIONAL_HI_DPI_SCALING=false under [wsl2] in my WSL config file and it did not work. I did restart wsl.

r3dlobst3r avatar Apr 22 '21 01:04 r3dlobst3r

Sorry, I should have put more clearly, please create a file named .wslgconfig at c:\ProgramData\Microsoft\WSL (or /mnt/c/ProgramData/Microsoft/WSL/.wslgconfig from Linux) with contents of below, and restart WSL with wsl --shutdown or wsl --terminate [distro name].

[system-distro-env] WESTON_RDP_DISABLE_FRACTIONAL_HI_DPI_SCALING=false

hideyukn88 avatar Apr 22 '21 02:04 hideyukn88

Is there already a plan when fractional scaling is supported? Almost all new monitors are 4K or more and some text scaling in Windows is very common.

ayalon avatar Jun 23 '21 14:06 ayalon

With both .wslconfig options turned off, there is this strange behavior.

On a 4K monitor - Firefox / Chrome have proper scaling and they look good, even the mouse cursor image

But gtk 3 apps such as gedit are double the size and the mouse cursor is huge image

Maybe this reporting helps, thanks, wslg is awesome!

iongion avatar Oct 17 '21 10:10 iongion

It seems that if I am at 150% then the Linux app automatically goes to 100%, I want the opposite. Is there any way workaround to have a 150% and obtain a 200% result on the Linux apps?

ghost avatar Oct 26 '21 15:10 ghost

@adelicato, currently that's not possible, unless building custom version of system-distro. If you are interested in, you can modify below line of code, which currently drops fractional part by casting to int, but it can be changed to round it up. Thanks!

https://github.com/microsoft/weston-mirror/blob/working/libweston/backend-rdp/rdpdisp.c#L85

hideyukn88 avatar Oct 26 '21 17:10 hideyukn88

Any hope that Windows scaling 150% -> wsl 200% will be implemented any time? with option, for example... because WESTON_RDP_DISABLE_FRACTIONAL_HI_DPI_SCALING=false gives very blurry fonts

user9931 avatar Nov 13 '21 14:11 user9931

I have the same issue.

ayalon avatar Nov 24 '21 09:11 ayalon

same here.

hjgarcia1 avatar Dec 12 '21 04:12 hjgarcia1

Any updates? This is still going from the start of WSLG, and no one ever thinks about fixing this problem at all? Having good quality for graphical desktop inside WSL should be mandatory when you are releasing a product like that, not optional.

ThalusA avatar Dec 22 '21 11:12 ThalusA

Any updates? This is still going from the start of WSLG, and no one ever thinks about fixing this problem at all? Having good quality for graphical desktop inside WSL should be mandatory when you are releasing a product like that, not optional.

It still can depends on Linux side, because Linux since years doesn't support Mixed DPI or has great DPI support in general, and I am not sure if Microsoft can do anything about that anyway. But I still have an hope.

memegauste avatar Dec 25 '21 19:12 memegauste

Hi folks, we've made an update in the latest version of WSLg that is available with WSL in the Microsoft Store to change the behaviour where 150% Windows scaling will now go up to 200% WSLg scaling. Please try it out and give us any feedback that you have!

craigloewen-msft avatar Jan 24 '22 20:01 craigloewen-msft

@craiglowewn-msft: Is there anyway to make 150% Windows scaling = 150 WSLg scaling? 200% makes gnome programs (e.g., gedit) and the mouse cursor huge! As noted above, WESTON_RDP_DISABLE_FRACTIONAL_HI_DPI_SCALING=false makes the windows and cursor the proper size, but gives very blurry fonts.

sandain avatar Jan 24 '22 23:01 sandain

It looks like fractional scaling doesn't actually work. I found that setting WESTON_RDP_DEBUG_DESKTOP_SCALING_FACTOR=150 either does nothing, or gets rounded to 200%. WESTON_RDP_DEBUG_DESKTOP_SCALING_FACTOR=100 gives me the 100% scaling that I expect (without the blurry fonts the WESTON_RDP_DISABLE_FRACTIONAL_HI_DPI_SCALING options does). Of course I would rather have 150% scaling, but I'll take 100% over 200% any day.

PR #53 should be reverted since it doesn't fix the real problem, and makes things arguable worse.

sandain avatar Jan 25 '22 00:01 sandain

All due respect @sandain I believe we are trying to solve the opposite problem. The default experience used to be 150% => 100%, which makes thing too hard to read, so in the latest build they are trying to switch the default to 150% => 200%. Now you are complaining that it's too big haha. I guess we will simply need to wait until non-blurry fractional become a thing.

khuongduybui avatar Jan 25 '22 01:01 khuongduybui

Also @EndPositive I saw that you both thumbed up and thumbed down on Craig's post above? lol

khuongduybui avatar Jan 25 '22 02:01 khuongduybui

Whoops, corrected. As you said, a simple round up/down won't suffice in most cases.

EndPositive avatar Jan 25 '22 02:01 EndPositive

@khuongduybui: It seems the goal should be 150%=>150% or 125%=>125%. Rounding up or down is not ideal. At least with rounding down, as it was, it is easy to increase font sizes. With rounding up by default, window decorations take up a ridiculous amount of screen real estate, and I don't know an easy way to work around that on the Linux end of things.

Requiring the use of a poorly documented debugging option (that doesn't actually give you what you ask for) to work around your "fix" (#53) is the opposite of user friendly.

sandain avatar Jan 25 '22 16:01 sandain

is any hack way to make the gui app smaller for this moment? after set WESTON_RDP_DISABLE_FRACTIONAL_HI_DPI_SCALING=false still looks very big , even the mouse cursor is very big too

eggcaker avatar Jan 29 '22 01:01 eggcaker

@eggcaker Add WESTON_RDP_DEBUG_DESKTOP_SCALING_FACTOR=100 to c:\Users\[your user name]\.wslgconfig

sandain avatar Jan 29 '22 04:01 sandain

I know this is unrelated to fractional scaling, but I have a Surface Book 3. It's recommended scaling is 200%.

Apps are still super blurry, I thought with integer scaling everything should be fine?

ryantheleach avatar Feb 12 '22 11:02 ryantheleach

@ryantheleach, unfortunately no, please refer https://github.com/microsoft/wslg/issues/3, whenever there is post scaling, the quality of scaling is not ideal currently.

hideyukn88 avatar Feb 13 '22 16:02 hideyukn88

I guess it would be better off to add an option to make 150% Windows scaling set WSLg scaling to 100% for those who need it. I have a 1080x1920p display and 200% looks too big (just unusable, big portions of the UI out of the screen).

Note that setting WESTON_RDP_DEBUG_DESKTOP_SCALING_FACTOR=100 doesn't work for me.

Skaldebane avatar Mar 05 '22 21:03 Skaldebane

@Skaldebane, we reverted the change to round up the scaling factor. And "WESTON_RDP_DEBUG_DESKTOP_SCALING_FACTOR=100" should work, how do you configure it? Please refer https://github.com/microsoft/wslg/wiki/WSLg-Configuration-Options-for-Debugging.

hideyukn88 avatar Mar 07 '22 16:03 hideyukn88

FYI I ended up here trying to fix the "problem" that 150% => 200%. Applications are HUGE! I'd rather have a little bit of blur than a giant app with no room to move. I am using 150% because I NEED the screen real estate. If I wanted 200% id already be using that in windows. And if the blur is a problem then Id rather 100% over the giants any day of the week because naturally, I am using a large 4k screen not a tiny 4k screen.

So are we actually trying to use fractional scaling here or argue over what nonfractional scaling is better?

How can I actually enable fractional scaling? can we talk about a hack for that instead? (I don't care if its blurry just want to see it for myself)

b-hayes avatar Mar 22 '22 04:03 b-hayes

try

WESTON_RDP_DISABLE_HI_DPI_SCALING=false
WESTON_RDP_DISABLE_FRACTIONAL_HI_DPI_SCALING=false

WESTON_RDP_DEBUG_DESKTOP_SCALING_FACTOR=150

However, this results in ugly pixelated scaling rather than blurry. This is probably why it's disabled by default

abarisain avatar Mar 23 '22 07:03 abarisain

@abarisain thanks for the suggestion but doesn't appear to do anything.

try

WESTON_RDP_DISABLE_HI_DPI_SCALING=false
WESTON_RDP_DISABLE_FRACTIONAL_HI_DPI_SCALING=false
WESTON_RDP_DEBUG_DESKTOP_SCALING_FACTOR=150

This doesn't do anything. I get 200% scaling with HIDPI matter what. I'm guessing this needs to be in user/.wslconfig under a [system-distro-env] heading yeah? Please let me know how to use those settings.

However, this results in ugly pixelated scaling rather than blurry. This is probably why it's disabled by default I guess so. It will only replicate 100% scaling on a 1440p screen tho shouldn't be as bad as giant 200% UI.

@craigloewen-msft

150% Windows scaling will now go up to 200% WSLg scaling

So you just removed fractional scaling entirely instead of fixing it? Can you at least add an option to enable it again so I don't have to have this back n forth in GitHub trying to hack get it?

Rather have a less than perfect version of fractional scaling than to have it removed. The pixelated version is probably better than a blurry one too as that will just replicate looking at a 1440p screen with 100% scaling. Can't be that bad.

Could a better solution be to use 200% and then scale the rendered result down to 150% to make it sharper?

At any rate, Id answer this ticket with:

  1. keep the 150% -> 200% as default but add an option to enable fractional scaling.
  2. latter address the blury/pixely complaint that will no doubt come in another github issue.
  3. try to fix the blurry factional scaling issue or state that its not possible.

b-hayes avatar Mar 27 '22 21:03 b-hayes

No, this goes in .wslgconfig. Note that I'm also running the windows store WSL version.

It's promising. Once the scaling algorithm gets fixed, it will already be better. Then, we need to run at 200% and downscale rather than the opposite.

The pixelated version is super bad in my opinion. It looks worse than looking at a 1440p screen of the same size for two reasons:

  • The scaling is uneven, so it's not only pixelated, it's out of proportion.
  • Pixel perfect pixelated scaling means running at 1080p, which isn't possible. Having run game that way, it's still noticable, more than a native 1080p/1440p screen.

Honestly I've had the best experience downgrading back to a Xorg server and setting Xft.dpi: 144 in ~/.Xresources (this has no effect on wslg). GTK apps don't care, but it makes Intellij, Sublime merge and anything QT work. Good enough for me in the meantime.

I can't wait to go back to wslg, but it's a hard thing to solve: wayland only knows 2x scaling, but compositors downscale to 1.5 (making things look a bit blurry but it's fine. I guess that's the next step for RDP? I'm sure it's in the works), only X can try to do 150%. Linux's hdpi support isn't the best even on a pure linux env: Xwayland can't deal with HDPI either. That's another hurdle wslg will have to overcome: there are PRs in the Linux world to fix Xwayland/HDPI but they've been stuck for years. Sometime a new approach come up, but we're nowhere near a fix.

Note: Both IntelliJ and Sublime Text/Merge allow you to override the scale, which can make 150% work. Unfortunately this still cause issues with some UI elements that don't show up with the Xorg technique.

Could just using 200% and then scaling the rendered result down to 150% to make it sharper be a better solution?

I think that's the plan, they just need time to work on it.

abarisain avatar Mar 27 '22 21:03 abarisain

@abarisain thanks for the detail. I might give Xorg a shot later.

No, this goes in .wslgconfig. Note that I'm also running the windows store WSL version.

I did, and me too. I shutdown wsl too. I must be missing something.

Linux's hdpi support isn't the best even on a pure linux env

Actually, when I tried native Ubuntu it was perfect. No blurring at all. I could even position a window halfway between 2 screens using different DPI's and both rendered at the correct size. Maybe this is a new development and it was bad before, but its currently better than windows.

Might be worth looking into how they are doing it.

b-hayes avatar Mar 27 '22 22:03 b-hayes