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};
32 use smithay::reexports::drm::control::{32 use smithay::reexports::drm::control::{
33 connector, crtc, property, Device, Mode as DrmMode, ModeFlags, ModeTypeFlags,33 connector, crtc, property, Device, Mode as DrmMode, ModeFlags, ModeTypeFlags,
34 };34 };
35+use smithay::reexports::gbm::Modifier;
35 use smithay::reexports::input::Libinput;36 use smithay::reexports::input::Libinput;
36 use smithay::reexports::rustix::fs::OFlags;37 use smithay::reexports::rustix::fs::OFlags;
37 use smithay::reexports::wayland_protocols;38 use smithay::reexports::wayland_protocols;
@@ -1234,11 +1235,17 @@ fn surface_dmabuf_feedback(
1234 1235
1235 // We limit the scan-out trache to formats we can also render from so that there is always a1236 // We limit the scan-out trache to formats we can also render from so that there is always a
1236 // fallback render path available in case the supplied buffer can not be scanned out directly.1237 // fallback render path available in case the supplied buffer can not be scanned out directly.
1237- let scanout_formats = plane_formats1238+ let mut scanout_formats = plane_formats
1238 .intersection(&primary_formats)1239 .intersection(&primary_formats)
1239 .copied()1240 .copied()
1240 .collect::<Vec<_>>();1241 .collect::<Vec<_>>();
1241 1242
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+
1242 let builder = DmabufFeedbackBuilder::new(primary_render_node.dev_id(), primary_formats);1249 let builder = DmabufFeedbackBuilder::new(primary_render_node.dev_id(), primary_formats);
1243 1250
1244 let scanout = builder1251 let scanout = builder