LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Figuring out where in the display stack an eGPU + external 4k display is breaking (https://www.linuxquestions.org/questions/linux-hardware-18/figuring-out-where-in-the-display-stack-an-egpu-external-4k-display-is-breaking-4175694540/)

jdally987 04-30-2021 01:46 PM

Figuring out where in the display stack an eGPU + external 4k display is breaking
 
Hey all, I've been dealing with this issue for a long time and never really knew where to start diagnosing the issue, so would just appreciate any advice on where to hone in on the problem.

I have an eGPU and trying to connect my laptop through it to an external display over Thunderbolt.

Here's what I'm working with:
  • Laptop: LG Gram 17 (i7-8565u, Intel UHD 620 integrated graphics)
  • eGPU: Razer Core X
  • Video card in eGPU: AMD RX 470
  • external display: Sceptre 4k 60hz TV (connected via HDMI to GPU)
  • OS: NixOS 21.05
  • DE: KDE Plasma 5.21.3
  • Graphics stack: X11
  • Kernel: 5.11.14

So the egpu provides power over USB-PD, which does work fine when connected (it charges) and SHOULD automatically recognize the display through the GPU itself. Looking through the logs and
Code:

lspci
output, it does indeed detect the graphics card just fine and even I think starts the
Code:

amdgpu
driver.

Problem is it doesn't seem to detect the external display at all. No other displays show up in KDE display settings or in the /var/log/messages output. Other problems: if I originally booted up the laptop without the eGPU connected, when I connect the cable, the X session freezes up for some reason. Everything is still visible on-screen and I can move the cursor, but nothing is clickable and whatever was on the display at the time of connecting the egpu freezes completely (i.e. the clock in the screen corner doesn't change, UI elements such as the X to close windows don't light up when moused over etc..) until I either hard reboot/sysrq+b reset; ctrl+alt+backspace to kill the X session; or sometimes I think I can ctrl+alt+1 to switch to another virtual terminal.

Log up to this point (start = plugging in egpu; stop = when I reboot):
https://pastebin.com/bYUh2Fgd


If I connect the eGPU first and THEN boot up, the system is at least fully usable, although still no external display detected. But if I disconnect the eGPU and switch to using the laptop on battery while still booted, it either freezes immediately or sometimes keeps running fine until it sleeps or the display turns off, at which point waking it back up only shows a black screen with an unmoveable cursor. Then I have to reset again.

Log for that scenario (fresh boot while plugged in):
https://pastebin.com/5DGxSJzW

I know it's not exactly my hardware itself but probably something in the way it's configured with NixOS, because booting a regular Ubuntu live ISO works just great - hotplugging the egpu makes the display come up immediately and everything works smoothly. Although sometimes I have noticed the X server freezing thing even on Ubuntu too. Another small problem is I've never gotten either GNOME or KDE to run this 4k TV at 60hz - something that works fine on windows through the same egpu. But not as much of a priority as getting it working *at all* on nixos, and not forcing me to shut down & restart every time I unplug it.

obobskivich 05-01-2021 07:34 AM

I'll fully admit that I doubt I can lead you to a complete solution, but have a few ideas on 'poking about' that may or may not be useful:
Code:

xrandr --listproviders
and
Code:

xrandr -q
looks like - does it at least show both GPUs as available, and can you force render-offload onto the eGPU? (I would just try glxgears for ease of use)


What happens if you try forcing an output via xrandr on the eGPU?

Finally just for general info, if you want to verify amdgpu is loaded (and maybe get more information in the process), use lshw (with suser/root permissions):
Code:

lshw -c video
There should be a field titled 'configuration' that will show 'driver' and you should see amdgpu (which is, as far as I understand it, the only option for Polaris).


Sorry I have no ideas on the hotplug situation - I know I've looked into TB/eGPU things in the past (just to read about them) and it seems to be one area where drivers lag Windows (because there isn't first-party support in most cases, or so I've gathered), so some quirkiness seems to be par for the course.

Oh, and your links return 'this is a private paste' - you should be able to paste output with code tags here, or at least relevant portions of it though.

jdally987 05-06-2021 12:06 AM

Quote:

Originally Posted by obobskivich (Post 6246868)
I'll fully admit that I doubt I can lead you to a complete solution, but have a few ideas on 'poking about' that may or may not be useful:
Code:

xrandr --listproviders
Code:

xrandr -q
Code:

lshw -c video

Thanks for the reply, and wow thank you - that actually does help!

Code:

> xrandr --listproviders
Providers: number : 2
Provider 0: id: 0x47 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 3 outputs: 5 associated providers: 0 name:modesetting
Provider 1: id: 0xe5 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 6 outputs: 5 associated providers: 0 name:AMD Radeon (TM) RX 470 Graphics @ pci:0000:06:00.0

Ok, awesome, didn't realize xrandr was indeed recognizing the GPU (and not just the kernel itself or...however that works). I'm not sure what exactly a "provider" is in xrandr vs. a screen/monitor/output though, still trying to make sense of all that.

Code:

> sudo lshw -c video
[sudo] password for jdnixx:         
  *-display               
      description: i915drmfb
      physical id: 2
      bus info: pci@0000:00:02.0
      logical name: /dev/fb0
      logical name: /dev/fb1
      version: 00
      width: 64 bits
      clock: 33MHz
      capabilities: pciexpress msi pm bus_master cap_list rom fb
      configuration: depth=32 driver=i915 latency=0 mode=3840x2160 visual=truecolor xres=3840 yres=2160
      resources: iomemory:600-5ff iomemory:400-3ff irq:165 memory:6022000000-6022ffffff memory:4000000000-400fffffff ioport:3000(size=64) memory:c0000-dffff
  *-display
      physical id: 0
      bus info: pci@0000:06:00.0
      version: cf
      width: 64 bits
      clock: 33MHz
      capabilities: pm pciexpress msi bus_master cap_list rom
      configuration: driver=amdgpu latency=0
      resources: iomemory:410-40f iomemory:400-3ff irq:167 memory:4100000000-41ffffffff memory:4080000000-40801fffff ioport:2000(size=256) memory:80000000-8003ffff memory:80060000-8007ffff

That's really interesting too, it looks like the first display is the integrated graphics (judging by i915drmfb) and the second is..something, through the eGPU right? But then why is the "mode" on the first display listing the 4k resolution, does that mean the intel graphics are handling the external monitor/trying to drive it or something?


And as for the output of xrandr -q --verbose (for extra stuff like the hex identifiers):
[spoiler]
Code:

> xrandr -q --verbose
Screen 0: minimum 320 x 200, current 2560 x 1600, maximum 16384 x 16384
eDP-1 connected primary 2560x1600+0+0 (0x48) normal (normal left inverted right x axis y axis) 366mm x 229mm
        Identifier: 0x42
        Timestamp:  484906
        Subpixel:  unknown
        Gamma:      1.0:1.0:1.0
        Brightness: 1.0
        Clones:   
        CRTC:      0
        CRTCs:      0 1 2
        Transform:  1.000000 0.000000 0.000000
                    0.000000 1.000000 0.000000
                    0.000000 0.000000 1.000000
                  filter:
        EDID:
                00ffffffffffff0030e4f80500000000
                001c0104a525177802ec85a3544c9b26
                0e505400000001010101010101010101
                010101010101ec6800a0a0402e603020
                36006ee5100000190000000000000000
                00000000000000000000000000fe004c
                4720446973706c61790a2020000000fe
                004c503137305751312d5350413100c0
        scaling mode: Full aspect
                supported: Full, Center, Full aspect
        Colorspace: Default
                supported: Default, RGB_Wide_Gamut_Fixed_Point, RGB_Wide_Gamut_Floating_Point, opRGB, DCI-P3_RGB_D65, BT2020_RGB, BT601_YCC, BT709_YCC, XVYCC_601, XVYCC_709, SYCC_601, opYCC_601, BT2020_CYCC, BT2020_YCC
        max bpc: 12
                range: (6, 12)
        Broadcast RGB: Automatic
                supported: Automatic, Full, Limited 16:235
        panel orientation: Normal
                supported: Normal, Upside Down, Left Side Up, Right Side Up
        link-status: Good
                supported: Good, Bad
        CONNECTOR_ID: 95
                supported: 95
        non-desktop: 0
                range: (0, 1)
  2560x1600 (0x48) 268.600MHz -HSync -VSync *current +preferred
        h: width  2560 start 2608 end 2640 total 2720 skew    0 clock  98.75KHz
        v: height 1600 start 1603 end 1609 total 1646          clock  59.99Hz
  2560x1600 (0x49) 348.500MHz -HSync +VSync
        h: width  2560 start 2760 end 3032 total 3504 skew    0 clock  99.46KHz
        v: height 1600 start 1603 end 1609 total 1658          clock  59.99Hz
  2560x1600 (0x4a) 268.500MHz +HSync -VSync
        h: width  2560 start 2608 end 2640 total 2720 skew    0 clock  98.71KHz
        v: height 1600 start 1603 end 1609 total 1646          clock  59.97Hz
  2560x1440 (0x4b) 638.250MHz -HSync +VSync DoubleScan
        h: width  2560 start 2780 end 3064 total 3568 skew    0 clock 178.88KHz
        v: height 1440 start 1441 end 1444 total 1491          clock  59.99Hz
  2560x1440 (0x4c) 469.125MHz +HSync -VSync DoubleScan
        h: width  2560 start 2584 end 2600 total 2640 skew    0 clock 177.70KHz
        v: height 1440 start 1441 end 1444 total 1481          clock  59.99Hz
  2560x1440 (0x4d) 312.250MHz -HSync +VSync
        h: width  2560 start 2752 end 3024 total 3488 skew    0 clock  89.52KHz
        v: height 1440 start 1443 end 1448 total 1493          clock  59.96Hz

 
  *** [a ton of other random useless resolutions... truncated for brevity] ***


  512x384 (0x9d) 32.500MHz -HSync -VSync DoubleScan
        h: width  512 start  524 end  592 total  672 skew    0 clock  48.36KHz
        v: height  384 start  385 end  388 total  403          clock  60.00Hz
  512x288 (0x9e) 23.250MHz -HSync +VSync DoubleScan
        h: width  512 start  532 end  580 total  648 skew    0 clock  35.88KHz
        v: height  288 start  289 end  292 total  299          clock  60.00Hz
  512x288 (0x9f) 21.000MHz +HSync -VSync DoubleScan
        h: width  512 start  536 end  552 total  592 skew    0 clock  35.47KHz
        v: height  288 start  289 end  292 total  296          clock  59.92Hz
  480x270 (0xa0) 20.375MHz -HSync +VSync DoubleScan
        h: width  480 start  496 end  544 total  608 skew    0 clock  33.51KHz
        v: height  270 start  271 end  274 total  281          clock  59.63Hz
  480x270 (0xa1) 18.625MHz +HSync -VSync DoubleScan
        h: width  480 start  504 end  520 total  560 skew    0 clock  33.26KHz
        v: height  270 start  271 end  274 total  278          clock  59.82Hz
  400x300 (0xa2) 20.000MHz +HSync +VSync DoubleScan
        h: width  400 start  420 end  484 total  528 skew    0 clock  37.88KHz
        v: height  300 start  300 end  302 total  314          clock  60.32Hz
  400x300 (0xa3) 18.000MHz +HSync +VSync DoubleScan
        h: width  400 start  412 end  448 total  512 skew    0 clock  35.16KHz
        v: height  300 start  300 end  301 total  312          clock  56.34Hz
  432x243 (0xa4) 16.250MHz -HSync +VSync DoubleScan
        h: width  432 start  444 end  484 total  536 skew    0 clock  30.32KHz
        v: height  243 start  244 end  247 total  253          clock  59.92Hz
  432x243 (0xa5) 15.250MHz +HSync -VSync DoubleScan
        h: width  432 start  456 end  472 total  512 skew    0 clock  29.79KHz
        v: height  243 start  244 end  247 total  250          clock  59.57Hz
  320x240 (0xa6) 12.587MHz -HSync -VSync DoubleScan
        h: width  320 start  328 end  376 total  400 skew    0 clock  31.47KHz
        v: height  240 start  245 end  246 total  262          clock  60.05Hz
  360x202 (0xa7) 11.250MHz -HSync +VSync DoubleScan
        h: width  360 start  372 end  404 total  448 skew    0 clock  25.11KHz
        v: height  202 start  204 end  206 total  211          clock  59.51Hz
  360x202 (0xa8) 10.875MHz +HSync -VSync DoubleScan
        h: width  360 start  384 end  400 total  440 skew    0 clock  24.72KHz
        v: height  202 start  204 end  206 total  209          clock  59.13Hz
  320x180 (0xa9)  9.000MHz -HSync +VSync DoubleScan
        h: width  320 start  332 end  360 total  400 skew    0 clock  22.50KHz
        v: height  180 start  181 end  184 total  188          clock  59.84Hz
  320x180 (0xaa)  8.875MHz +HSync -VSync DoubleScan
        h: width  320 start  344 end  360 total  400 skew    0 clock  22.19KHz
        v: height  180 start  181 end  184 total  187          clock  59.32Hz
DP-1 disconnected (normal left inverted right x axis y axis)
        Identifier: 0x43
        Timestamp:  484906
        Subpixel:  unknown
        Clones:    HDMI-1
        CRTCs:      0 1 2
        Transform:  1.000000 0.000000 0.000000
                    0.000000 1.000000 0.000000
                    0.000000 0.000000 1.000000
                  filter:
        HDCP Content Type: HDCP Type0
                supported: HDCP Type0, HDCP Type1
        Content Protection: Undesired
                supported: Undesired, Desired, Enabled
        Colorspace: Default
                supported: Default, RGB_Wide_Gamut_Fixed_Point, RGB_Wide_Gamut_Floating_Point, opRGB, DCI-P3_RGB_D65, BT2020_RGB, BT601_YCC, BT709_YCC, XVYCC_601, XVYCC_709, SYCC_601, opYCC_601, BT2020_CYCC, BT2020_YCC
        max bpc: 12
                range: (6, 12)
        Broadcast RGB: Automatic
                supported: Automatic, Full, Limited 16:235
        audio: auto
                supported: force-dvi, off, auto, on
        subconnector: Unknown
                supported: Unknown, VGA, DVI-D, HDMI, DP, Wireless, Native
        link-status: Good
                supported: Good, Bad
        CONNECTOR_ID: 103
                supported: 103
        non-desktop: 0
                range: (0, 1)
HDMI-1 disconnected (normal left inverted right x axis y axis)
        Identifier: 0x44
        Timestamp:  484906
        Subpixel:  unknown
        Clones:    DP-1
        CRTCs:      0 1 2
        Transform:  1.000000 0.000000 0.000000
                    0.000000 1.000000 0.000000
                    0.000000 0.000000 1.000000
                  filter:
        HDCP Content Type: HDCP Type0
                supported: HDCP Type0, HDCP Type1
        Content Protection: Undesired
                supported: Undesired, Desired, Enabled
        max bpc: 12
                range: (8, 12)
        content type: No Data
                supported: No Data, Graphics, Photo, Cinema, Game
        Colorspace: Default
                supported: Default, SMPTE_170M_YCC, BT709_YCC, XVYCC_601, XVYCC_709, SYCC_601, opYCC_601, opRGB, BT2020_CYCC, BT2020_RGB, BT2020_YCC, DCI-P3_RGB_D65, DCI-P3_RGB_Theater
        aspect ratio: Automatic
                supported: Automatic, 4:3, 16:9
        Broadcast RGB: Automatic
                supported: Automatic, Full, Limited 16:235
        audio: auto
                supported: force-dvi, off, auto, on
        link-status: Good
                supported: Good, Bad
        CONNECTOR_ID: 113
                supported: 113
        non-desktop: 0
                range: (0, 1)
DP-2 disconnected (normal left inverted right x axis y axis)
        Identifier: 0x45
        Timestamp:  484906
        Subpixel:  unknown
        Clones:    HDMI-2
        CRTCs:      0 1 2
        Transform:  1.000000 0.000000 0.000000
                    0.000000 1.000000 0.000000
                    0.000000 0.000000 1.000000
                  filter:
        HDCP Content Type: HDCP Type0
                supported: HDCP Type0, HDCP Type1
        Content Protection: Undesired
                supported: Undesired, Desired, Enabled
        Colorspace: Default
                supported: Default, RGB_Wide_Gamut_Fixed_Point, RGB_Wide_Gamut_Floating_Point, opRGB, DCI-P3_RGB_D65, BT2020_RGB, BT601_YCC, BT709_YCC, XVYCC_601, XVYCC_709, SYCC_601, opYCC_601, BT2020_CYCC, BT2020_YCC
        max bpc: 12
                range: (6, 12)
        Broadcast RGB: Automatic
                supported: Automatic, Full, Limited 16:235
        audio: auto
                supported: force-dvi, off, auto, on
        subconnector: Unknown
                supported: Unknown, VGA, DVI-D, HDMI, DP, Wireless, Native
        link-status: Good
                supported: Good, Bad
        CONNECTOR_ID: 119
                supported: 119
        non-desktop: 0
                range: (0, 1)
HDMI-2 disconnected (normal left inverted right x axis y axis)
        Identifier: 0x46
        Timestamp:  484906
        Subpixel:  unknown
        Clones:    DP-2
        CRTCs:      0 1 2
        Transform:  1.000000 0.000000 0.000000
                    0.000000 1.000000 0.000000
                    0.000000 0.000000 1.000000
                  filter:
        HDCP Content Type: HDCP Type0
                supported: HDCP Type0, HDCP Type1
        Content Protection: Undesired
                supported: Undesired, Desired, Enabled
        max bpc: 12
                range: (8, 12)
        content type: No Data
                supported: No Data, Graphics, Photo, Cinema, Game
        Colorspace: Default
                supported: Default, SMPTE_170M_YCC, BT709_YCC, XVYCC_601, XVYCC_709, SYCC_601, opYCC_601, opRGB, BT2020_CYCC, BT2020_RGB, BT2020_YCC, DCI-P3_RGB_D65, DCI-P3_RGB_Theater
        aspect ratio: Automatic
                supported: Automatic, 4:3, 16:9
        Broadcast RGB: Automatic
                supported: Automatic, Full, Limited 16:235
        audio: auto
                supported: force-dvi, off, auto, on
        link-status: Good
                supported: Good, Bad
        CONNECTOR_ID: 125
                supported: 125
        non-desktop: 0
                range: (0, 1)

[/spoiler]

So I'm not exactly sure how to force the output onto the external monitor with xrandr, but on some quick googling it looks like the option: --setprovideroutputsource <prov-xid> <source-xid> is probably my best bet? But I'm not sure what to put as the source-xid.

Trying this:
Code:

> xrandr --setprovideroutputsource "AMD Radeon (TM) RX 470 Graphics @ pci:0000:06:00.0" 1
so using "1" as the source-xid - is the only combination I've found that does anything at all, but it just kills my X session and dumps me back on plasma's login screen after a few seconds.
However - using --setprovideroutputsource 0xe5 0x47 (so the AMD graphics' provider hex ID as the 1st parameter, & the other provider as the 2nd) did work to make the external monitor show up in my plasma system settings menu! But it still didn't work even once I checked its "enabled" checkbox. I'm fumbling in the dark with this xrandr command though so probably doing that wrong.

And I just checked those pastebin links, they should definitely show up as public. Opened fine for me in an incognito window but I can paste here if you or anyone still can't see them

obobskivich 05-08-2021 03:52 AM

Glad it at least helped some. Something I would try next: can you connect the free-standing monitor directly to the laptop's IGP? (does it have its own HDMI/whatever output?) Does that work and get you both displays + everything is good so far? If yes, then I would connect the external GPU (do not hook the monitor up 'through' the external GPU - leave it on the laptop GPU), and try prepending the dri_prime command to some application and see if it runs. Example:

Code:

dri_prime=1 glxgears
You will have to get the variable (in my example it is '1') from the --listproviders, it will probably be '1' as the 2nd GPU, which it is in your pasted output (but this could change if you add other devices/re-arrange hardware (not so possible with a laptop, but switch PCIe cards around in a desktop and those numbers will change)). I chose glxgears because its easy and will run on a lot of things, but you could send any 3D application there (for example you can set this as a 'launch option' in Steam for games, or prepend it to a command starting Super Tux Kart, or whatever).

If that all works, you'll have the RX 470 performing the 'work' while the Intel drives the displays (you would have to prepend this per-application, mind you) - probably not exactly what you originally set out to do, but it will hopefully at least get the RX 470 'working' for whatever heavy lifting I assume you've enlisted it for.


All times are GMT -5. The time now is 01:37 PM.