Commit 2b5ab0ee authored by Daniel Vetter's avatar Daniel Vetter

drm/crtc-helpers: WARN when used with atomic drivers

Motivated by an oversight of mine when looking at the atomic bochs
conversion. For consistency also switch over to the same style as used
elsewhere (e.g. in drm_mode_set_config_internal).

Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: default avatarGerd Hoffmann <kraxel@redhat.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190110103045.26821-1-daniel.vetter@ffwll.ch
parent 785cabaa
...@@ -93,6 +93,8 @@ bool drm_helper_encoder_in_use(struct drm_encoder *encoder) ...@@ -93,6 +93,8 @@ bool drm_helper_encoder_in_use(struct drm_encoder *encoder)
struct drm_connector_list_iter conn_iter; struct drm_connector_list_iter conn_iter;
struct drm_device *dev = encoder->dev; struct drm_device *dev = encoder->dev;
WARN_ON(drm_drv_uses_atomic_modeset(dev));
/* /*
* We can expect this mutex to be locked if we are not panicking. * We can expect this mutex to be locked if we are not panicking.
* Locking is currently fubar in the panic handler. * Locking is currently fubar in the panic handler.
...@@ -131,6 +133,8 @@ bool drm_helper_crtc_in_use(struct drm_crtc *crtc) ...@@ -131,6 +133,8 @@ bool drm_helper_crtc_in_use(struct drm_crtc *crtc)
struct drm_encoder *encoder; struct drm_encoder *encoder;
struct drm_device *dev = crtc->dev; struct drm_device *dev = crtc->dev;
WARN_ON(drm_drv_uses_atomic_modeset(dev));
/* /*
* We can expect this mutex to be locked if we are not panicking. * We can expect this mutex to be locked if we are not panicking.
* Locking is currently fubar in the panic handler. * Locking is currently fubar in the panic handler.
...@@ -212,8 +216,7 @@ static void __drm_helper_disable_unused_functions(struct drm_device *dev) ...@@ -212,8 +216,7 @@ static void __drm_helper_disable_unused_functions(struct drm_device *dev)
*/ */
void drm_helper_disable_unused_functions(struct drm_device *dev) void drm_helper_disable_unused_functions(struct drm_device *dev)
{ {
if (drm_core_check_feature(dev, DRIVER_ATOMIC)) WARN_ON(drm_drv_uses_atomic_modeset(dev));
DRM_ERROR("Called for atomic driver, this is not what you want.\n");
drm_modeset_lock_all(dev); drm_modeset_lock_all(dev);
__drm_helper_disable_unused_functions(dev); __drm_helper_disable_unused_functions(dev);
...@@ -281,6 +284,8 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, ...@@ -281,6 +284,8 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
struct drm_encoder *encoder; struct drm_encoder *encoder;
bool ret = true; bool ret = true;
WARN_ON(drm_drv_uses_atomic_modeset(dev));
drm_warn_on_modeset_not_all_locked(dev); drm_warn_on_modeset_not_all_locked(dev);
saved_enabled = crtc->enabled; saved_enabled = crtc->enabled;
...@@ -540,6 +545,9 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set, ...@@ -540,6 +545,9 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
crtc_funcs = set->crtc->helper_private; crtc_funcs = set->crtc->helper_private;
dev = set->crtc->dev;
WARN_ON(drm_drv_uses_atomic_modeset(dev));
if (!set->mode) if (!set->mode)
set->fb = NULL; set->fb = NULL;
...@@ -555,8 +563,6 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set, ...@@ -555,8 +563,6 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
return 0; return 0;
} }
dev = set->crtc->dev;
drm_warn_on_modeset_not_all_locked(dev); drm_warn_on_modeset_not_all_locked(dev);
/* /*
...@@ -875,6 +881,8 @@ int drm_helper_connector_dpms(struct drm_connector *connector, int mode) ...@@ -875,6 +881,8 @@ int drm_helper_connector_dpms(struct drm_connector *connector, int mode)
struct drm_crtc *crtc = encoder ? encoder->crtc : NULL; struct drm_crtc *crtc = encoder ? encoder->crtc : NULL;
int old_dpms, encoder_dpms = DRM_MODE_DPMS_OFF; int old_dpms, encoder_dpms = DRM_MODE_DPMS_OFF;
WARN_ON(drm_drv_uses_atomic_modeset(connector->dev));
if (mode == connector->dpms) if (mode == connector->dpms)
return 0; return 0;
...@@ -946,6 +954,8 @@ void drm_helper_resume_force_mode(struct drm_device *dev) ...@@ -946,6 +954,8 @@ void drm_helper_resume_force_mode(struct drm_device *dev)
int encoder_dpms; int encoder_dpms;
bool ret; bool ret;
WARN_ON(drm_drv_uses_atomic_modeset(dev));
drm_modeset_lock_all(dev); drm_modeset_lock_all(dev);
drm_for_each_crtc(crtc, dev) { drm_for_each_crtc(crtc, dev) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment