Files
OrcaSlicer/src/dev-utils
HanifKoh 12ce9d6fe6 Make the Discrete GPU a Linux Preference Instead of a Desktop-Entry Hint (#16875)
* Make the Discrete GPU a Linux Preference Instead of a Desktop-Entry Hint

The desktop entries asked the launcher for the discrete GPU with
PrefersNonDefaultGPU and X-KDE-RunOnDiscreteGpu. KDE and GNOME honour
that by adding the PRIME variables to every menu launch, so on a hybrid
laptop under Wayland the 3D view was rendered by zink on the GPU that
does not drive the display and its frames never reached the compositor:
an empty Prepare and Preview canvas from the menu, a working one from a
terminal.

Drop the two keys from the installed desktop file, the AppImage's
embedded entry and the entries the Desktop Integration dialog writes.
Add a "Render on the discrete GPU" preference (Linux, default off,
requires restart) that exports DRI_PRIME and, with the NVIDIA kernel
module loaded, the NVIDIA render-offload variables before GTK opens the
display. The GDK_BACKEND=x11 opt-in path exported them unconditionally;
it now leaves GPU selection to the preference as well.

The preference acts before GUI_App loads the configuration, so
AppConfig::peek_bool reads one app boolean straight from the saved file
and xdg_config_dir resolves the default Linux data dir the way the wx
code did; GUI_App's two copies of that lookup use the same helper, and AppConfig::config_path gained a
static form so the file name lives in one place.

* Share the Linux Data-Dir Lookup and Let DRI_PRIME Override the GPU Preference

default_data_dir() in libslic3r resolves the Linux data dir a start without
--datadir uses: a portable data_dir folder next to the executable, else the
XDG config dir. GUI_App::init_app_config and the discrete-GPU start-up code
both call it, so they cannot drift apart.

A DRI_PRIME already in the environment now skips the export entirely, so one
start with DRI_PRIME=0 gets back to Preferences when the discrete GPU cannot
open the window. The tooltip says so.

* Attach the DRI_PRIME Translator Note to the Tooltip It Describes
2026-10-26 14:02:54 +08:00
..