tty: Avoid non-linear cross-device formats
Browse files at this commit1c7c5b3f28b3222844c3e28b40fda2f4477a37ddParent: b9d78121 changed file +8 -1
- src/backend/tty.rs +8 -1
src/backend/tty.rsmodified+8 -1
| @@ -32,6 +32,7 @@ use smithay::reexports::calloop::{Dispatcher, LoopHandle, RegistrationToken}; | ||
| 32 | 32 | use smithay::reexports::drm::control::{ |
| 33 | 33 | connector, crtc, property, Device, Mode as DrmMode, ModeFlags, ModeTypeFlags, |
| 34 | 34 | }; |
| 35 | +use smithay::reexports::gbm::Modifier; | |
| 35 | 36 | use smithay::reexports::input::Libinput; |
| 36 | 37 | use smithay::reexports::rustix::fs::OFlags; |
| 37 | 38 | use smithay::reexports::wayland_protocols; |
| @@ -1234,11 +1235,17 @@ fn surface_dmabuf_feedback( | ||
| 1234 | 1235 | |
| 1235 | 1236 | // We limit the scan-out trache to formats we can also render from so that there is always a |
| 1236 | 1237 | // 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 | |
| 1238 | 1239 | .intersection(&primary_formats) |
| 1239 | 1240 | .copied() |
| 1240 | 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 | 1249 | let builder = DmabufFeedbackBuilder::new(primary_render_node.dev_id(), primary_formats); |
| 1243 | 1250 | |
| 1244 | 1251 | let scanout = builder |