Back-merge tag 'v4.7-rc5' into drm-next
[cascardo/linux.git] / drivers / gpu / drm / vc4 / vc4_kms.c
index 861a623..9a217fd 100644 (file)
@@ -111,6 +111,8 @@ static int vc4_atomic_commit(struct drm_device *dev,
        int i;
        uint64_t wait_seqno = 0;
        struct vc4_commit *c;
+       struct drm_plane *plane;
+       struct drm_plane_state *new_state;
 
        c = commit_init(state);
        if (!c)
@@ -138,13 +140,7 @@ static int vc4_atomic_commit(struct drm_device *dev,
                return ret;
        }
 
-       for (i = 0; i < dev->mode_config.num_total_plane; i++) {
-               struct drm_plane *plane = state->planes[i];
-               struct drm_plane_state *new_state = state->plane_states[i];
-
-               if (!plane)
-                       continue;
-
+       for_each_plane_in_state(state, plane, new_state, i) {
                if ((plane->state->fb != new_state->fb) && new_state->fb) {
                        struct drm_gem_cma_object *cma_bo =
                                drm_fb_cma_get_gem_obj(new_state->fb, 0);
@@ -160,7 +156,7 @@ static int vc4_atomic_commit(struct drm_device *dev,
         * the software side now.
         */
 
-       drm_atomic_helper_swap_state(dev, state);
+       drm_atomic_helper_swap_state(state, true);
 
        /*
         * Everything below can be run asynchronously without the need to grab