Fix PixmanRenderer compositing: remove EGL features from default build

renderer_gl and backend_winit pulled in backend_egl, which changed the
ImportAll blanket impl to require ImportEgl — a trait PixmanRenderer
doesn't implement. This caused render_output to silently skip client
surface compositing (only the clear color rendered).

Fix: move renderer_gl and backend_winit behind a "winit" cargo feature.
Default build uses only renderer_pixman, which satisfies ImportAll via
the simpler ImportMemWl + ImportDmaWl blanket impl.

Winit backend: cargo build -p wrsrvd --features winit
Headless (default): cargo build -p wrsrvd
This commit is contained in:
Till Wegmueller 2026-04-07 18:44:19 +02:00
parent 3c6430c982
commit 9fc27d3b56
5 changed files with 34 additions and 36 deletions

View file

@ -4,6 +4,11 @@ edition.workspace = true
version.workspace = true
license.workspace = true
[features]
# Enable the Winit development backend (requires display server).
# Build with: cargo build -p wrsrvd --features winit
winit = ["smithay/renderer_gl", "smithay/backend_winit"]
[dependencies]
wayray-protocol.workspace = true
tracing.workspace = true
@ -11,16 +16,14 @@ tracing-subscriber.workspace = true
miette.workspace = true
thiserror.workspace = true
serde.workspace = true
smithay = { version = "0.7", default-features = false, features = [
"wayland_frontend",
"desktop",
"renderer_gl",
"renderer_pixman",
"backend_winit",
] }
ctrlc = "3"
quinn.workspace = true
rustls.workspace = true
rcgen.workspace = true
tokio.workspace = true
smithay = { version = "0.7", default-features = false, features = [
"wayland_frontend",
"desktop",
"renderer_pixman",
] }

View file

@ -268,24 +268,6 @@ fn render_headless_frame(data: &mut CalloopData) {
std::slice::from_raw_parts(ptr, frame_bytes)
};
// Debug: check if the framebuffer contains anything besides the clear color.
if element_count > 0 {
// Clear color [0.1, 0.1, 0.1, 1.0] ≈ [25, 25, 25, 255] in u8
// Count unique non-bg BGRA values in first 1000 pixels
let unique: std::collections::HashSet<[u8; 4]> = pixels
.chunks_exact(4)
.take(1000)
.map(|p| [p[0], p[1], p[2], p[3]])
.collect();
tracing::info!(
unique_colors = unique.len(),
first_pixel = ?&pixels[..4.min(pixels.len())],
stride,
total_bytes = pixels.len(),
"framebuffer content check"
);
}
// Send frame over network if a client is connected.
if data.client_connected {
send_frame_to_network(data, pixels, &damage, output_size.w, output_size.h, stride);

View file

@ -1,2 +1,4 @@
pub mod headless;
#[cfg(feature = "winit")]
pub mod winit;

View file

@ -75,10 +75,18 @@ fn main() -> Result<()> {
);
if use_winit {
#[cfg(feature = "winit")]
{
let result = backend::winit::run(display, state, output);
net_handle.shutdown();
result
} else {
return result;
}
#[cfg(not(feature = "winit"))]
{
eprintln!("Winit backend not compiled. Build with: cargo build --features winit");
std::process::exit(1);
}
}
backend::headless::run(display, state, output, net_handle)
}
}

View file

@ -1,9 +1,10 @@
#[cfg(feature = "winit")]
use smithay::backend::input::{
AbsolutePositionEvent, Event as InputEventTrait, InputBackend, InputEvent, KeyboardKeyEvent,
PointerAxisEvent as PointerAxisEventTrait, PointerButtonEvent as PointerButtonEventTrait,
};
use smithay::{
backend::input::{
AbsolutePositionEvent, Axis, AxisSource, ButtonState, Event as InputEventTrait,
InputBackend, InputEvent, KeyboardKeyEvent, PointerAxisEvent as PointerAxisEventTrait,
PointerButtonEvent as PointerButtonEventTrait,
},
backend::input::{Axis, AxisSource, ButtonState},
desktop::{Space, WindowSurfaceType},
input::{
Seat, SeatState,
@ -82,6 +83,8 @@ impl WayRay {
/// Process an input event from the backend and forward it to the appropriate
/// Smithay seat device (keyboard or pointer).
/// Only used by the Winit backend for local input processing.
#[cfg(feature = "winit")]
pub fn process_input_event<B: InputBackend>(&mut self, event: InputEvent<B>) {
match event {
InputEvent::Keyboard { event } => {