Message ID | 1496392332-8722-5-git-send-email-boris.brezillon@free-electrons.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Boris Brezillon <boris.brezillon@free-electrons.com> writes: > Replace the drm_atomic_helper_wait_for_vblanks() with a call to > drm_atomic_helper_wait_for_flip_done(). This allows better detection of > page flip done events which what we are really waiting for in > vc4_atomic_complete_commit(). > > With this approach, we also addresse the 'missed single vblank event' > problem that can arise when the CRTC is configured in oneshot mode > (only a single frame is generated and the CRTC is immediately paused > after this frame). Note that this oneshot mode will be used for the > writeback connector feature. Should we just use drm_atomic_helper_commit_tail() and make this change in the core helper, instead? Actually, I'm confused. drm_atomic_helper_commit_cleanup_done() seems to be waiting for the flip_done on the crtc, already. What's the difference?
On Tue, 06 Jun 2017 13:24:33 -0700 Eric Anholt <eric@anholt.net> wrote: > Boris Brezillon <boris.brezillon@free-electrons.com> writes: > > > Replace the drm_atomic_helper_wait_for_vblanks() with a call to > > drm_atomic_helper_wait_for_flip_done(). This allows better detection of > > page flip done events which what we are really waiting for in > > vc4_atomic_complete_commit(). > > > > With this approach, we also addresse the 'missed single vblank event' > > problem that can arise when the CRTC is configured in oneshot mode > > (only a single frame is generated and the CRTC is immediately paused > > after this frame). Note that this oneshot mode will be used for the > > writeback connector feature. > > Should we just use drm_atomic_helper_commit_tail() and make this change > in the core helper, instead? Hm, not sure changing the default behavior is such a good idea. I don't want to break other drivers. > > Actually, I'm confused. drm_atomic_helper_commit_cleanup_done() seems > to be waiting for the flip_done on the crtc, already. What's the > difference? Actually, drm_atomic_helper_wait_for_flip_done() is called just before drm_atomic_helper_cleanup_planes() which in turn is called before drm_atomic_helper_commit_cleanup_done(). My understanding was that it was unsafe to call plane->cleanup_fb() on FBs that are still in use, and the only thing guaranteeing that FBs are not used anymore is the flip_done event. Maybe I'm wrong, and FB refcounting is enough to make sure resources are preserved until page flip is actually done.
diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c index f229abc0991b..86a60e9b623d 100644 --- a/drivers/gpu/drm/vc4/vc4_kms.c +++ b/drivers/gpu/drm/vc4/vc4_kms.c @@ -63,7 +63,7 @@ vc4_atomic_complete_commit(struct vc4_commit *c) drm_atomic_helper_commit_hw_done(state); - drm_atomic_helper_wait_for_vblanks(dev, state); + drm_atomic_helper_wait_for_flip_done(dev, state); drm_atomic_helper_cleanup_planes(dev, state);
Replace the drm_atomic_helper_wait_for_vblanks() with a call to drm_atomic_helper_wait_for_flip_done(). This allows better detection of page flip done events which what we are really waiting for in vc4_atomic_complete_commit(). With this approach, we also addresse the 'missed single vblank event' problem that can arise when the CRTC is configured in oneshot mode (only a single frame is generated and the CRTC is immediately paused after this frame). Note that this oneshot mode will be used for the writeback connector feature. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> --- drivers/gpu/drm/vc4/vc4_kms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)