@@ -42,6 +42,10 @@ vc4_atomic_complete_commit(struct vc4_commit *c)
4242 struct drm_device * dev = state -> dev ;
4343 struct vc4_dev * vc4 = to_vc4_dev (dev );
4444
45+ drm_atomic_helper_wait_for_fences (dev , state , false);
46+
47+ drm_atomic_helper_wait_for_dependencies (state );
48+
4549 drm_atomic_helper_commit_modeset_disables (dev , state );
4650
4751 drm_atomic_helper_commit_planes (dev , state , 0 );
@@ -57,10 +61,14 @@ vc4_atomic_complete_commit(struct vc4_commit *c)
5761 */
5862 state -> legacy_cursor_update = false;
5963
64+ drm_atomic_helper_commit_hw_done (state );
65+
6066 drm_atomic_helper_wait_for_vblanks (dev , state );
6167
6268 drm_atomic_helper_cleanup_planes (dev , state );
6369
70+ drm_atomic_helper_commit_cleanup_done (state );
71+
6472 drm_atomic_state_put (state );
6573
6674 up (& vc4 -> async_modeset );
@@ -117,32 +125,10 @@ static int vc4_atomic_commit(struct drm_device *dev,
117125 if (!c )
118126 return - ENOMEM ;
119127
120- /* Make sure that any outstanding modesets have finished. */
121- if (nonblock ) {
122- struct drm_crtc * crtc ;
123- struct drm_crtc_state * crtc_state ;
124- unsigned long flags ;
125- bool busy = false;
126-
127- /*
128- * If there's an undispatched event to send then we're
129- * obviously still busy. If there isn't, then we can
130- * unconditionally wait for the semaphore because it
131- * shouldn't be contended (for long).
132- *
133- * This is to prevent a race where queuing a new flip
134- * from userspace immediately on receipt of an event
135- * beats our clean-up and returns EBUSY.
136- */
137- spin_lock_irqsave (& dev -> event_lock , flags );
138- for_each_crtc_in_state (state , crtc , crtc_state , i )
139- busy |= vc4_event_pending (crtc );
140- spin_unlock_irqrestore (& dev -> event_lock , flags );
141- if (busy ) {
142- kfree (c );
143- return - EBUSY ;
144- }
145- }
128+ ret = drm_atomic_helper_setup_commit (state , nonblock );
129+ if (ret )
130+ return ret ;
131+
146132 ret = down_interruptible (& vc4 -> async_modeset );
147133 if (ret ) {
148134 kfree (c );
0 commit comments