srdusr
aboutsummaryrefslogtreecommitdiffstats
path: root/crates/wayland/src/udev/mod.rs
diff options
context:
space:
mode:
authorsrdusr <[email protected]>2025-03-26 00:26:00 +0200
committersrdusr <[email protected]>2025-03-26 00:26:00 +0200
commit0d3c7ab727b321a36ffea66c461221b14bbc48d8 (patch)
treebdbafccf64086d732af38ca37a005c4c4911ac32 /crates/wayland/src/udev/mod.rs
parentef4bc112b8507880ddfa53ffce45505762384612 (diff)
downloadsrdwm-0d3c7ab727b321a36ffea66c461221b14bbc48d8.tar.gz
srdwm-0d3c7ab727b321a36ffea66c461221b14bbc48d8.zip
Wire real GBM+EGL+DrmCompositor rendering for one head (GPU Phase 2)
Extends the SRDWM_GPU=1 opt-in path (Phase 1, fa0c7f1) from a capability probe into an actual, working GPU render pipeline for exactly one head, per the plan this was built from the plan file. gpu.rs: probe now goes all the way through EGLContext, GlesRenderer, DrmDevice (real DRM device, separate duped fd from the existing legacy Card), and DrmOutputManager construction, returning both a GpuContext and its DrmDeviceNotifier on success. GpuContext::initialize_output drives one crtc/mode/connector through DrmOutputManager, storing the resulting GpuOutput for the render loop to find. Confirmed while reading smithay's own source directly (not assumed): DrmDevice::new's disable_connectors parameter is not an atomic-vs- legacy switch - DrmDevice::create_internal tries atomic capability first and falls back to a Legacy internal variant automatically, exposed via DrmDevice::is_atomic(), logged here rather than assumed. platform.rs: probes at startup, calls initialize_output for the first head only (Phase 2's deliberate scope - see the plan), registers the DrmDeviceNotifier as its own calloop event source alongside (not replacing) the existing legacy DRM-fd registration. render.rs: render_udev_frame's per-head loop checks, before any of the existing Pixman-specific element-building logic runs, whether this head's crtc matches the GPU context's initialized output; if so, renders a plain clear color through render_frame/queue_frame and continues to the next head, completely bypassing the Pixman path for that head. Every other head, and this same head whenever the GPU context or its output is absent, is entirely unaffected. session.rs: register_gpu_drm_notifier handles DrmEvent::VBlank by calling frame_submitted() on the matching GpuOutput (required per queue_frame's own doc comment, or the swapchain runs out of buffers) and logs DrmEvent::Error without treating it as fatal. Deliberately out of scope for this phase (documented in the plan): window content/decorations/cursor on the GPU head (clear color only), multi-monitor GPU rendering (one head only), and VT-switch pause/ resume for the GPU head specifically (DrmOutputManager's own pause()/ activate() calls are a different API surface from the existing manual set_crtc+DPMS reassertion, and porting that pairing correctly needs its own isolated verification pass). SRDWM_GPU unset (the default) is unaffected: every step above only runs when it's set to "1", and every failure at any step falls back to the existing, untouched Pixman path with a logged reason, same fallback contract Phase 1 already established.
Diffstat (limited to 'crates/wayland/src/udev/mod.rs')
-rw-r--r--crates/wayland/src/udev/mod.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/wayland/src/udev/mod.rs b/crates/wayland/src/udev/mod.rs
index b5529c4..d22666d 100644
--- a/crates/wayland/src/udev/mod.rs
+++ b/crates/wayland/src/udev/mod.rs
@@ -238,6 +238,13 @@ pub(crate) struct UdevState {
/// `None` before the first frame, same reasoning as `last_rendered_
/// workspace` above (renders fully regardless).
pub(crate) last_rendered_layout: Option<u64>,
+ /// Set only when `SRDWM_GPU=1` and `gpu::probe` succeeds on this
+ /// hardware - see that function's own doc comment for exactly what
+ /// it does and does not do yet. `None` (the default, every session
+ /// that doesn't set the env var, and every one where the probe fails)
+ /// means every head renders through `renderer`/`PixmanRenderer` above,
+ /// completely unaffected by this field's existence.
+ pub(crate) gpu: Option<gpu::GpuContext>,
}
impl UdevState {