forge
Explore
Log in

Don't you dare go Hollow

tty: Avoid non-linear cross-device formats

Browse files at this commit

1c7c5b3f28b3222844c3e28b40fda2f4477a37ddIvan MolodetskikhParent: b9d7812
src/backend/tty.rsmodified+8 -1
@@ -32,6 +32,7 @@ use smithay::reexports::calloop::{Dispatcher, LoopHandle, RegistrationToken};
3232 use smithay::reexports::drm::control::{
3333 connector, crtc, property, Device, Mode as DrmMode, ModeFlags, ModeTypeFlags,
3434 };
35+use smithay::reexports::gbm::Modifier;
3536 use smithay::reexports::input::Libinput;
3637 use smithay::reexports::rustix::fs::OFlags;
3738 use smithay::reexports::wayland_protocols;
@@ -1234,11 +1235,17 @@ fn surface_dmabuf_feedback(
12341235
12351236 // We limit the scan-out trache to formats we can also render from so that there is always a
12361237 // fallback render path available in case the supplied buffer can not be scanned out directly.
1237- let scanout_formats = plane_formats
1238+ let mut scanout_formats = plane_formats
12381239 .intersection(&primary_formats)
12391240 .copied()
12401241 .collect::<Vec<_>>();
12411242
1243+ // HACK: AMD iGPU + dGPU systems share some modifiers between the two, and yet cross-device
1244+ // buffers produce a glitched scanout if the modifier is not Linear...
1245+ if primary_render_node != surface_render_node {
1246+ scanout_formats.retain(|f| f.modifier == Modifier::Linear);
1247+ }
1248+
12421249 let builder = DmabufFeedbackBuilder::new(primary_render_node.dev_id(), primary_formats);
12431250
12441251 let scanout = builder