atagen

monolith

public
Star0
Watch0

Commit 7e9270240c46

tarball

atagen <boss@atagen.co>2026-10-19 08:38 UTC

1 file changed+8-3
commit: stage whole shm buffers under a viewport

Surface damage only equals buffer damage when the surface has no scale, transform or viewport, and stage_shm checked the first two. A viewport with a destination size left the staged copy short of what the surface damage covered.
Modified file: crates/monolith/src/commit.rs+8 additions−3 deletions
@@ -17,6 +17,7 @@ use smithay::wayland::dmabuf::{
1717 };
1818 use smithay::wayland::drm_syncobj::{DrmSyncobjCachedState, DrmSyncobjHandler, DrmSyncobjState};
1919 use smithay::wayland::shm::{ShmHandler, ShmState, with_buffer_contents};
20+use smithay::wayland::viewporter::ViewportCachedState;
2021
2122 impl CompositorHandler for State {
2223 fn compositor_state(&mut self) -> &mut CompositorState {
@@ -199,8 +200,8 @@ fn hold_until_readable(state: &mut State, surface: &WlSurface) {
199200
200201 /// Copies a committed shm buffer's damage on the worker, holding the commit
201202 /// until it is staged. Surface damage equals buffer damage at scale 1 with no
202-/// transform, otherwise the whole buffer is staged so it covers whatever the
203-/// import uploads.
203+/// transform and no viewport, otherwise the whole buffer is staged so it covers
204+/// whatever the import uploads.
204205 fn stage_shm(state: &mut State, surface: &WlSurface) {
205206 let job = with_states(surface, |s| {
206207 let mut cached = s.cached_state.get::<SurfaceAttributes>();
@@ -211,7 +212,11 @@ fn stage_shm(state: &mut State, surface: &WlSurface) {
211212 if get_dmabuf(buffer).is_ok() {
212213 return None;
213214 }
214- let plain = attrs.buffer_scale == 1 && attrs.buffer_transform == Transform::Normal.into();
215+ let mut viewport = s.cached_state.get::<ViewportCachedState>();
216+ let viewported = viewport.pending().src.is_some() || viewport.pending().dst.is_some();
217+ let plain = attrs.buffer_scale == 1
218+ && attrs.buffer_transform == Transform::Normal.into()
219+ && !viewported;
215220 let region = attrs
216221 .damage
217222 .iter()