Skip to content

Commit 049cfff

Browse files
committed
drm/vc4: kms: Add missing drm_crtc_commit_put
Commit 9ec03d7 ("drm/vc4: kms: Wait on previous FIFO users before a commit") introduced a global state for the HVS, with each FIFO storing the current CRTC commit so that we can properly synchronize commits. However, the refcounting was off and we thus ended up leaking the drm_crtc_commit structure every commit. Add a drm_crtc_commit_put to prevent the leakage. Fixes: 9ec03d7 ("drm/vc4: kms: Wait on previous FIFO users before a commit") Signed-off-by: Maxime Ripard <[email protected]> Reviewed-by: Dave Stevenson <[email protected]> Tested-by: Jian-Hong Pan <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent f927767 commit 049cfff

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/gpu/drm/vc4/vc4_kms.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ static void vc4_atomic_commit_tail(struct drm_atomic_state *state)
361361
struct vc4_crtc_state *vc4_crtc_state =
362362
to_vc4_crtc_state(old_crtc_state);
363363
unsigned int channel = vc4_crtc_state->assigned_channel;
364+
struct drm_crtc_commit *commit;
364365
int ret;
365366

366367
if (channel == VC4_HVS_CHANNEL_DISABLED)
@@ -369,9 +370,15 @@ static void vc4_atomic_commit_tail(struct drm_atomic_state *state)
369370
if (!old_hvs_state->fifo_state[channel].in_use)
370371
continue;
371372

372-
ret = drm_crtc_commit_wait(old_hvs_state->fifo_state[channel].pending_commit);
373+
commit = old_hvs_state->fifo_state[channel].pending_commit;
374+
if (!commit)
375+
continue;
376+
377+
ret = drm_crtc_commit_wait(commit);
373378
if (ret)
374379
drm_err(dev, "Timed out waiting for commit\n");
380+
381+
drm_crtc_commit_put(commit);
375382
}
376383

377384
if (vc4->hvs->hvs5)

0 commit comments

Comments
 (0)