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

amdgpu/msm: xorgxrdp v0.10.2 does not work for hardware acceleration, but v0.10.1 does! #341

Closed
ChipZhang opened this issue Aug 25, 2024 · 18 comments · Fixed by #344
Closed

Comments

@ChipZhang
Copy link

ChipZhang commented Aug 25, 2024

version hardware accerlation (run glxinfo | grep Accelerated in an XRDP session)
xrdp v0.10.0 + xorgxrdp v0.10.1 yes
xrdp v0.10.1 + xorgxrdp v0.10.1 yes
xrdp v0.10.0 + xorgxrdp v0.10.2 no
xrdp v0.10.1 + xorgxrdp v0.10.2 no

Configure options for xrdp:

--prefix=/usr
--libdir=/usr/lib/x86_64-linux-gnu
--libexecdir=/usr/lib/x86_64-linux-gnu
--build=x86_64-linux-gnu
--enable-ipv6
--enable-vsock
--enable-pam
--enable-pam-config=debian
--with-socketdir=/run/xrdp
--enable-jpeg
--disable-tjpeg
--enable-pixman
--disable-fdkaac
--enable-opus
--enable-mp3lame
--enable-painter
--enable-rfxcodec
--enable-rdpsndaudin
--enable-fuse
--disable-xrdpvr
--disable-neutrinordp
--disable-ulalaca

Configure options for xorgxrdp:

--prefix=/usr
--libdir=/usr/lib/x86_64-linux-gnu
--libexecdir=/usr/lib/x86_64-linux-gnu
--build=x86_64-linux-gnu
--enable-glamor

I compiled and tested for Ubuntu 20.04, 22.04, 24.04, tested for desktop KDE and Cinnamon.
And I use the same options as above for diffrent trials.
The result is the same: xorgxrdp v0.10.1 works, xorgxrdp v0.10.2 doesnt.

@matt335672
Copy link
Member

Could be #322

Have a look in the xorgxrdp log file.

@jsorg71
Copy link
Contributor

jsorg71 commented Aug 26, 2024

Is this right ? 'glxinfo | Accelerated' Looks like a typo to me.
We added a driver check you can manually edit /etc/X11/xrdp/xorg.conf to add your driver if this is the issue.
You can look in ~/.xorgxrdp.10.log to see driver name.

@auggie246
Copy link

auggie246 commented Aug 27, 2024

@jsorg71

Is this right ? 'glxinfo | Accelerated' Looks like a typo to me. We added a driver check you can manually edit /etc/X11/xrdp/xorg.conf to add your driver if this is the issue. You can look in ~/.xorgxrdp.10.log to see driver name.

I am facing an issue where I do not see the effects of acceleration. Am i suppose to see Xorg and gnome processes be listed in nvidia-smi ? Currently I don't.
FYI, I am running this on a GCP VM with NVIDIA L4 GPU. I don't suppose this setup does not work with a server GPU

I am using your nvenc branch, built with

# for xrdp
XRDP_NVENC_CFLAGS="-I/usr/local/cuda-12.4/include -I$HOME/Video_Codec_SDK_12.2.72/Interface" XRDP_NVENC_LIBS="-lcuda -lnvidia-encode" ./configure --enable-vsock --enable-jpeg --enable-fuse --enable-pixman --enable-opus --enable-mp3lame --enable-x264 --enable-nvenc

# for xorgxrdp
./configure --with-simd --enable-lrandr

My /etc/X11/xrdp/xorg.conf, adding nvidia to Module and nvidia to DRMAllowList

Section "ServerFlags"
    # This line prevents "ServerLayout" sections in xorg.conf.d files
    # overriding the "X11 Server" layout (xrdp #1784)
    Option "DefaultServerLayout" "X11 Server"
    Option "DontVTSwitch" "on"
    Option "AutoAddDevices" "off"
    Option "AutoAddGPU" "off"
EndSection

Section "Module"
    Load "dbe"
    Load "ddc"
    Load "extmod"
    Load "nvidia" # added this
    Load "glx"
    Load "int10"
    Load "record"
    Load "vbe"
    Load "xorgxrdp"
    Load "fb"
EndSection

Section "InputDevice"
    Identifier "xrdpKeyboard"
    Driver "xrdpkeyb"
EndSection

Section "InputDevice"
    Identifier "xrdpMouse"
    Driver "xrdpmouse"
EndSection

Section "Monitor"
    Identifier "Monitor"
    Option "DPMS"
    HorizSync 30-80
    VertRefresh 60-75
    ModeLine "1920x1080" 138.500 1920 1968 2000 2080 1080 1083 1088 1111 +hsync -vsync
    ModeLine "1280x720" 74.25 1280 1720 1760 1980 720 725 730 750 +HSync +VSync
    Modeline "1368x768" 72.25 1368 1416 1448 1528 768 771 781 790 +hsync -vsync
    Modeline "1600x900" 119.00 1600 1696 1864 2128 900 901 904 932 -hsync +vsync
EndSection

Section "Device"
    Identifier "Video Card (xrdpdev)"
    Driver "xrdpdev"
    Option "DRMDevice" "/dev/dri/renderD128"
    Option "DRI3" "1"
    Option "DRMAllowList" "nvidia amdgpu i915 radeon" # added nvidia
EndSection

Section "Screen"
    Identifier "Screen (xrdpdev)"
    Device "Video Card (xrdpdev)"
    # Comment out this line for xorg < 1.18.0
    GPUDevice ""
    Monitor "Monitor"
    DefaultDepth 24
    SubSection "Display"
        Depth 24
        Modes "640x480" "800x600" "1024x768" "1280x720" "1280x1024" "1600x900" "1920x1080"
    EndSubSection
EndSection

@jsorg71
Copy link
Contributor

jsorg71 commented Aug 27, 2024

@auggie246 You should be using /etc/X11/xrdp/xorg_nvidia.conf, not /etc/X11/xrdp/xorg.conf. You will need to edit /etc/xrdp/sesman.ini to change that. You should also turn on accel_issist too.
Yes you should see processes using the driver with nvidia-smi.

@auggie246
Copy link

auggie246 commented Aug 28, 2024

@auggie246 You should be using /etc/X11/xrdp/xorg_nvidia.conf, not /etc/X11/xrdp/xorg.conf. You will need to edit /etc/xrdp/sesman.ini to change that. You should also turn on accel_issist too. Yes you should see processes using the driver with nvidia-smi.

Thanks i finally got everything working. However dynamic scaling is not working and mouse is limited to work in a very small region (green being the max point, black being where i was right clicking)
image

This is my xorg_nvidia.conf

Section "ServerLayout"
  Identifier "XRDP GPU Server"
  Screen 0 "dGPU"
  InputDevice "xrdpMouse" "CorePointer"
  InputDevice "xrdpKeyboard" "CoreKeyboard"
EndSection

Section "ServerFlags"
  # This line prevents "ServerLayout" sections in xorg.conf.d files
  # overriding the "XRDP GPU Server" layout (xrdp #1784)
  Option "DefaultServerLayout" "XRDP GPU Server"
  Option "DontVTSwitch" "on"
  Option "AutoAddDevices" "off"
EndSection

Section "Module"
  Load "xorgxrdp"
EndSection

Section "InputDevice"
  Identifier "xrdpKeyboard"
  Driver "xrdpkeyb"
EndSection

Section "InputDevice"
  Identifier "xrdpMouse"
  Driver "xrdpmouse"
EndSection

Section "Monitor"
  Identifier "Monitor0"
  HorizSync 28.0-80.0
  VertRefresh 48.0-75.0
  Modeline "1920x1080_60.00" 172.80 1920 2040 2248 2576 1080 1081 1084 1118 -HSync +Vsync
EndSection

Section "Screen"
  Identifier "dGPU"
  Device "dGPU"
  Option "DPI" "96 x 96"
  Monitor "Monitor0"
# T4 needs an entry here, this is not the desktop size
  SubSection "Display"
    Virtual 1920 1080
  EndSubSection
EndSection

Section "Device"
  Identifier "dGPU"
  Driver "nvidia"
# T4 may need to comment out next line
  # Option "UseDisplayDevice" "none"
  Option "ConnectToAcpid" "false"
  BusID "PCI:0:3:0"
EndSection

@jsorg71
Copy link
Contributor

jsorg71 commented Aug 28, 2024

@auggie246 I know about the dynamic resizing and am working on it. You must be using a GRID GPU, if you change the
Virtual 1920 1080
to
Virtual 4000 2000
it helps but this is a NVidia limitation and I'm trying to get one of these GPU so I can hack on it.
Anyway, lets start a new issue as we are kinda hijacking this one.

@gaberowe
Copy link

gaberowe commented Sep 1, 2024

Hi, this change also broke "msm" (definitely not easy to narrow down that this was the reason without a bit of tracing thru Xorg / xrdp) and now debian unstable ships this xorg new version, so by default anybody on debian unstable on arm64 laptops will hit this (I believe in just the past few days this xorgxrdp version went out).

I can report that "msm" has worked with glamor for a while (past few years at least), so it would be fantastic if msm could be added to this list here like this: (or whatever else should be in here) :

Option "DRMAllowList" "nvidia amdgpu i915 radeon msm"

Just tested and this fixes latest xorgxrdp + msm.

@matt335672
Copy link
Member

@jsorg71 - thoughts about adding msm to the approved drivers list?

From what I can see, this is part of the Snapdragon SoC

@ChipZhang
Copy link
Author

ChipZhang commented Sep 2, 2024

@matt335672
Thanks. The problem is fixed.
Actually, GPU should be explicitly whitelisted in config files.
I added amdgpu to /etc/X11/xrdp/xorg.conf and it works now.
Probably you'd better note this point more obviously in README or WIKI.
I wasted lots of time to debug this issue!

@ChipZhang
Copy link
Author

ChipZhang commented Sep 2, 2024

Is this right ? 'glxinfo | Accelerated' Looks like a typo to me

You're right. It is a typo. I fixed it.

@matt335672
Copy link
Member

That's a good point @ChipZhang. A lot of our users may be using amdgpu.

I've edited the release note for 0.10.2 to make this clearer:-

https://github.com/neutrinolabs/xorgxrdp/releases/tag/v0.10.2

@metalefty - please be aware I've added this to the v0.10.2 known issues.

@gaberowe
Copy link

gaberowe commented Sep 2, 2024

Hi thanks for working on this, and I appreciate your work on xrdp over the years I definitely use it a ton.

Yea it looks like initially there was a report that some nvidia users using glamor were getting a black screen -- which I believe means it was failing to fall back to swrast when Xorg started. (feels like a bug on that platform, but not sure).
On other platforms it does fall back to swrast -- but then they will later (maybe?) detect that they are using swrast only and have issues with GPU acceleration (where GPU acceleration is a great feature of xrdp compared to other solutions).

So given that this (I think) was coming from reports of specific drivers having problems, if we used a Disallowlist -- that'd probably avoid lots of people discovering this in the next 1-2 months as they discover that xrdp + gpu acceleration is broken on their platform / come here complaining etc. And if particular users want to disallow their nvidia gpu or whatever because it is not falling back to swrast or they have bugs with their driver, then they can do that by putting "nvidia" in the Disallowlist. Putting a big list by default I think will likely still end up missing some driver or some strange combination of things like somebody who is trying to get new drivers working etc.

I can make a quick patch to send if you want as well to help out.

@gaberowe
Copy link

gaberowe commented Sep 2, 2024

I ended up making a patch anyway with a DRMDisallowList in case its useful and verified it works, lemme know and I'll send over.

@matt335672
Copy link
Member

Thanks for the offer @gaberowe

It's early days for the allow list, and (personally) I still think it's a preferred approach.

Since you've offered us code however (which is always nice) I feel I offer you a fuller explanation.

There are some small computers out there (i.e. PI sized) where hardware acceleration is provided as a binary blob as part of a kernel. These seem to be pushed out fairly rapidly. The acceleration works on the console, but it's never been tested with a remote session so doesn't always work with xrdp, or only works when the graphical console is not enabled. As a result, xrdp doesn't work out-of-the box, or (even worse) works some of the time but isn't reliable. It can be made to work without hardware acceleration, but this requires user intervention. See #2060 for an example of where this has happened.

My own thinking is the more that xrdp works out-of-the-box, the more we can get it used by people. This benefits everyone.

@gaberowe
Copy link

gaberowe commented Sep 5, 2024

Hi @matt335672 -- sure sounds reasonable -- I had not seen any additional changes here:
https://github.com/neutrinolabs/xorgxrdp/blob/devel/xrdpdev/xorg.conf#L56
with this discussion -- so was just wondering were you waiting for something more beyond people sort of showing up randomly and saying "hey please add my driver back since it works for me"? Or was there further data you needed from people?

@matt335672
Copy link
Member

I'll put a PR together and get one of the other guys to review it. I see amdgpu was already added.in #328 / #329

@matt335672 matt335672 changed the title xorgxrdp v0.10.2 does not work for hardware accerlation, but v0.10.1 does! amdgpu/msm: xorgxrdp v0.10.2 does not work for hardware acceleration, but v0.10.1 does! Sep 5, 2024
@matt335672 matt335672 linked a pull request Sep 5, 2024 that will close this issue
@gaberowe
Copy link

gaberowe commented Sep 5, 2024

oh my bad forgot to look at PR's thanks for that!

@jsorg71
Copy link
Contributor

jsorg71 commented Sep 12, 2024

I'm surprised and happy to see glamor used on these non intel / amd systems. I did some work on making the shaders in rdpEgl.c more portable. For example it works with VMWare virtual GPU and should work with more embedded devices. Getting a list of what devices are using glamor will help with testing. The branch is glsl_float1

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

Successfully merging a pull request may close this issue.

5 participants