diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-01-24 10:11:08 -0500 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-01-25 14:23:28 -0500 |
commit | eb03355660b44cf6b1ed2f895085b9de8f74efbc (patch) | |
tree | 2665733d7a13db780caf16a7920b7fe871079cdd | |
parent | d121a5d2a098ba6dd033dd195f5ccbf7558c37b6 (diff) |
drm: Add an interface to reset the device
Iterate over the attached CRTCs, encoders and connectors and call the
supplied reset vfunc in order to reset any cached state back to unknown.
Useful after an invalidation event such as a GPU reset or resuming.
Tested-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | drivers/gpu/drm/drm_crtc.c | 20 | ||||
-rw-r--r-- | include/drm/drm_crtc.h | 7 |
2 files changed, 27 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 2baa6708e44c..654faa803dcb 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
@@ -2674,3 +2674,23 @@ out: | |||
2674 | mutex_unlock(&dev->mode_config.mutex); | 2674 | mutex_unlock(&dev->mode_config.mutex); |
2675 | return ret; | 2675 | return ret; |
2676 | } | 2676 | } |
2677 | |||
2678 | void drm_mode_config_reset(struct drm_device *dev) | ||
2679 | { | ||
2680 | struct drm_crtc *crtc; | ||
2681 | struct drm_encoder *encoder; | ||
2682 | struct drm_connector *connector; | ||
2683 | |||
2684 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) | ||
2685 | if (crtc->funcs->reset) | ||
2686 | crtc->funcs->reset(crtc); | ||
2687 | |||
2688 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) | ||
2689 | if (encoder->funcs->reset) | ||
2690 | encoder->funcs->reset(encoder); | ||
2691 | |||
2692 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) | ||
2693 | if (connector->funcs->reset) | ||
2694 | connector->funcs->reset(connector); | ||
2695 | } | ||
2696 | EXPORT_SYMBOL(drm_mode_config_reset); | ||
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index acd7fade160d..801be59f4f15 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
@@ -275,6 +275,7 @@ struct drm_pending_vblank_event; | |||
275 | 275 | ||
276 | /** | 276 | /** |
277 | * drm_crtc_funcs - control CRTCs for a given device | 277 | * drm_crtc_funcs - control CRTCs for a given device |
278 | * @reset: reset CRTC after state has been invalidate (e.g. resume) | ||
278 | * @dpms: control display power levels | 279 | * @dpms: control display power levels |
279 | * @save: save CRTC state | 280 | * @save: save CRTC state |
280 | * @resore: restore CRTC state | 281 | * @resore: restore CRTC state |
@@ -302,6 +303,8 @@ struct drm_crtc_funcs { | |||
302 | void (*save)(struct drm_crtc *crtc); /* suspend? */ | 303 | void (*save)(struct drm_crtc *crtc); /* suspend? */ |
303 | /* Restore CRTC state */ | 304 | /* Restore CRTC state */ |
304 | void (*restore)(struct drm_crtc *crtc); /* resume? */ | 305 | void (*restore)(struct drm_crtc *crtc); /* resume? */ |
306 | /* Reset CRTC state */ | ||
307 | void (*reset)(struct drm_crtc *crtc); | ||
305 | 308 | ||
306 | /* cursor controls */ | 309 | /* cursor controls */ |
307 | int (*cursor_set)(struct drm_crtc *crtc, struct drm_file *file_priv, | 310 | int (*cursor_set)(struct drm_crtc *crtc, struct drm_file *file_priv, |
@@ -379,6 +382,7 @@ struct drm_crtc { | |||
379 | * @dpms: set power state (see drm_crtc_funcs above) | 382 | * @dpms: set power state (see drm_crtc_funcs above) |
380 | * @save: save connector state | 383 | * @save: save connector state |
381 | * @restore: restore connector state | 384 | * @restore: restore connector state |
385 | * @reset: reset connector after state has been invalidate (e.g. resume) | ||
382 | * @mode_valid: is this mode valid on the given connector? | 386 | * @mode_valid: is this mode valid on the given connector? |
383 | * @mode_fixup: try to fixup proposed mode for this connector | 387 | * @mode_fixup: try to fixup proposed mode for this connector |
384 | * @mode_set: set this mode | 388 | * @mode_set: set this mode |
@@ -396,6 +400,7 @@ struct drm_connector_funcs { | |||
396 | void (*dpms)(struct drm_connector *connector, int mode); | 400 | void (*dpms)(struct drm_connector *connector, int mode); |
397 | void (*save)(struct drm_connector *connector); | 401 | void (*save)(struct drm_connector *connector); |
398 | void (*restore)(struct drm_connector *connector); | 402 | void (*restore)(struct drm_connector *connector); |
403 | void (*reset)(struct drm_connector *connector); | ||
399 | 404 | ||
400 | /* Check to see if anything is attached to the connector. | 405 | /* Check to see if anything is attached to the connector. |
401 | * @force is set to false whilst polling, true when checking the | 406 | * @force is set to false whilst polling, true when checking the |
@@ -413,6 +418,7 @@ struct drm_connector_funcs { | |||
413 | }; | 418 | }; |
414 | 419 | ||
415 | struct drm_encoder_funcs { | 420 | struct drm_encoder_funcs { |
421 | void (*reset)(struct drm_encoder *encoder); | ||
416 | void (*destroy)(struct drm_encoder *encoder); | 422 | void (*destroy)(struct drm_encoder *encoder); |
417 | }; | 423 | }; |
418 | 424 | ||
@@ -656,6 +662,7 @@ extern struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev, | |||
656 | struct drm_display_mode *mode); | 662 | struct drm_display_mode *mode); |
657 | extern void drm_mode_debug_printmodeline(struct drm_display_mode *mode); | 663 | extern void drm_mode_debug_printmodeline(struct drm_display_mode *mode); |
658 | extern void drm_mode_config_init(struct drm_device *dev); | 664 | extern void drm_mode_config_init(struct drm_device *dev); |
665 | extern void drm_mode_config_reset(struct drm_device *dev); | ||
659 | extern void drm_mode_config_cleanup(struct drm_device *dev); | 666 | extern void drm_mode_config_cleanup(struct drm_device *dev); |
660 | extern void drm_mode_set_name(struct drm_display_mode *mode); | 667 | extern void drm_mode_set_name(struct drm_display_mode *mode); |
661 | extern bool drm_mode_equal(struct drm_display_mode *mode1, struct drm_display_mode *mode2); | 668 | extern bool drm_mode_equal(struct drm_display_mode *mode1, struct drm_display_mode *mode2); |