@@ -2885,6 +2885,7 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set,
* drm_atomic_helper_disable_all - disable all currently active outputs
* @dev: DRM device
* @ctx: lock acquisition context
+ * @clean_old_fbs: update the plane->fb/old_fb pointers?
*
* Loops through all connectors, finding those that aren't turned off and then
* turns them off by setting their DPMS mode to OFF and deactivating the CRTC
@@ -2905,7 +2906,8 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set,
* drm_atomic_helper_shutdown().
*/
int drm_atomic_helper_disable_all(struct drm_device *dev,
- struct drm_modeset_acquire_ctx *ctx)
+ struct drm_modeset_acquire_ctx *ctx,
+ bool clean_old_fbs)
{
struct drm_atomic_state *state;
struct drm_connector_state *conn_state;
@@ -2914,6 +2916,7 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,
struct drm_plane *plane;
struct drm_crtc_state *crtc_state;
struct drm_crtc *crtc;
+ unsigned int plane_mask = 0;
int ret, i;
state = drm_atomic_state_alloc(dev);
@@ -2956,10 +2959,17 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,
goto free;
drm_atomic_set_fb_for_plane(plane_state, NULL);
+
+ if (clean_old_fbs) {
+ plane->old_fb = plane->fb;
+ plane_mask |= BIT(drm_plane_index(plane));
+ }
}
ret = drm_atomic_commit(state);
free:
+ drm_atomic_clean_old_fb(dev, plane_mask, ret);
+
drm_atomic_state_put(state);
return ret;
}
@@ -2986,7 +2996,7 @@ void drm_atomic_helper_shutdown(struct drm_device *dev)
while (1) {
ret = drm_modeset_lock_all_ctx(dev, &ctx);
if (!ret)
- ret = drm_atomic_helper_disable_all(dev, &ctx);
+ ret = drm_atomic_helper_disable_all(dev, &ctx, true);
if (ret != -EDEADLK)
break;
@@ -3046,7 +3056,7 @@ struct drm_atomic_state *drm_atomic_helper_suspend(struct drm_device *dev)
if (IS_ERR(state))
goto unlock;
- err = drm_atomic_helper_disable_all(dev, &ctx);
+ err = drm_atomic_helper_disable_all(dev, &ctx, false);
if (err < 0) {
drm_atomic_state_put(state);
state = ERR_PTR(err);
@@ -3716,7 +3716,7 @@ void intel_prepare_reset(struct drm_i915_private *dev_priv)
return;
}
- ret = drm_atomic_helper_disable_all(dev, ctx);
+ ret = drm_atomic_helper_disable_all(dev, ctx, false);
if (ret) {
DRM_ERROR("Suspending crtc's failed with %i\n", ret);
drm_atomic_state_put(state);
@@ -122,7 +122,8 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set,
struct drm_atomic_state *state);
int drm_atomic_helper_disable_all(struct drm_device *dev,
- struct drm_modeset_acquire_ctx *ctx);
+ struct drm_modeset_acquire_ctx *ctx,
+ bool clean_old_fbs);
void drm_atomic_helper_shutdown(struct drm_device *dev);
struct drm_atomic_state *drm_atomic_helper_suspend(struct drm_device *dev);
int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,