Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a0e99e68 authored by Daniel Vetter's avatar Daniel Vetter
Browse files

drm/i915: use drm_modeset_lock_all



Two exceptions:
- debugfs files only read information which is not related to crtc, so
  can stay on the modeset_config lock.
- Same holds for the edp vdd work in intel_dp.c. Add a corresponding
  WARN_ON and a comment next to the intel_dp struct fields for
  documentation.

Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 84849903
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -1057,6 +1057,8 @@ static void ironlake_panel_vdd_off_sync(struct intel_dp *intel_dp)
	struct drm_i915_private *dev_priv = dev->dev_private;
	struct drm_i915_private *dev_priv = dev->dev_private;
	u32 pp;
	u32 pp;


	WARN_ON(!mutex_is_locked(&dev->mode_config.mutex));

	if (!intel_dp->want_panel_vdd && ironlake_edp_have_panel_vdd(intel_dp)) {
	if (!intel_dp->want_panel_vdd && ironlake_edp_have_panel_vdd(intel_dp)) {
		pp = ironlake_get_pp_control(dev_priv);
		pp = ironlake_get_pp_control(dev_priv);
		pp &= ~EDP_FORCE_VDD;
		pp &= ~EDP_FORCE_VDD;
+2 −2
Original line number Original line Diff line number Diff line
@@ -280,7 +280,7 @@ void intel_fb_restore_mode(struct drm_device *dev)
	struct drm_mode_config *config = &dev->mode_config;
	struct drm_mode_config *config = &dev->mode_config;
	struct drm_plane *plane;
	struct drm_plane *plane;


	mutex_lock(&dev->mode_config.mutex);
	drm_modeset_lock_all(dev);


	ret = drm_fb_helper_restore_fbdev_mode(&dev_priv->fbdev->helper);
	ret = drm_fb_helper_restore_fbdev_mode(&dev_priv->fbdev->helper);
	if (ret)
	if (ret)
@@ -290,5 +290,5 @@ void intel_fb_restore_mode(struct drm_device *dev)
	list_for_each_entry(plane, &config->plane_list, head)
	list_for_each_entry(plane, &config->plane_list, head)
		plane->funcs->disable_plane(plane);
		plane->funcs->disable_plane(plane);


	mutex_unlock(&dev->mode_config.mutex);
	drm_modeset_unlock_all(dev);
}
}
+2 −2
Original line number Original line Diff line number Diff line
@@ -531,9 +531,9 @@ static int intel_lid_notify(struct notifier_block *nb, unsigned long val,


	dev_priv->modeset_on_lid = 0;
	dev_priv->modeset_on_lid = 0;


	mutex_lock(&dev->mode_config.mutex);
	drm_modeset_lock_all(dev);
	intel_modeset_setup_hw_state(dev, true);
	intel_modeset_setup_hw_state(dev, true);
	mutex_unlock(&dev->mode_config.mutex);
	drm_modeset_unlock_all(dev);


	return NOTIFY_OK;
	return NOTIFY_OK;
}
}
+7 −7
Original line number Original line Diff line number Diff line
@@ -1045,13 +1045,13 @@ int intel_overlay_put_image(struct drm_device *dev, void *data,
	}
	}


	if (!(put_image_rec->flags & I915_OVERLAY_ENABLE)) {
	if (!(put_image_rec->flags & I915_OVERLAY_ENABLE)) {
		mutex_lock(&dev->mode_config.mutex);
		drm_modeset_lock_all(dev);
		mutex_lock(&dev->struct_mutex);
		mutex_lock(&dev->struct_mutex);


		ret = intel_overlay_switch_off(overlay);
		ret = intel_overlay_switch_off(overlay);


		mutex_unlock(&dev->struct_mutex);
		mutex_unlock(&dev->struct_mutex);
		mutex_unlock(&dev->mode_config.mutex);
		drm_modeset_unlock_all(dev);


		return ret;
		return ret;
	}
	}
@@ -1075,7 +1075,7 @@ int intel_overlay_put_image(struct drm_device *dev, void *data,
		goto out_free;
		goto out_free;
	}
	}


	mutex_lock(&dev->mode_config.mutex);
	drm_modeset_lock_all(dev);
	mutex_lock(&dev->struct_mutex);
	mutex_lock(&dev->struct_mutex);


	if (new_bo->tiling_mode) {
	if (new_bo->tiling_mode) {
@@ -1157,7 +1157,7 @@ int intel_overlay_put_image(struct drm_device *dev, void *data,
		goto out_unlock;
		goto out_unlock;


	mutex_unlock(&dev->struct_mutex);
	mutex_unlock(&dev->struct_mutex);
	mutex_unlock(&dev->mode_config.mutex);
	drm_modeset_unlock_all(dev);


	kfree(params);
	kfree(params);


@@ -1165,7 +1165,7 @@ int intel_overlay_put_image(struct drm_device *dev, void *data,


out_unlock:
out_unlock:
	mutex_unlock(&dev->struct_mutex);
	mutex_unlock(&dev->struct_mutex);
	mutex_unlock(&dev->mode_config.mutex);
	drm_modeset_unlock_all(dev);
	drm_gem_object_unreference_unlocked(&new_bo->base);
	drm_gem_object_unreference_unlocked(&new_bo->base);
out_free:
out_free:
	kfree(params);
	kfree(params);
@@ -1241,7 +1241,7 @@ int intel_overlay_attrs(struct drm_device *dev, void *data,
		return -ENODEV;
		return -ENODEV;
	}
	}


	mutex_lock(&dev->mode_config.mutex);
	drm_modeset_lock_all(dev);
	mutex_lock(&dev->struct_mutex);
	mutex_lock(&dev->struct_mutex);


	ret = -EINVAL;
	ret = -EINVAL;
@@ -1307,7 +1307,7 @@ int intel_overlay_attrs(struct drm_device *dev, void *data,
	ret = 0;
	ret = 0;
out_unlock:
out_unlock:
	mutex_unlock(&dev->struct_mutex);
	mutex_unlock(&dev->struct_mutex);
	mutex_unlock(&dev->mode_config.mutex);
	drm_modeset_unlock_all(dev);


	return ret;
	return ret;
}
}
+4 −4
Original line number Original line Diff line number Diff line
@@ -593,7 +593,7 @@ int intel_sprite_set_colorkey(struct drm_device *dev, void *data,
	if ((set->flags & (I915_SET_COLORKEY_DESTINATION | I915_SET_COLORKEY_SOURCE)) == (I915_SET_COLORKEY_DESTINATION | I915_SET_COLORKEY_SOURCE))
	if ((set->flags & (I915_SET_COLORKEY_DESTINATION | I915_SET_COLORKEY_SOURCE)) == (I915_SET_COLORKEY_DESTINATION | I915_SET_COLORKEY_SOURCE))
		return -EINVAL;
		return -EINVAL;


	mutex_lock(&dev->mode_config.mutex);
	drm_modeset_lock_all(dev);


	obj = drm_mode_object_find(dev, set->plane_id, DRM_MODE_OBJECT_PLANE);
	obj = drm_mode_object_find(dev, set->plane_id, DRM_MODE_OBJECT_PLANE);
	if (!obj) {
	if (!obj) {
@@ -606,7 +606,7 @@ int intel_sprite_set_colorkey(struct drm_device *dev, void *data,
	ret = intel_plane->update_colorkey(plane, set);
	ret = intel_plane->update_colorkey(plane, set);


out_unlock:
out_unlock:
	mutex_unlock(&dev->mode_config.mutex);
	drm_modeset_unlock_all(dev);
	return ret;
	return ret;
}
}


@@ -622,7 +622,7 @@ int intel_sprite_get_colorkey(struct drm_device *dev, void *data,
	if (!drm_core_check_feature(dev, DRIVER_MODESET))
	if (!drm_core_check_feature(dev, DRIVER_MODESET))
		return -ENODEV;
		return -ENODEV;


	mutex_lock(&dev->mode_config.mutex);
	drm_modeset_lock_all(dev);


	obj = drm_mode_object_find(dev, get->plane_id, DRM_MODE_OBJECT_PLANE);
	obj = drm_mode_object_find(dev, get->plane_id, DRM_MODE_OBJECT_PLANE);
	if (!obj) {
	if (!obj) {
@@ -635,7 +635,7 @@ int intel_sprite_get_colorkey(struct drm_device *dev, void *data,
	intel_plane->get_colorkey(plane, get);
	intel_plane->get_colorkey(plane, get);


out_unlock:
out_unlock:
	mutex_unlock(&dev->mode_config.mutex);
	drm_modeset_unlock_all(dev);
	return ret;
	return ret;
}
}