Skip to main content
Topic: Xorg: Black Screen and Cursor Only after switching to tty and back (Read 832 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Xorg: Black Screen and Cursor Only after switching to tty and back

I'm having a strange issue where after logging in on tty1 (x session is started by .bash_profile running startx on tty1), when I switch to another tty and then back to tty1, ~80% of the time tty1 will only display a black screen with my cursor. X and i3 are still working, because I can use shortcuts and blindly click to exit the i3 session (which then logs me out). It doesn't show the black screen every time though, sometimes it works as expected (but most of the time it glitches).

I have an updated system, I'm using Xorg, i3wm, and nvidia drivers (nvidia.drm modeset is 1, set via grub config, and I have the pacman nvidia hook set up). I didn't have this issue prior to setting up the nvidia drivers, but before setting up the nvidia drivers I couldn't put the computer to sleep (using dpms), which is why I installed nvidia drivers.

I briefly modified my .xinitrc to launch pcmanfm instead of i3 and the tty switching issue was also present, so it appears to be related to Xorg not just i3.

The issue seems a lot like what is in this post (https://bbs.archlinux.org/viewtopic.php?id=185842), but I added this to my xorg.conf file that nvidia-xconfig generated and it did not resolve the issue
Code: [Select]
Option "XAANoOffscreenPixmaps" "True"
(not sure if multiple spaces between words matter, I have just one space right now).

The issue has been ongoing for several months (I've been trying to fix it on and off since December) and has persisted across multiple system updates.

Re: Xorg: Black Screen and Cursor Only after switching to tty and back

Reply #1
I had something similar:
https://forum.artixlinux.org/index.php/topic,5664

If you install the Gnome desktop and GDM (you don't have to keep them installed!) you can easily change between an Xorg and Wayland session on the GDM login page just by clicking on a drop down menu, in my case it was only present in Xorg. Although I found a problem commit in the kernel it wasn't the real cause, because it had nothing to do with anything running on my system. I guess it was just changing memory layout affecting some buffer overflow, possibly from a race condition judging from the randomness. It went away here after a few updates but if you are having the same issue the root cause might still be there.

Re: Xorg: Black Screen and Cursor Only after switching to tty and back

Reply #2

RTFM:

https://wiki.archlinux.org/title/Kernel_mode_setting
https://wiki.archlinux.org/title/Mkinitcpio
https://wiki.archlinux.org/title/Xorg
https://wiki.archlinux.org/title/NVIDIA
"Wer alles kann, macht nichts richtig"

Artix USE="runit openrc slim openbox lxde gtk2 qt4 qt5 qt6 conky
-gtk3 -gtk4 -adwaita{cursors,themes,icons} -gnome3 -kde -plasma -wayland "

Re: Xorg: Black Screen and Cursor Only after switching to tty and back

Reply #3
Quote
Note: The proprietary NVIDIA driver (since 364.12) also implements kernel mode-setting, but it does not use the built-in kernel implementation and a fbdev driver for the high-resolution console is only present as an opt-in experimental feature (since 545.29)...
The proprietary NVIDIA driver supports KMS (since 364.12), which has to be manually enabled.
Is it recommended anyway for x11 to enable it? (You need it for wayland and it is still experimental).
Besides rootless xorg use case.
This wiki explains step by step how to enable it: https://wiki.hyprland.org/Nvidia.

While running "nvidia-xconfig" should be done right?

I am not experiencing this problem but sometimes after suspending/hibernating I do have it.

Re: Xorg: Black Screen and Cursor Only after switching to tty and back

Reply #4

I am using rootless xorg. From what I could tell, following the wiki steps, nvidia.drm modeset should be enabled.

Re: Xorg: Black Screen and Cursor Only after switching to tty and back

Reply #5
I added kms hook and nvidia modules to mkinitpcio.
And I enabled DRM in /etc/default/grub and /etc/modprobe.d/nvidia.conf.

When resuming from hibernating no black screen but it is completely stuck.

Removing DRM from grub fixes that problem, but DRM is not enabled cause of early loading?
Code: [Select]
cat /sys/module/nvidia_drm/parameters/modeset
N


Re: Xorg: Black Screen and Cursor Only after switching to tty and back

Reply #6
For posterity, it appears the issue is related to picom, which I start with my .xinitrc file. When I change it to "picom --experimental-backends" the issue of the whole screen going blank when switching back to tty1 from another tty goes away. I guess when I started using the nvidia driver (which I did correctly, because I read the manual...), the default backend of picom stopped working in that respect.

The whole thing isn't solved yet though. Sometimes when swapping back to tty1, programs that were open (like the web browser) don't resume properly and don't update visually (even though they remain responsive to input).

Edit: --experimental-backends does not actually solve the problem, since that is not actually a valid arg for picom. So the problem stopped because picom wasn't running at all...
Edit 2: picom -b seems to help/prevent the issue. Screen resume normally after swapping ttys. I also switched to the glx backend from xrender. Browser still seems to act up though not as bad or frequently....

Re: Xorg: Black Screen and Cursor Only after switching to tty and back

Reply #7
Since I’ve set up my autistic mpv drm setup that I run on a separate VT, I’ve been encountering this issue daily. At some point, picom won’t recover and will need to be restarted. I'm on i3wm, so I just created a little starter script that restarts picom on config reload, (you can put it into some keymap combo if you want idk) at least this works as a workaround:
Code: [Select]
#!/usr/bin/bash

if pgrep -u "${USER}" -x picom 1>/dev/null 2>&1
then
    echo "Picom was already running, restarting..."
    killall -u "${USER}" -9 picom
fi

/usr/bin/picom -b --config "${HOME}/.config/picom/picom.conf" &
echo "Picom started..."






Spoiler (click to show/hide)

 

Re: Xorg: Black Screen and Cursor Only after switching to tty and back

Reply #8
Not sure if this help, I use a dinit user service for picom:
Code: [Select]
cat ~/.config/dinit.d/picom 
type = process
command = picom
logfile = $HOME/.local/state/dinit/picom.log
restart = true
You need to create the log folder otherwise it will fail to start.

Note if you use turnstile it won't work if you use startx.