srdusr
aboutsummaryrefslogtreecommitdiffstats
path: root/crates/core
diff options
context:
space:
mode:
authorsrdusr <[email protected]>2025-05-28 09:42:00 +0200
committersrdusr <[email protected]>2025-05-28 09:42:00 +0200
commit6a9e50280ad8262e9fe49e390527e7490564f8dd (patch)
tree6911dbfe68ac983c228b5c9fc9320beae42b6e6a /crates/core
parentd0103908bd1c316bdebaa48e13aae332cffdeabf (diff)
downloadsrdwm-6a9e50280ad8262e9fe49e390527e7490564f8dd.tar.gz
srdwm-6a9e50280ad8262e9fe49e390527e7490564f8dd.zip
Add a real general.gpu config option for the GPU render path
SRDWM_GPU=1 was the only way to opt into the udev backend's GBM+EGL GPU render path - an env var, not a real config option, with no way to enable it from init.lua the way every other general.* flag works. WindowManager::gpu_enabled (plain bool, false by default - unlike rounded_corners_enabled's Option<bool>, GPU rendering has one unambiguous default regardless of which backend ends up connecting, so there's no "let the backend decide" case to preserve) is read from general.gpu in apply_general_settings, same as every other general.* key. gpu::probe now takes an explicit enabled: bool instead of checking the env var itself; udev/platform.rs's call site computes it as wm.gpu_enabled OR SRDWM_GPU=1, so the env var still works as a quick manual override for testing without touching config, on top of the new persistent option. Falls back to the existing software (Pixman) path exactly as before on any failure at any step (no GBM device, no atomic-modesetting support, a software-only EGL renderer, ...) - gpu::probe's own fallback behavior is unchanged, only how the initial enabled/disabled decision gets made.
Diffstat (limited to 'crates/core')
-rw-r--r--crates/core/src/manager/mod.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/crates/core/src/manager/mod.rs b/crates/core/src/manager/mod.rs
index 74be06b..9593dd3 100644
--- a/crates/core/src/manager/mod.rs
+++ b/crates/core/src/manager/mod.rs
@@ -189,6 +189,23 @@ pub struct WindowManager {
/// redraws constantly - see `crates/wayland/src/rounded_corners.rs`).
/// `Some(_)` only when the user explicitly set it, and wins either way.
pub rounded_corners_enabled: Option<bool>,
+ /// Whether the udev backend attempts real GBM+EGL+`DrmCompositor` GPU
+ /// rendering instead of the default, always-available software
+ /// (Pixman/dumb-buffer) path - read from `general.gpu`, `false` by
+ /// default (unlike `rounded_corners_enabled`'s `Option`, this has one
+ /// unambiguous default regardless of backend: GPU rendering is udev-
+ /// only and experimental everywhere, so "off" is correct whether or
+ /// not the eventual backend even has a GPU path at all). `true` here
+ /// only ever *attempts* it - `udev::gpu::probe` still falls back to
+ /// the untouched software path on any failure at any step (no GBM
+ /// device, no atomic-modesetting support, a software-only EGL
+ /// renderer, ...), logged but never fatal, so setting this on a
+ /// machine or VM without real GPU/KMS support costs nothing beyond
+ /// the one failed probe at startup. `SRDWM_GPU=1` (an env var, unset
+ /// by default) remains a separate, lower-level override for testing
+ /// without touching config - `udev::platform::connect` attempts the
+ /// probe if *either* this or the env var says to.
+ pub gpu_enabled: bool,
/// The whole-screen colour treatment currently active (night light's
/// warm tint or reading mode's desaturation), live-settable via `srd
/// set night_light`/`srd set reading_mode` - see [`ColorFilter`]. Off
@@ -349,6 +366,7 @@ impl WindowManager {
shadows_enabled: true,
resize_margin: RESIZE_MARGIN,
rounded_corners_enabled: None,
+ gpu_enabled: false,
color_filter: ColorFilter::None,
focus_follows_mouse: false,
auto_raise: false,