drm/atomic: Add sanity checks to drm_atomic_helper_async_commit()
authorBoris Brezillon <boris.brezillon@bootlin.com>
Fri, 30 Mar 2018 14:55:18 +0000 (16:55 +0200)
committerBoris Brezillon <boris.brezillon@bootlin.com>
Wed, 18 Apr 2018 07:06:16 +0000 (09:06 +0200)
->atomic_async_update() requires that drivers update the plane->state
object before returning. Make sure at least common properties have been
updated.

Cc: Gustavo Padovan <gustavo@padovan.org>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Acked-by: Eric Anholt <eric@anholt.net>
Acked-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180330145518.29770-1-boris.brezillon@bootlin.com
drivers/gpu/drm/drm_atomic_helper.c

index 0587a0a2f3aa29f8446580bfb2d8f2cb14a0aca5..9cb2209f6fc8dec6836631a4211e4c4141d74e34 100644 (file)
@@ -1572,6 +1572,17 @@ void drm_atomic_helper_async_commit(struct drm_device *dev,
        for_each_new_plane_in_state(state, plane, plane_state, i) {
                funcs = plane->helper_private;
                funcs->atomic_async_update(plane, plane_state);
+
+               /*
+                * ->atomic_async_update() is supposed to update the
+                * plane->state in-place, make sure at least common
+                * properties have been properly updated.
+                */
+               WARN_ON_ONCE(plane->state->fb != plane_state->fb);
+               WARN_ON_ONCE(plane->state->crtc_x != plane_state->crtc_x);
+               WARN_ON_ONCE(plane->state->crtc_y != plane_state->crtc_y);
+               WARN_ON_ONCE(plane->state->src_x != plane_state->src_x);
+               WARN_ON_ONCE(plane->state->src_y != plane_state->src_y);
        }
 }
 EXPORT_SYMBOL(drm_atomic_helper_async_commit);