Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scaling does not apply with xrdp on Debian 8 using high DPI Surface Pro machine #3200

Closed
niiiksh opened this issue Aug 11, 2024 · 22 comments · Fixed by neutrinolabs/xorgxrdp#334
Labels

Comments

@niiiksh
Copy link

niiiksh commented Aug 11, 2024

xrdp version

0.10.1

Detailed xrdp version, build options

Paste the result between `~~~`.  Please DO NOT remove `~~~`!

Operating system & version

Debian 8

Installation method

Doesn't matter

Which backend do you use?

No response

What desktop environment do you use?

No response

Environment xrdp running on

No response

What's your client?

No response

Area(s) with issue?

Graphic glitches

Steps to reproduce

Connect to xrdp (0.10.1) on Debian 8 using windows remote desktop software with Surface Pro PC (or maybe any other high DPI screen with scaling 150-200%).

✔️ Expected Behavior

Connected screen has scaling applied.

❌ Actual Behavior

Scaling does not apply. Everything is small.

Anything else?

EDIT: Workaround for GNOME desktop environment is:

  1. run gnome-tweak-tool
  2. open Fonts
  3. Set Scaling Factor to appropriate (2,00 for Surface Pro 4 screen)
    It will work until your Remote Desktop client window stays in Surface Screen. If you move window to different screen you need to edit font Scaling Factor manually.
@niiiksh niiiksh added the bug label Aug 11, 2024
@niiiksh
Copy link
Author

niiiksh commented Aug 11, 2024

I should notice that scaling applied right to the size of the screen when I tried to connect to xrdp on Debian 8 using Microsoft Remote Desktop for macOS (MacBook Air M1). Maybe it is macOS feature that used in microsoft's app to fix scaling, anyway its ambiguous.

@matt335672
Copy link
Member

@niiiksh - can you clarify what isn't being scaled? Is it the xrdp login screen or the desktop itself?

Also to get any kind of scaling you need to connect full-screen. If you don't do this, the RDP client won't send physical monitor size information to xrdp. More information here:-

https://github.com/neutrinolabs/xrdp/wiki/Scaleable-login-screen

@niiiksh
Copy link
Author

niiiksh commented Aug 12, 2024

@niiiksh - can you clarify what isn't being scaled? Is it the xrdp login screen or the desktop itself?

Also to get any kind of scaling you need to connect full-screen. If you don't do this, the RDP client won't send physical monitor size information to xrdp. More information here:-

https://github.com/neutrinolabs/xrdp/wiki/Scaleable-login-screen

I use rdp client in fullscreen. Login screen is scaled properly in both cases with client from Windows and macOS. The desktop itself is not scaled somehow when I access xrdp in Debian 8 from Windows rdp client.

@niiiksh niiiksh changed the title Scaling doesn not apply with xrdp on Debian 8 using high DPI Surface Pro machine Scaling does not apply with xrdp on Debian 8 using high DPI Surface Pro machine Aug 12, 2024
@matt335672
Copy link
Member

The login screen code should generate some logging related to the client information sent over about the monitor.

Look for the string DPI in /var/log/xrdp.log following a connection attempt (sudo grep DPI /var/log/xrdp.log)

If you're getting enough info from the client to scale the display you'll see something like:-

Login screen monitor height is 768 pixels over 194 mm (100 DPI)

If not:-

No information is available to determine login screen DPI

@niiiksh
Copy link
Author

niiiksh commented Aug 12, 2024

The login screen code should generate some logging related to the client information sent over about the monitor.

Look for the string DPI in /var/log/xrdp.log following a connection attempt (sudo grep DPI /var/log/xrdp.log)

If you're getting enough info from the client to scale the display you'll see something like:-

Login screen monitor height is 768 pixels over 194 mm (100 DPI)

If not:-

No information is available to determine login screen DPI

I've got this line, so login screen scales to this DPI right I guess.
[2024-08-12T16:23:44.192+0300] [INFO ] Login screen monitor height is 1824 pixels over 10 mm (4632 DPI)
But the desktop environment doesn't scale.
Edit: with this DPI it seems right to scale desktop by 200% so everything looks normal, not small. But it doesn't.

@niiiksh
Copy link
Author

niiiksh commented Aug 12, 2024

@matt335672
Also I got this output from xdpyinfo:

screen #0:
  dimensions:    2736x1824 pixels (724x483 millimeters)
  resolution:    96x96 dots per inch
  depths (7):    24, 1, 4, 8, 15, 16, 32
  root window id:    0x25e
  depth of root window:    24 planes
  number of colormaps:    minimum 1, maximum 1
  default colormap:    0x20
  default number of colormap cells:    256
  preallocated pixels:    black 0, white 16777215
  options:    backing-store WHEN MAPPED, save-unders NO
  largest cursor:    2736x1824

Which says 96x96 dots per inch but should have 253x253 dots per inch (by formula for horizontal or vertical DPI = pixels/inch_length) as my screen is 10,8 horizontal and 7,2 vertical (inches).

@matt335672
Copy link
Member

Edit: We had crossing posts. This refers to your previous post but one
Those values don't look right.

1824 pixels suggests a Surface Pro 4 with a resolution of 2736 x 1824. That's got a resolution of 267 ppi (i.e. DPI) according to wikipedia which should be a display height of (1824 / 267) inches = 6.83 inches = 173.5mm.

Your client is telling the other end that the physical display is 10mm tall! The desktop is possibly ignoring this value.

This looks like a client configuration issue.

@niiiksh
Copy link
Author

niiiksh commented Aug 12, 2024

Edit: We had crossing posts. This refers to your previous post but one Those values don't look right.

1824 pixels suggests a Surface Pro 4 with a resolution of 2736 x 1824. That's got a resolution of 267 ppi (i.e. DPI) according to wikipedia which should be a display height of (1824 / 267) inches = 6.83 inches = 173.5mm.

Your client is telling the other end that the physical display is 10mm tall! The desktop is possibly ignoring this value.

This looks like a client configuration issue.

My mistake, my screen is 260,1x173,5 (mm)
But I don't see any setting for dpi in clients (both Remote Desktop from Microsoft Store and built-in RDP tool in Windows acts same)

@matt335672
Copy link
Member

That I can't really help you with.

Have you tried connecting to another Windows machine? There are some interesting posts regarding the SP4 (e.g.) :-

https://community.spiceworks.com/t/ms-surface-pro-4-issue-rdp-session-resolution-too-fine-everything-too-small/532358/12

@niiiksh
Copy link
Author

niiiksh commented Aug 12, 2024

That I can't really help you with.

Have you tried connecting to another Windows machine? There are some interesting posts regarding the SP4 (e.g.) :-

https://community.spiceworks.com/t/ms-surface-pro-4-issue-rdp-session-resolution-too-fine-everything-too-small/532358/12

yes, I have Windows 10 machine to connect to, and scaling applies right (in full-screen and even in windowed mode on resize too) using "modern" client from Microsoft Store.

Interesting, with built-in client connecting to Debian 8 with xrdp 0.10.1 log prints:
[2024-08-12T17:03:51.447+0300] [INFO ] Login screen monitor height is 1824 pixels over 173 mm (267 DPI)
that seems right.
But desktop environment still doesn't scale with xdpyinfo same:

  dimensions:  2736x1824 pixels (724x483 millimeters)
  resolution:    96x96 dots per inch

@matt335672
Copy link
Member

Yes, that seems right.

Which backend are you using for xorgxrdp, and which desktop?

@niiiksh
Copy link
Author

niiiksh commented Aug 12, 2024

Yes, that seems right.

Which backend are you using for xorgxrdp, and which desktop?

I use xorg (1:7.7+7) and GNOME desktop (3.14.1)
Seems like I found workaround to set Scaling Factor to 2,00 in Fonts in gnome-tweak-tool. And everything looks right on this hiDPI screen. But moving RD client window to another screen with different DPI of course won't change scale factor of the font.

@matt335672
Copy link
Member

Indeed.

I've done some playing about of my own, and I think there's a disconnect between the client physical size info and the information available to the desktop via the RandR extension.

On a physical desktop I'm logged into (with some snipping):-

$ xrandr --listmonitors
Monitors: 1
 0: +DP-1 2560/597x1440/336+0+0  DP-1
$ xrandr -q
Screen 0: minimum 320 x 200, current 2560 x 1440, maximum 16384 x 16384
VGA-1 disconnected (normal left inverted right x axis y axis)
DP-1 connected 2560x1440+0+0 (normal left inverted right x axis y axis) 597mm x 336mm
   2560x1440     59.95*+
  . . .

you can see that RandR knows about the physical monitor size, and that information bubbles down to the DP-1 output.

In a full-screen RDP session on a laptop:-

$ xrandr --listmonitors
Monitors: 1
 0: +*rdp0 1366/361x768/203+0+0  rdp0
$ xrandr -q
Screen 0: minimum 256 x 256, current 1366 x 768, maximum 16384 x 16384
rdp0 connected primary 1366x768+0+0 0mm x 0mm
   1366x768      50.00* 

The monitor size is known about, but this doesn't seem to have propagated down to the outputs.

@jsorg71 - I'd appreciate your input on this. Do we need to add a bit more plumbing to xorgxrdp to propagate this physical size information?

@jsorg71
Copy link
Contributor

jsorg71 commented Aug 12, 2024

@matt335672 Yes I have a patch that propagates the mm to xrandr. We do get it from the client but it's not used. The dpi setting in xdpyinfo is a global dpi setting, the dpi settings in xrandr is per monitor. We can update them both properly.
Unfortunately most application don't use either of these. GTK apps use a setting in xresources. QT too I think. Iit's xft.dpi. You can see it with "xrdb -query". There is another command it set it.
I think even if not all apps use it, we should setup the right dpi in xdpyinfo and xrandr.

@niiiksh
Copy link
Author

niiiksh commented Aug 12, 2024

@matt335672 Yes I have a patch that propagates the mm to xrandr. We do get it from the client but it's not used. The dpi setting in xdpyinfo is a global dpi setting, the dpi settings in xrandr is per monitor. We can update them both properly. Unfortunately most application don't use either of these. GTK apps use a setting in xresources. QT too I think. Iit's xft.dpi. You can see it with "xrdb -query". There is another command it set it. I think even if not all apps use it, we should setup the right dpi in xdpyinfo and xrandr.

@jsorg71 I can confirm Xft.dpi changes when 'Scaling Factor' option changed in gnome-tweak-tool.
Could xrdp change this parameter automatically when it detects client changed physical screen size in mm (e.g. when window moved to another screen) and when client send physical screen size at start?

@niiiksh
Copy link
Author

niiiksh commented Aug 12, 2024

@jsorg71 @matt335672 Especially for GNOME desktop environment this command works too for setting scaling factor (everything rescales right immediately):
gsettings set org.gnome.desktop.interface scaling-factor 2
And maybe this command have some negligible effect too but not as previous:
gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "[{'Gdk/WindowScalingFactor', <2>}]"

@jsorg71
Copy link
Contributor

jsorg71 commented Aug 13, 2024

I read somewhere that GTK 3.0 does have a dpi per monitor setting but I don't know where it reads it from. Maybe another XResource settings, maybe an Atom property on the randr monitor. I didn't have time yet to look into the GTK source.

@jsorg71
Copy link
Contributor

jsorg71 commented Aug 13, 2024

@matt335672 I create neutrinolabs/xorgxrdp#334 to show how to set the mm on the randr outputs.
Like I said, it does not fix this issue but I do think it's the right thing to do.

@matt335672
Copy link
Member

I'll summarise the situation as I see it:-

  1. For full-screen RDP, monitor physical size(s) are sent to xrdp, along with resolutions and offsets
  2. When running the xorgxrdp backend, provided set the mm in randr xorgxrdp#334 is merged (which it will be shortly), xrdp communicates the physical sizes to the Xorg X server
  3. The Xorg X server makes this information available to the desktop via XRANDR
  4. It's up to the desktop to make use of this information to scale apps as required by the user.

During the GFX integration, we put quite a bit of work into xrdp to support the use-case of monitors being plugged and unplugged from laptops. The desktop is notified of this via XRANDR. I don't see this use-case is substantially different from that use-case, so at this point I think we've done all we can for now.

@niiiksh - in addition to the tips you've provided you might want to look at the Xorg section in the HiDPI page on the excellent Arch Wiki at https://wiki.archlinux.org/title/HiDPI#Xorg.

Anyone care to add anything else?

@jsorg71
Copy link
Contributor

jsorg71 commented Aug 14, 2024

I think you are 100% right.
We provide the dpi for each monitor. Apps can efficiently get dpi changes with xrandr.
I'm not sure we want to update xresources or execute gsettings at this point.

@niiiksh
Copy link
Author

niiiksh commented Aug 14, 2024

@jsorg71 Well, I think we can close this issue.
Surely, it would be strange to control user settings through gsettings from xrdp. I'll write a script specific for my DE using provided values for monitors to handle DPI scale to solve my problem if my DE won't update scale automatically.

@matt335672 matt335672 linked a pull request Aug 14, 2024 that will close this issue
@matt335672
Copy link
Member

Thanks @niiiksh

The issue will close automatically when we merge the development fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants