backend-drm: don't copy the fence fd when duplicating the plane state

The state does not own the fd. This is usually not a problem, because the
in_fence_fd of the state is assigned during drm_assign_planes() and then
immediately used in drm_repaint_flush(). It cannot be closed in-between.

However, in the fallback path in drm_output_start_repaint_loop(), the state is
duplicated. At this point in time, the in_fence_fd may be invalid because it was
replaced in a new commit of the corresponding surface.

The plane state was already committed to the kernel when it is copied, so the
fence is no longer needed. So just clear it.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
This commit is contained in:
Michael Olbrich 2023-03-21 09:25:55 +01:00 committed by Daniel Stone
parent 0edcc9e5ba
commit d5e5428478

View File

@ -127,6 +127,10 @@ drm_plane_state_duplicate(struct drm_output_state *state_output,
*/
dst->damage_blob_id = 0;
wl_list_init(&dst->link);
/* Don't copy the fence, it may no longer be valid and waiting for it
* again is not necessary
*/
dst->in_fence_fd = -1;
wl_list_for_each_safe(old, tmp, &state_output->plane_list, link) {
/* Duplicating a plane state into the same output state, so