Bug 473983 - Setting NVIDIA PRIME OFFLOAD in startup script causes black screen
Summary: Setting NVIDIA PRIME OFFLOAD in startup script causes black screen
Status: RESOLVED NOT A BUG
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (other bugs)
Version First Reported In: 5.27.7
Platform: Arch Linux Linux
: NOR crash
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-08-31 09:26 UTC by Vishal Subramanyam
Modified: 2023-08-31 11:46 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vishal Subramanyam 2023-08-31 09:26:00 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***

STEPS TO REPRODUCE
1.  Set up the following environment variables in a KWin startup script
export __NV_PRIME_RENDER_OFFLOAD=1
export __VK_LAYER_NV_optimus=NVIDIA_only
export __GLX_VENDOR_LIBRARY_NAME=nvidia
2.  Start plasma on wayland


What was my objective in doing this? I have an Optimus setup with NVIDIA and Intel graphics. On Wayland, I wanted to use NVIDIA as primary GPU. There was no option for doing this. Instead, the prime-run script is the only option for launching individual programs on the GPU. The script essentially sets the above variables before starting a program. So I thought I could do the same in a KWin script, so that anything spawned after that uses the NVIDIA GPU for offloading.


OBSERVED RESULT
Black screen with a mouse cursor appears. Can open applications using keyboard shortcuts (for example, Konsole using Ctrl+Alt+T), and can start other applications from Konsole. Application windows are visible, but everything else is black.

EXPECTED RESULT
A functioning desktop with all the panels, wallpapers, etc.

Operating System: Arch Linux 
KDE Plasma Version: 5.27.7
KDE Frameworks Version: 5.109.0
Qt Version: 5.15.10
Kernel Version: 6.4.12-arch1-1 (64-bit)
Graphics Platform: Wayland
ADDITIONAL INFORMATION
Comment 1 Zamundaaa 2023-08-31 11:46:29 UTC
We don't support driver hacks like this. See https://invent.kde.org/plasma/kwin/-/wikis/Environment-Variables#kwin_drm_devices for a proper solution