smithay icon indicating copy to clipboard operation
smithay copied to clipboard

desktop: subsurface destruction artifacts

Open cmeissl opened this issue 3 years ago • 5 comments

When a sub-surface is destroyed the old geometry is not damaged. This results in artificats where parts of the gone sub-subsurface are still visible on-screen.

cmeissl avatar Jun 20 '22 13:06 cmeissl

This should now be finally fixable using https://smithay.github.io/smithay/smithay/wayland/compositor/fn.add_destruction_hook.html. When creating a Window/LayerSurface/Popup it's subsurfaces (and new ones appearing later) should receive a destruction hook, that for example sends their last geometry over a channel on drop. On accumulated_damage the toplevel-structure could drain the other end of that channel and add it to the damage.

Drakulix avatar Jun 20 '22 14:06 Drakulix

I guess we would need to drain to an intermediate vec to support multiple outputs/renderer keeping the last n external damage.

cmeissl avatar Jun 20 '22 16:06 cmeissl

yeah true. but the basic idea should work for the most part, I hope. Because the destruction_callback is not giving us much more options than using something like a channel.

Drakulix avatar Jun 20 '22 17:06 Drakulix

Not sure if this works for all subsurfaces. There could be a sub-subsurface where the parent subsurface gets unmapped. This should also use the geometry of the sub-subsurface as damage. So we should also damage on unmap and use the complete (previous?) surface tree geometry for the damage.

cmeissl avatar Jun 20 '22 20:06 cmeissl

Not sure if this works for all subsurfaces. There could be a sub-subsurface where the parent subsurface gets unmapped. This should also use the geometry of the sub-subsurface as damage. So we should also damage on unmap and use the complete (previous?) surface tree geometry for the damage.

Well in that case we probably need a dirty_flag for the Window (maybe an AtomicBool) and diff the surface_tree on the next accumulated_damage call, if that is true, or something like that.

Drakulix avatar Jun 20 '22 20:06 Drakulix