WEFT_OS/crates/weft-compositor/src/backend/drm_device.rs

60 lines
1.8 KiB
Rust
Raw Permalink Normal View History

use std::{collections::HashMap, time::Instant};
use smithay::{
backend::{
allocator::gbm::GbmAllocator,
drm::{
fix(compositor): resolve all Linux cargo check/clippy/fmt failures Fixes found by running cargo check + clippy -D warnings + fmt --check on openSUSE Tumbleweed WSL2 (Rust 1.93.0). input.rs: - Add GestureBeginEvent (fingers()), GestureEndEvent (cancelled()), TouchEvent (slot()) supertrait imports - Add explicit ::<B> turbofish to all handle_* dispatch calls Rust cannot reverse-infer B from an associated type bound - Remove now-redundant specific gesture/touch event trait imports state.rs: - Add reposition_request to XdgShellHandler (E0046) - Wrap protocol-level LayerSurface in desktop::LayerSurface::new for map_layer (E0308) - Wrap std::env::set_var in unsafe block (E0133, stabilised unsafe in 1.80) - Add #[allow(dead_code)] on WeftCompositorState protocol state fields are held for delegate dispatch, not yet consumed - Remove spurious mut on display binding drm.rs: - Revert initialize_output arg to &output (&Output: Into<OutputModeSource>) - Specify element type via ::<_, WaylandSurfaceRenderElement<_>> turbofish on initialize_output (E0277/E0308) - Handle Result from scan_connectors, collect via IntoIterator (E0308) - Wrap set_var in unsafe block; remove spurious mut on display - Collapse nested if/if-let blocks per clippy::collapsible_if - Remove useless .into() on render_node (clippy::useless_conversion) drm_device.rs: - Add #[allow(dead_code)] on WeftOutputSurface (device_id, global used in hotplug handling) scripts/wsl-check.sh (new): - WSL2 helper: injects libdisplay-info 0.2.9 shim .pc to satisfy the < 0.3.0 constraint while openSUSE ships 0.3.0; runs check/clippy/fmt
2026-03-10 22:43:43 +00:00
DrmDeviceFd, DrmNode,
exporter::gbm::GbmFramebufferExporter,
output::{DrmOutput, DrmOutputManager},
},
renderer::{
gles::GlesRenderer,
fix(compositor): resolve all Linux cargo check/clippy/fmt failures Fixes found by running cargo check + clippy -D warnings + fmt --check on openSUSE Tumbleweed WSL2 (Rust 1.93.0). input.rs: - Add GestureBeginEvent (fingers()), GestureEndEvent (cancelled()), TouchEvent (slot()) supertrait imports - Add explicit ::<B> turbofish to all handle_* dispatch calls Rust cannot reverse-infer B from an associated type bound - Remove now-redundant specific gesture/touch event trait imports state.rs: - Add reposition_request to XdgShellHandler (E0046) - Wrap protocol-level LayerSurface in desktop::LayerSurface::new for map_layer (E0308) - Wrap std::env::set_var in unsafe block (E0133, stabilised unsafe in 1.80) - Add #[allow(dead_code)] on WeftCompositorState protocol state fields are held for delegate dispatch, not yet consumed - Remove spurious mut on display binding drm.rs: - Revert initialize_output arg to &output (&Output: Into<OutputModeSource>) - Specify element type via ::<_, WaylandSurfaceRenderElement<_>> turbofish on initialize_output (E0277/E0308) - Handle Result from scan_connectors, collect via IntoIterator (E0308) - Wrap set_var in unsafe block; remove spurious mut on display - Collapse nested if/if-let blocks per clippy::collapsible_if - Remove useless .into() on render_node (clippy::useless_conversion) drm_device.rs: - Add #[allow(dead_code)] on WeftOutputSurface (device_id, global used in hotplug handling) scripts/wsl-check.sh (new): - WSL2 helper: injects libdisplay-info 0.2.9 shim .pc to satisfy the < 0.3.0 constraint while openSUSE ships 0.3.0; runs check/clippy/fmt
2026-03-10 22:43:43 +00:00
multigpu::{GpuManager, gbm::GbmGlesBackend},
},
session::libseat::LibSeatSession,
},
desktop::utils::OutputPresentationFeedback,
output::Output,
reexports::{
calloop::RegistrationToken,
drm::control::crtc,
fix(compositor): resolve all Linux cargo check/clippy/fmt failures Fixes found by running cargo check + clippy -D warnings + fmt --check on openSUSE Tumbleweed WSL2 (Rust 1.93.0). input.rs: - Add GestureBeginEvent (fingers()), GestureEndEvent (cancelled()), TouchEvent (slot()) supertrait imports - Add explicit ::<B> turbofish to all handle_* dispatch calls Rust cannot reverse-infer B from an associated type bound - Remove now-redundant specific gesture/touch event trait imports state.rs: - Add reposition_request to XdgShellHandler (E0046) - Wrap protocol-level LayerSurface in desktop::LayerSurface::new for map_layer (E0308) - Wrap std::env::set_var in unsafe block (E0133, stabilised unsafe in 1.80) - Add #[allow(dead_code)] on WeftCompositorState protocol state fields are held for delegate dispatch, not yet consumed - Remove spurious mut on display binding drm.rs: - Revert initialize_output arg to &output (&Output: Into<OutputModeSource>) - Specify element type via ::<_, WaylandSurfaceRenderElement<_>> turbofish on initialize_output (E0277/E0308) - Handle Result from scan_connectors, collect via IntoIterator (E0308) - Wrap set_var in unsafe block; remove spurious mut on display - Collapse nested if/if-let blocks per clippy::collapsible_if - Remove useless .into() on render_node (clippy::useless_conversion) drm_device.rs: - Add #[allow(dead_code)] on WeftOutputSurface (device_id, global used in hotplug handling) scripts/wsl-check.sh (new): - WSL2 helper: injects libdisplay-info 0.2.9 shim .pc to satisfy the < 0.3.0 constraint while openSUSE ships 0.3.0; runs check/clippy/fmt
2026-03-10 22:43:43 +00:00
wayland_server::{DisplayHandle, backend::GlobalId},
},
};
use smithay_drm_extras::drm_scanner::DrmScanner;
pub type WeftAllocator = GbmAllocator<DrmDeviceFd>;
pub type WeftExporter = GbmFramebufferExporter<DrmDeviceFd>;
fix(compositor): resolve all Linux cargo check/clippy/fmt failures Fixes found by running cargo check + clippy -D warnings + fmt --check on openSUSE Tumbleweed WSL2 (Rust 1.93.0). input.rs: - Add GestureBeginEvent (fingers()), GestureEndEvent (cancelled()), TouchEvent (slot()) supertrait imports - Add explicit ::<B> turbofish to all handle_* dispatch calls Rust cannot reverse-infer B from an associated type bound - Remove now-redundant specific gesture/touch event trait imports state.rs: - Add reposition_request to XdgShellHandler (E0046) - Wrap protocol-level LayerSurface in desktop::LayerSurface::new for map_layer (E0308) - Wrap std::env::set_var in unsafe block (E0133, stabilised unsafe in 1.80) - Add #[allow(dead_code)] on WeftCompositorState protocol state fields are held for delegate dispatch, not yet consumed - Remove spurious mut on display binding drm.rs: - Revert initialize_output arg to &output (&Output: Into<OutputModeSource>) - Specify element type via ::<_, WaylandSurfaceRenderElement<_>> turbofish on initialize_output (E0277/E0308) - Handle Result from scan_connectors, collect via IntoIterator (E0308) - Wrap set_var in unsafe block; remove spurious mut on display - Collapse nested if/if-let blocks per clippy::collapsible_if - Remove useless .into() on render_node (clippy::useless_conversion) drm_device.rs: - Add #[allow(dead_code)] on WeftOutputSurface (device_id, global used in hotplug handling) scripts/wsl-check.sh (new): - WSL2 helper: injects libdisplay-info 0.2.9 shim .pc to satisfy the < 0.3.0 constraint while openSUSE ships 0.3.0; runs check/clippy/fmt
2026-03-10 22:43:43 +00:00
pub type WeftDrmOutput =
DrmOutput<WeftAllocator, WeftExporter, Option<OutputPresentationFeedback>, DrmDeviceFd>;
pub type WeftDrmOutputManager =
DrmOutputManager<WeftAllocator, WeftExporter, Option<OutputPresentationFeedback>, DrmDeviceFd>;
pub type WeftGpuManager = GpuManager<GbmGlesBackend<GlesRenderer, DrmDeviceFd>>;
fix(compositor): resolve all Linux cargo check/clippy/fmt failures Fixes found by running cargo check + clippy -D warnings + fmt --check on openSUSE Tumbleweed WSL2 (Rust 1.93.0). input.rs: - Add GestureBeginEvent (fingers()), GestureEndEvent (cancelled()), TouchEvent (slot()) supertrait imports - Add explicit ::<B> turbofish to all handle_* dispatch calls Rust cannot reverse-infer B from an associated type bound - Remove now-redundant specific gesture/touch event trait imports state.rs: - Add reposition_request to XdgShellHandler (E0046) - Wrap protocol-level LayerSurface in desktop::LayerSurface::new for map_layer (E0308) - Wrap std::env::set_var in unsafe block (E0133, stabilised unsafe in 1.80) - Add #[allow(dead_code)] on WeftCompositorState protocol state fields are held for delegate dispatch, not yet consumed - Remove spurious mut on display binding drm.rs: - Revert initialize_output arg to &output (&Output: Into<OutputModeSource>) - Specify element type via ::<_, WaylandSurfaceRenderElement<_>> turbofish on initialize_output (E0277/E0308) - Handle Result from scan_connectors, collect via IntoIterator (E0308) - Wrap set_var in unsafe block; remove spurious mut on display - Collapse nested if/if-let blocks per clippy::collapsible_if - Remove useless .into() on render_node (clippy::useless_conversion) drm_device.rs: - Add #[allow(dead_code)] on WeftOutputSurface (device_id, global used in hotplug handling) scripts/wsl-check.sh (new): - WSL2 helper: injects libdisplay-info 0.2.9 shim .pc to satisfy the < 0.3.0 constraint while openSUSE ships 0.3.0; runs check/clippy/fmt
2026-03-10 22:43:43 +00:00
#[allow(dead_code)]
pub struct WeftOutputSurface {
pub output: Output,
pub drm_output: WeftDrmOutput,
pub device_id: DrmNode,
pub global: GlobalId,
}
pub struct WeftDrmDevice {
pub drm_output_manager: WeftDrmOutputManager,
pub drm_scanner: DrmScanner,
pub surfaces: HashMap<crtc::Handle, WeftOutputSurface>,
pub render_node: Option<DrmNode>,
pub registration_token: RegistrationToken,
}
pub struct WeftDrmData {
pub session: LibSeatSession,
pub primary_gpu: DrmNode,
pub gpu_manager: WeftGpuManager,
pub devices: HashMap<DrmNode, WeftDrmDevice>,
pub keyboards: Vec<smithay::reexports::input::Device>,
pub display_handle: DisplayHandle,
pub start_time: Instant,
}