Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso...
[linux-2.6-microblaze.git] / drivers / gpu / drm / drm_atomic_helper.c
index 560aaec..f2b3e28 100644 (file)
@@ -61,9 +61,9 @@
  *
  * This library also provides implementations for all the legacy driver
  * interfaces on top of the atomic interface. See drm_atomic_helper_set_config(),
- * drm_atomic_helper_disable_plane(), drm_atomic_helper_disable_plane() and the
- * various functions to implement set_property callbacks. New drivers must not
- * implement these functions themselves but must use the provided helpers.
+ * drm_atomic_helper_disable_plane(), and the various functions to implement
+ * set_property callbacks. New drivers must not implement these functions
+ * themselves but must use the provided helpers.
  *
  * The atomic helper uses the same function table structures as all other
  * modesetting helpers. See the documentation for &struct drm_crtc_helper_funcs,
@@ -592,11 +592,10 @@ mode_valid(struct drm_atomic_state *state)
  *
  * Drivers which set &drm_crtc_state.mode_changed (e.g. in their
  * &drm_plane_helper_funcs.atomic_check hooks if a plane update can't be done
- * without a full modeset) _must_ call this function afterwards after that
- * change. It is permitted to call this function multiple times for the same
- * update, e.g. when the &drm_crtc_helper_funcs.atomic_check functions depend
- * upon the adjusted dotclock for fifo space allocation and watermark
- * computation.
+ * without a full modeset) _must_ call this function after that change. It is
+ * permitted to call this function multiple times for the same update, e.g.
+ * when the &drm_crtc_helper_funcs.atomic_check functions depend upon the
+ * adjusted dotclock for fifo space allocation and watermark computation.
  *
  * RETURNS:
  * Zero for success or -errno
@@ -902,7 +901,7 @@ drm_atomic_helper_check_planes(struct drm_device *dev,
                if (!funcs || !funcs->atomic_check)
                        continue;
 
-               ret = funcs->atomic_check(plane, new_plane_state);
+               ret = funcs->atomic_check(plane, state);
                if (ret) {
                        DRM_DEBUG_ATOMIC("[PLANE:%d:%s] atomic driver check failed\n",
                                         plane->base.id, plane->name);
@@ -1742,7 +1741,7 @@ int drm_atomic_helper_async_check(struct drm_device *dev,
                return -EBUSY;
        }
 
-       return funcs->atomic_async_check(plane, new_plane_state);
+       return funcs->atomic_async_check(plane, state);
 }
 EXPORT_SYMBOL(drm_atomic_helper_async_check);
 
@@ -1772,7 +1771,7 @@ void drm_atomic_helper_async_commit(struct drm_device *dev,
                struct drm_framebuffer *old_fb = plane->state->fb;
 
                funcs = plane->helper_private;
-               funcs->atomic_async_update(plane, plane_state);
+               funcs->atomic_async_update(plane, state);
 
                /*
                 * ->atomic_async_update() is supposed to update the
@@ -2202,70 +2201,27 @@ void drm_atomic_helper_wait_for_dependencies(struct drm_atomic_state *old_state)
        struct drm_plane_state *old_plane_state;
        struct drm_connector *conn;
        struct drm_connector_state *old_conn_state;
-       struct drm_crtc_commit *commit;
        int i;
        long ret;
 
        for_each_old_crtc_in_state(old_state, crtc, old_crtc_state, i) {
-               commit = old_crtc_state->commit;
-
-               if (!commit)
-                       continue;
-
-               ret = wait_for_completion_timeout(&commit->hw_done,
-                                                 10*HZ);
-               if (ret == 0)
-                       DRM_ERROR("[CRTC:%d:%s] hw_done timed out\n",
-                                 crtc->base.id, crtc->name);
-
-               /* Currently no support for overwriting flips, hence
-                * stall for previous one to execute completely. */
-               ret = wait_for_completion_timeout(&commit->flip_done,
-                                                 10*HZ);
-               if (ret == 0)
-                       DRM_ERROR("[CRTC:%d:%s] flip_done timed out\n",
+               ret = drm_crtc_commit_wait(old_crtc_state->commit);
+               if (ret)
+                       DRM_ERROR("[CRTC:%d:%s] commit wait timed out\n",
                                  crtc->base.id, crtc->name);
        }
 
        for_each_old_connector_in_state(old_state, conn, old_conn_state, i) {
-               commit = old_conn_state->commit;
-
-               if (!commit)
-                       continue;
-
-               ret = wait_for_completion_timeout(&commit->hw_done,
-                                                 10*HZ);
-               if (ret == 0)
-                       DRM_ERROR("[CONNECTOR:%d:%s] hw_done timed out\n",
-                                 conn->base.id, conn->name);
-
-               /* Currently no support for overwriting flips, hence
-                * stall for previous one to execute completely. */
-               ret = wait_for_completion_timeout(&commit->flip_done,
-                                                 10*HZ);
-               if (ret == 0)
-                       DRM_ERROR("[CONNECTOR:%d:%s] flip_done timed out\n",
+               ret = drm_crtc_commit_wait(old_conn_state->commit);
+               if (ret)
+                       DRM_ERROR("[CONNECTOR:%d:%s] commit wait timed out\n",
                                  conn->base.id, conn->name);
        }
 
        for_each_old_plane_in_state(old_state, plane, old_plane_state, i) {
-               commit = old_plane_state->commit;
-
-               if (!commit)
-                       continue;
-
-               ret = wait_for_completion_timeout(&commit->hw_done,
-                                                 10*HZ);
-               if (ret == 0)
-                       DRM_ERROR("[PLANE:%d:%s] hw_done timed out\n",
-                                 plane->base.id, plane->name);
-
-               /* Currently no support for overwriting flips, hence
-                * stall for previous one to execute completely. */
-               ret = wait_for_completion_timeout(&commit->flip_done,
-                                                 10*HZ);
-               if (ret == 0)
-                       DRM_ERROR("[PLANE:%d:%s] flip_done timed out\n",
+               ret = drm_crtc_commit_wait(old_plane_state->commit);
+               if (ret)
+                       DRM_ERROR("[PLANE:%d:%s] commit wait timed out\n",
                                  plane->base.id, plane->name);
        }
 }
@@ -2571,9 +2527,9 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev,
                            no_disable)
                                continue;
 
-                       funcs->atomic_disable(plane, old_plane_state);
+                       funcs->atomic_disable(plane, old_state);
                } else if (new_plane_state->crtc || disabling) {
-                       funcs->atomic_update(plane, old_plane_state);
+                       funcs->atomic_update(plane, old_state);
                }
        }
 
@@ -2645,10 +2601,10 @@ drm_atomic_helper_commit_planes_on_crtc(struct drm_crtc_state *old_crtc_state)
 
                if (drm_atomic_plane_disabling(old_plane_state, new_plane_state) &&
                    plane_funcs->atomic_disable)
-                       plane_funcs->atomic_disable(plane, old_plane_state);
+                       plane_funcs->atomic_disable(plane, old_state);
                else if (new_plane_state->crtc ||
                         drm_atomic_plane_disabling(old_plane_state, new_plane_state))
-                       plane_funcs->atomic_update(plane, old_plane_state);
+                       plane_funcs->atomic_update(plane, old_state);
        }
 
        if (crtc_funcs && crtc_funcs->atomic_flush)