You are not logged in.

#1 2024-04-05 19:33:20

cakehunter
Member
Registered: 2024-04-05
Posts: 5

[SOLVED] display error when waking from sleep/hibernation on nvidia

I'm running arch on my legion laptop with a external HDMI monitor. I have set up the monitors in such a way that xrandr commands are called according to lid events.

lid event Main file

#!/bin/bash

# Read the lid state from the file
lid_state=$(cat /proc/acpi/button/lid/LID0/state)

# Check if the lid state contains the string "open"
if [[ $lid_state == *"open"* ]]; then
    # Lid is open
    /home/cakehunter/lid_events/open.sh;
else
    # Lid is closed
    /home/cakehunter/lid_events/close.sh;
fi

open.sh file:

#This runs so that root can run the following command under the user's environment
source /home/cakehunter/.Xdbus
DISPLAY=:0.0 su cakehunter -c "xrandr --output HDMI-1-0 --mode 1920x1080 --rate 144 && xrandr --output eDP-1 --mode 1920x1080 --rate 59 --right-of HDMI-1-0"

close.sh file:

#This runs so that root can run the following command under the user's environment
source /home/cakehunter/.Xdbus
DISPLAY=:0.0 su cakehunter -c "xrandr --output HDMI-1-0 --mode 1920x1080 --rate 144 && xrandr --output eDP-1 --off"

This works perfectly fine when I reboot but when I try to resume from sleep or hibernation I run into problems.

  1. The login screen is not shown on the external monitor(primary display) or the laptop screen. I am using lightDM and tried the following .

    /etc/lightdm/lightdm.conf

    #uncommented this part in lightdm.conf
    display-setup-script=/etc/lightdm/display_setup.sh

    /etc/lightdm/display_setup.sh

    #!/bin/sh
    hdmi_disconnected() {
        if xrandr | awk '/HDMI-1-0 connected/'; then
            return 0  # HDMI monitor connected
        else
            return 1  # HDMI monitor disconnected
        fi
    }
    
    if hdmi_disconnected; then
    	xrandr --output HDMI-1-0 --off --output eDP-1 --mode 1920x1080 --rate 165
    else
    	xrandr --output HDMI-1-0 --primary --mode 1920x1080 --rate 144 --output eDP-1 --mode 1920x1080 --rate 59 --right-of HDMI-1-0
    fi

    Its a simple script to check if external display is connected or not and then render the login screen there.Unfortunately its not working.
    The only way I can resume is to unplug the hdmi monitor and the screen will then become visible on the laptop display. But this is not the login screen instead it is the home screen( like with my work open here).  I cant use or do anything here until I type my password. It's like a invisible login screen.

    After entering my password, the screen becomes usable and I can plug in my HDMI display again. Now there's another problem.

  2. If I run the xrandr command which is called when the lid closes (open.sh)  to extend my laptop monitor to the left, or the (close.sh)  to turn off laptop display,

    xrandr --output HDMI-1-0 --mode 1920x1080 --rate 144 && xrandr --output eDP-1 --off
    
    #or
    
    xrandr --output HDMI-1-0 --mode 1920x1080 --rate 144 && xrandr --output eDP-1 --mode 1920x1080 --rate 59 --right-of HDMI-1-0"

    the  X server restarts and I'm taken to the login screen again. I loose my work.

    However, once I login after X restarts, it works as intended (the way it works after reboot) wherein the lid close and open script work.

I have reproduced the above problems and have given the log below:

journalclt -b : https://0x0.st/XicB.txt
the lid is "LID closed" at Apr 06 00:49:44 after I login from resuming sleep and unplugging and plugging back hdmi (2nd issue mentioned above).

Kindly help me get my login screen working properly and both displays to function as intended without restarting X server after resuming.

Last edited by cakehunter (2024-04-09 11:30:16)

Offline

#2 2024-04-05 21:18:30

seth
Member
Registered: 2012-09-03
Posts: 59,771

Re: [SOLVED] display error when waking from sleep/hibernation on nvidia

Apr 06 00:51:12 DiscoBear systemd-coredump[2874]: Process 809 (Xorg) of user 0 dumped core.
                                                  
                                                  Stack trace of thread 809:
                                                  #0  0x00007cfc0233e32c n/a (libc.so.6 + 0x8d32c)
                                                  #1  0x00007cfc022ed6c8 raise (libc.so.6 + 0x3c6c8)
                                                  #2  0x00007cfc022d54b8 abort (libc.so.6 + 0x244b8)
                                                  #3  0x00006189514659f0 OsAbort (Xorg + 0x14a9f0)
                                                  #4  0x0000618951465d2b FatalError (Xorg + 0x14ad2b)
                                                  #5  0x000061895145dca6 n/a (Xorg + 0x142ca6)
                                                  #6  0x00007cfc022ed770 n/a (libc.so.6 + 0x3c770)
                                                  #7  0x00007cfc00e5c3f6 n/a (nvidia_drv.so + 0x5c3f6)
                                                  #8  0x00007cfc00e4ae04 n/a (nvidia_drv.so + 0x4ae04)
                                                  #9  0x00007cfc00e6d569 n/a (nvidia_drv.so + 0x6d569)
                                                  #10 0x00007cfc00e6ee28 n/a (nvidia_drv.so + 0x6ee28)
                                                  #11 0x00007cfc00ead629 n/a (nvidia_drv.so + 0xad629)
                                                  #12 0x00007cfc00e8301a n/a (nvidia_drv.so + 0x8301a)
                                                  #13 0x00007cfc012b47fd n/a (nvidia_drv.so + 0x4b47fd)
                                                  ELF object binary architecture: AMD x86-64

Legion laptop with a external HDMI monitor

Please post your Xorg log w/ all outputs attached, https://wiki.archlinux.org/title/Xorg#General
This is a hybrid graphics setup and the HDMI probably wired to the nviida chip

when I try to resume from sleep or hibernation I run into problems

Apr 06 00:49:11 DiscoBear mount[503]: WARNING: blksize option is ignored because ntfs-3g must calculate it.
Apr 06 00:49:11 DiscoBear mount[503]: Windows is hibernated, refused to mount.
Apr 06 00:49:11 DiscoBear mount[503]: The disk contains an unclean file system (0, 0).
Apr 06 00:49:11 DiscoBear mount[503]: Metadata kept in Windows cache, refused to mount.
Apr 06 00:49:11 DiscoBear mount[503]: Falling back to read-only mount because the NTFS partition is in an
Apr 06 00:49:11 DiscoBear mount[503]: unsafe state. Please resume and shutdown Windows fully (no hibernation
Apr 06 00:49:11 DiscoBear mount[503]: or fast restarting.)

3rd link below. Mandatory.
Disable it (it's NOT the BIOS setting!) and reboot windows and linux twice for voodo reasons.

See whether this has any impact on the situation.

Offline

#3 2024-04-06 14:24:12

cakehunter
Member
Registered: 2024-04-05
Posts: 5

Re: [SOLVED] display error when waking from sleep/hibernation on nvidia

T3rd link below. Mandatory.
Disable it (it's NOT the BIOS setting!) and reboot windows and linux twice for voodo reasons.

I disabled fastboot and hibernation in windows but the issue still persists.

This is a hybrid graphics setup and the HDMI probably wired to the nviida chip

Yes, both the laptop and hdmi displays are connected to the nvidia card because I have set the card to discrete instead of dynamic in bios menu.

Xorg.0.log : https://0x0.st/XiMU.0.log
Xorg.1.log : https://0x0.st/XiM0.1.log
journatclt -b: https://0x0.st/Xiu-.txt

please note that these are the logs till issue 1 mentioned above. Now once I run the xrandr command, X server restarts.

Last edited by cakehunter (2024-04-06 14:30:28)

Offline

#4 2024-04-06 15:33:08

seth
Member
Registered: 2012-09-03
Posts: 59,771

Re: [SOLVED] display error when waking from sleep/hibernation on nvidia

Yes, both the laptop and hdmi displays are connected to the nvidia card because I have set the card to discrete instead of dynamic in bios menu.

[     7.082] (--) PCI: (1@0:0:0) 10de:2560:17aa:3a80 rev 161, Mem @ 0xd0000000/16777216, 0xfa00000000/8589934592, 0xfc00000000/33554432, I/O @ 0x00003000/128, BIOS @ 0x????????/524288
[     7.082] (--) PCI:*(6@0:0:0) 1002:1638:17aa:3a80 rev 197, Mem @ 0xfc10000000/268435456, 0xfc20000000/2097152, 0xd1500000/524288, I/O @ 0x00001000/256
…
[     7.292] (II) modeset(0): glamor X acceleration enabled on AMD Radeon Graphics (radeonsi, renoir, LLVM 17.0.6, DRM 3.57, 6.8.1-arch1-1)
[     7.298] (II) modeset(0):  BOE CQ
[     7.298] (II) modeset(0):  NV156FHM-NY8
[     7.298] (II) modeset(0): EDID (in hex):
[     7.298] (II) modeset(0): 	00ffffffffffff0009e5980900000000
[     7.298] (II) modeset(0): 	221e0104b52213780754a5a7544c9b26
[     7.298] (II) modeset(0): 	0f505400000001010101010101010101
[     7.298] (II) modeset(0): 	010101010101b99c80a0703859403020
[     7.298] (II) modeset(0): 	360058c21000001a000000fd003ca5c1
[     7.298] (II) modeset(0): 	c128010a202020202020000000fe0042
[     7.298] (II) modeset(0): 	4f452043510a202020202020000000fe
[     7.298] (II) modeset(0): 	004e5631353646484d2d4e59380a00b1
[     7.298] (II) modeset(0): Printing probed modes for output eDP-1
…
[     7.401] (--) NVIDIA(GPU-0): LG Electronics 24GL600F (DFP-4): connected
[     7.401] (--) NVIDIA(GPU-0): LG Electronics 24GL600F (DFP-4): Internal TMDS
[     7.401] (--) NVIDIA(GPU-0): LG Electronics 24GL600F (DFP-4): 600.0 MHz maximum pixel clock
[     7.401] (--) NVIDIA(GPU-0): 

No, you don't. eDP is on amdgpu, HDMI on nvidia through reverse prime (you're running the X11 server on the AMD GPU)

Here's bad:

[    80.513] (II) NVIDIA(G0): Setting mode "NULL"
[    80.739] (II) modeset(0): Allocate new frame buffer 1920x1080 stride
[    90.111] (--) NVIDIA(GPU-0): LG Electronics 24GL600F (DFP-4): connected
[    90.111] (--) NVIDIA(GPU-0): LG Electronics 24GL600F (DFP-4): Internal TMDS
[    90.111] (--) NVIDIA(GPU-0): LG Electronics 24GL600F (DFP-4): 600.0 MHz maximum pixel clock
[    90.111] (--) NVIDIA(GPU-0): 
[    90.128] (II) NVIDIA(G0): Setting mode "HDMI-1-0: nvidia-auto-select @1920x1080 +0+0 {AllowGSYNC=Off, ViewPortIn=1920x1080, ViewPortOut=1920x1080+0+0}"
[    90.222] (EE) NVIDIA(G0): The NVIDIA X driver has encountered an error; attempting to
[    90.222] (EE) NVIDIA(G0):     recover...
[    90.247] (II) NVIDIA(G0): Error recovery was successful.

Which aligns with

Apr 06 19:29:07 DiscoBear kernel: NVRM: GPU at PCI:0000:01:00: GPU-f4079b1f-efad-e289-0e8f-341b7977be3d
Apr 06 19:29:07 DiscoBear kernel: NVRM: Xid (PCI:0000:01:00): 13, pid='<unknown>', name=<unknown>, Graphics Exception: Shader Program Header 18 Error
Apr 06 19:29:07 DiscoBear kernel: NVRM: Xid (PCI:0000:01:00): 13, pid='<unknown>', name=<unknown>, Graphics Exception: ESR 0x405840=0x82040000
Apr 06 19:29:07 DiscoBear kernel: NVRM: Xid (PCI:0000:01:00): 13, pid='<unknown>', name=<unknown>, Graphics Exception: ESR 0x405848=0x80000000
Apr 06 19:29:07 DiscoBear kernel: NVRM: Xid (PCI:0000:01:00): 13, pid='<unknown>', name=<unknown>, Graphics Exception: ChID 0008, Class 0000c797, Offset 00000000, Data 00000000

Unfortunately XID13 is "somehing™ Graphics Engine Exception", https://docs.nvidia.com/deploy/xid-errors/index.html

Apr 06 19:27:35 DiscoBear /usr/bin/nvidia-powerd[648]: nvidia-powerd version:1.0(build 1)

kinda looks at me - what if you disable that?

Offline

#5 2024-04-08 11:58:28

cakehunter
Member
Registered: 2024-04-05
Posts: 5

Re: [SOLVED] display error when waking from sleep/hibernation on nvidia

eDP is on amdgpu, HDMI on nvidia through reverse prime

yes, you're right.

disabling nvidia-pwerd.service didnt work and issue still persists.

logs:

Xorg.0.log  : https://0x0.st/XitU.0.log
Xorg.1.log :  https://0x0.st/XiM0.1.log
journatclt -b: https://0x0.st/XitG.txt

Offline

#6 2024-04-08 16:41:29

seth
Member
Registered: 2012-09-03
Posts: 59,771

Re: [SOLVED] display error when waking from sleep/hibernation on nvidia

Offline

#7 2024-04-09 11:24:10

cakehunter
Member
Registered: 2024-04-05
Posts: 5

Re: [SOLVED] display error when waking from sleep/hibernation on nvidia

Thank you so much   

solved everything ! smile

Offline

Board footer

Powered by FluxBB