aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/drm_crtc_helper.c31
1 files changed, 12 insertions, 19 deletions
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index ae2fd5cd8dfa..44d50f56afa3 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -105,9 +105,6 @@ static void drm_mode_validate_flag(struct drm_connector *connector,
105 * @maxX: max width for modes 105 * @maxX: max width for modes
106 * @maxY: max height for modes 106 * @maxY: max height for modes
107 * 107 *
108 * LOCKING:
109 * Caller must hold mode config lock.
110 *
111 * Based on the helper callbacks implemented by @connector try to detect all 108 * Based on the helper callbacks implemented by @connector try to detect all
112 * valid modes. Modes will first be added to the connector's probed_modes list, 109 * valid modes. Modes will first be added to the connector's probed_modes list,
113 * then culled (based on validity and the @maxX, @maxY parameters) and put into 110 * then culled (based on validity and the @maxX, @maxY parameters) and put into
@@ -131,6 +128,8 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
131 int mode_flags = 0; 128 int mode_flags = 0;
132 bool verbose_prune = true; 129 bool verbose_prune = true;
133 130
131 WARN_ON(!mutex_is_locked(&dev->mode_config.mutex));
132
134 DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id, 133 DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id,
135 drm_get_connector_name(connector)); 134 drm_get_connector_name(connector));
136 /* set all modes to the unverified state */ 135 /* set all modes to the unverified state */
@@ -218,9 +217,6 @@ EXPORT_SYMBOL(drm_helper_probe_single_connector_modes);
218 * drm_helper_encoder_in_use - check if a given encoder is in use 217 * drm_helper_encoder_in_use - check if a given encoder is in use
219 * @encoder: encoder to check 218 * @encoder: encoder to check
220 * 219 *
221 * LOCKING:
222 * Caller must hold mode config lock.
223 *
224 * Walk @encoders's DRM device's mode_config and see if it's in use. 220 * Walk @encoders's DRM device's mode_config and see if it's in use.
225 * 221 *
226 * RETURNS: 222 * RETURNS:
@@ -230,6 +226,8 @@ bool drm_helper_encoder_in_use(struct drm_encoder *encoder)
230{ 226{
231 struct drm_connector *connector; 227 struct drm_connector *connector;
232 struct drm_device *dev = encoder->dev; 228 struct drm_device *dev = encoder->dev;
229
230 WARN_ON(!mutex_is_locked(&dev->mode_config.mutex));
233 list_for_each_entry(connector, &dev->mode_config.connector_list, head) 231 list_for_each_entry(connector, &dev->mode_config.connector_list, head)
234 if (connector->encoder == encoder) 232 if (connector->encoder == encoder)
235 return true; 233 return true;
@@ -241,9 +239,6 @@ EXPORT_SYMBOL(drm_helper_encoder_in_use);
241 * drm_helper_crtc_in_use - check if a given CRTC is in a mode_config 239 * drm_helper_crtc_in_use - check if a given CRTC is in a mode_config
242 * @crtc: CRTC to check 240 * @crtc: CRTC to check
243 * 241 *
244 * LOCKING:
245 * Caller must hold mode config lock.
246 *
247 * Walk @crtc's DRM device's mode_config and see if it's in use. 242 * Walk @crtc's DRM device's mode_config and see if it's in use.
248 * 243 *
249 * RETURNS: 244 * RETURNS:
@@ -253,7 +248,8 @@ bool drm_helper_crtc_in_use(struct drm_crtc *crtc)
253{ 248{
254 struct drm_encoder *encoder; 249 struct drm_encoder *encoder;
255 struct drm_device *dev = crtc->dev; 250 struct drm_device *dev = crtc->dev;
256 /* FIXME: Locking around list access? */ 251
252 WARN_ON(!mutex_is_locked(&dev->mode_config.mutex));
257 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) 253 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head)
258 if (encoder->crtc == crtc && drm_helper_encoder_in_use(encoder)) 254 if (encoder->crtc == crtc && drm_helper_encoder_in_use(encoder))
259 return true; 255 return true;
@@ -282,9 +278,6 @@ drm_encoder_disable(struct drm_encoder *encoder)
282 * drm_helper_disable_unused_functions - disable unused objects 278 * drm_helper_disable_unused_functions - disable unused objects
283 * @dev: DRM device 279 * @dev: DRM device
284 * 280 *
285 * LOCKING:
286 * Caller must hold mode config lock.
287 *
288 * If an connector or CRTC isn't part of @dev's mode_config, it can be disabled 281 * If an connector or CRTC isn't part of @dev's mode_config, it can be disabled
289 * by calling its dpms function, which should power it off. 282 * by calling its dpms function, which should power it off.
290 */ 283 */
@@ -294,6 +287,8 @@ void drm_helper_disable_unused_functions(struct drm_device *dev)
294 struct drm_connector *connector; 287 struct drm_connector *connector;
295 struct drm_crtc *crtc; 288 struct drm_crtc *crtc;
296 289
290 drm_warn_on_modeset_not_all_locked(dev);
291
297 list_for_each_entry(connector, &dev->mode_config.connector_list, head) { 292 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
298 if (!connector->encoder) 293 if (!connector->encoder)
299 continue; 294 continue;
@@ -354,9 +349,6 @@ drm_crtc_prepare_encoders(struct drm_device *dev)
354 * @y: vertical offset into the surface 349 * @y: vertical offset into the surface
355 * @old_fb: old framebuffer, for cleanup 350 * @old_fb: old framebuffer, for cleanup
356 * 351 *
357 * LOCKING:
358 * Caller must hold mode config lock.
359 *
360 * Try to set @mode on @crtc. Give @crtc and its associated connectors a chance 352 * Try to set @mode on @crtc. Give @crtc and its associated connectors a chance
361 * to fixup or reject the mode prior to trying to set it. This is an internal 353 * to fixup or reject the mode prior to trying to set it. This is an internal
362 * helper that drivers could e.g. use to update properties that require the 354 * helper that drivers could e.g. use to update properties that require the
@@ -383,6 +375,8 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
383 struct drm_encoder *encoder; 375 struct drm_encoder *encoder;
384 bool ret = true; 376 bool ret = true;
385 377
378 drm_warn_on_modeset_not_all_locked(dev);
379
386 saved_enabled = crtc->enabled; 380 saved_enabled = crtc->enabled;
387 crtc->enabled = drm_helper_crtc_in_use(crtc); 381 crtc->enabled = drm_helper_crtc_in_use(crtc);
388 if (!crtc->enabled) 382 if (!crtc->enabled)
@@ -559,9 +553,6 @@ drm_crtc_helper_disable(struct drm_crtc *crtc)
559 * drm_crtc_helper_set_config - set a new config from userspace 553 * drm_crtc_helper_set_config - set a new config from userspace
560 * @set: mode set configuration 554 * @set: mode set configuration
561 * 555 *
562 * LOCKING:
563 * Caller must hold mode config lock.
564 *
565 * Setup a new configuration, provided by the upper layers (either an ioctl call 556 * Setup a new configuration, provided by the upper layers (either an ioctl call
566 * from userspace or internally e.g. from the fbdev suppport code) in @set, and 557 * from userspace or internally e.g. from the fbdev suppport code) in @set, and
567 * enable it. This is the main helper functions for drivers that implement 558 * enable it. This is the main helper functions for drivers that implement
@@ -611,6 +602,8 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
611 602
612 dev = set->crtc->dev; 603 dev = set->crtc->dev;
613 604
605 drm_warn_on_modeset_not_all_locked(dev);
606
614 /* 607 /*
615 * Allocate space for the backup of all (non-pointer) encoder and 608 * Allocate space for the backup of all (non-pointer) encoder and
616 * connector data. 609 * connector data.