Skip to content

backend-drm: make sure all buffers are released when an output is removed

Michael Olbrich requested to merge mol/weston:drm-release into main

When an output is destroyed then the output state is freed immediately. In this case, the plane state is only partially destroyed because it is the currently active state. This includes the buffer reference.

Without the output, the plane will not be updated any more until it is used by a different output (if possible) or the output returns and the plane is used again. As a result, the buffer reference is kept for a long time. This will cause some applications to stall because weston now keeps two buffers (the one here and another one for a different output where the application is now displayed).

To avoid this, make sure the plane state is destroyed entirely when the output is destroyed. In theory, this could cause visual artifacts because the buffer is returned while it is still used for scanout. In reality, outputs are only destroyed when the monitor is unpluged, so any artifacts will not be visible anyways.

Merge request reports