Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm: Add drm_atomic_helper_wait_for_flip_done()

Add an helper to wait for all page flips of an atomic state to be done.

v2:
- Pimp kerneldoc as discussed with Boris on irc
- Add missing doc for @dev.
- Use old_state for consitency with wait_for_vblanks

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> (v1)
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1496392332-8722-2-git-send-email-boris.brezillon@free-electrons.com

authored by

Boris Brezillon and committed by
Daniel Vetter
01086487 2b3d860e

+47 -2
+42 -1
drivers/gpu/drm/drm_atomic_helper.c
··· 1185 1185 * 1186 1186 * Helper to, after atomic commit, wait for vblanks on all effected 1187 1187 * crtcs (ie. before cleaning up old framebuffers using 1188 - * drm_atomic_helper_cleanup_planes()). It will only wait on crtcs where the 1188 + * drm_atomic_helper_cleanup_planes()). It will only wait on CRTCs where the 1189 1189 * framebuffers have actually changed to optimize for the legacy cursor and 1190 1190 * plane update use-case. 1191 + * 1192 + * Drivers using the nonblocking commit tracking support initialized by calling 1193 + * drm_atomic_helper_setup_commit() should look at 1194 + * drm_atomic_helper_wait_for_flip_done() as an alternative. 1191 1195 */ 1192 1196 void 1193 1197 drm_atomic_helper_wait_for_vblanks(struct drm_device *dev, ··· 1237 1233 } 1238 1234 } 1239 1235 EXPORT_SYMBOL(drm_atomic_helper_wait_for_vblanks); 1236 + 1237 + /** 1238 + * drm_atomic_helper_wait_for_flip_done - wait for all page flips to be done 1239 + * @dev: DRM device 1240 + * @old_state: atomic state object with old state structures 1241 + * 1242 + * Helper to, after atomic commit, wait for page flips on all effected 1243 + * crtcs (ie. before cleaning up old framebuffers using 1244 + * drm_atomic_helper_cleanup_planes()). Compared to 1245 + * drm_atomic_helper_wait_for_vblanks() this waits for the completion of on all 1246 + * CRTCs, assuming that cursors-only updates are signalling their completion 1247 + * immediately (or using a different path). 1248 + * 1249 + * This requires that drivers use the nonblocking commit tracking support 1250 + * initialized using drm_atomic_helper_setup_commit(). 1251 + */ 1252 + void drm_atomic_helper_wait_for_flip_done(struct drm_device *dev, 1253 + struct drm_atomic_state *old_state) 1254 + { 1255 + struct drm_crtc_state *crtc_state; 1256 + struct drm_crtc *crtc; 1257 + int i; 1258 + 1259 + for_each_crtc_in_state(old_state, crtc, crtc_state, i) { 1260 + struct drm_crtc_commit *commit = old_state->crtcs[i].commit; 1261 + int ret; 1262 + 1263 + if (!commit) 1264 + continue; 1265 + 1266 + ret = wait_for_completion_timeout(&commit->flip_done, 10 * HZ); 1267 + if (ret == 0) 1268 + DRM_ERROR("[CRTC:%d:%s] flip_done timed out\n", 1269 + crtc->base.id, crtc->name); 1270 + } 1271 + } 1272 + EXPORT_SYMBOL(drm_atomic_helper_wait_for_flip_done); 1240 1273 1241 1274 /** 1242 1275 * drm_atomic_helper_commit_tail - commit atomic update to hardware
+3
include/drm/drm_atomic_helper.h
··· 52 52 void drm_atomic_helper_wait_for_vblanks(struct drm_device *dev, 53 53 struct drm_atomic_state *old_state); 54 54 55 + void drm_atomic_helper_wait_for_flip_done(struct drm_device *dev, 56 + struct drm_atomic_state *old_state); 57 + 55 58 void 56 59 drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev, 57 60 struct drm_atomic_state *old_state);
+2 -1
include/drm/drm_modeset_helper_vtables.h
··· 1169 1169 * After the atomic update is committed to the hardware this hook needs 1170 1170 * to call drm_atomic_helper_commit_hw_done(). Then wait for the upate 1171 1171 * to be executed by the hardware, for example using 1172 - * drm_atomic_helper_wait_for_vblanks(), and then clean up the old 1172 + * drm_atomic_helper_wait_for_vblanks() or 1173 + * drm_atomic_helper_wait_for_flip_done(), and then clean up the old 1173 1174 * framebuffers using drm_atomic_helper_cleanup_planes(). 1174 1175 * 1175 1176 * When disabling a CRTC this hook _must_ stall for the commit to