@@ -993,13 +993,15 @@ EXPORT_SYMBOL(drm_atomic_helper_commit_modeset_enables);
* incoming fb's and stash it in the drm_plane_state. This is called after
* drm_atomic_helper_swap_state() so it uses the current plane state (and
* just uses the atomic state to find the changed planes)
+ *
+ * Return 0 on sucess or < 0 on error.
*/
-void drm_atomic_helper_wait_for_fences(struct drm_device *dev,
- struct drm_atomic_state *state)
+int drm_atomic_helper_wait_for_fences(struct drm_device *dev,
+ struct drm_atomic_state *state)
{
struct drm_plane *plane;
struct drm_plane_state *plane_state;
- int i;
+ int i, ret;
for_each_plane_in_state(state, plane, plane_state, i) {
if (!plane->state->fence)
@@ -1007,10 +1009,14 @@ void drm_atomic_helper_wait_for_fences(struct drm_device *dev,
WARN_ON(!plane->state->fb);
- fence_wait(plane->state->fence, false);
+ ret = fence_wait(plane->state->fence, true);
+ if (ret)
+ return ret;
fence_put(plane->state->fence);
plane->state->fence = NULL;
}
+
+ return 0;
}
EXPORT_SYMBOL(drm_atomic_helper_wait_for_fences);
@@ -1174,7 +1180,9 @@ int drm_atomic_helper_commit(struct drm_device *dev,
* current layout.
*/
- drm_atomic_helper_wait_for_fences(dev, state);
+ ret = drm_atomic_helper_wait_for_fences(dev, state);
+ if (ret)
+ goto out;
drm_atomic_helper_commit_modeset_disables(dev, state);
@@ -1184,11 +1192,12 @@ int drm_atomic_helper_commit(struct drm_device *dev,
drm_atomic_helper_wait_for_vblanks(dev, state);
+out:
drm_atomic_helper_cleanup_planes(dev, state);
drm_atomic_state_free(state);
- return 0;
+ return ret;
}
EXPORT_SYMBOL(drm_atomic_helper_commit);
@@ -42,8 +42,8 @@ int drm_atomic_helper_commit(struct drm_device *dev,
struct drm_atomic_state *state,
bool async);
-void drm_atomic_helper_wait_for_fences(struct drm_device *dev,
- struct drm_atomic_state *state);
+int drm_atomic_helper_wait_for_fences(struct drm_device *dev,
+ struct drm_atomic_state *state);
bool drm_atomic_helper_framebuffer_changed(struct drm_device *dev,
struct drm_atomic_state *old_state,
struct drm_crtc *crtc);