forked from luck/tmp_suning_uos_patched
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>
This commit is contained in:
parent
d121a5d2a0
commit
eb03355660
@ -2674,3 +2674,23 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
|
|||||||
mutex_unlock(&dev->mode_config.mutex);
|
mutex_unlock(&dev->mode_config.mutex);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void drm_mode_config_reset(struct drm_device *dev)
|
||||||
|
{
|
||||||
|
struct drm_crtc *crtc;
|
||||||
|
struct drm_encoder *encoder;
|
||||||
|
struct drm_connector *connector;
|
||||||
|
|
||||||
|
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
|
||||||
|
if (crtc->funcs->reset)
|
||||||
|
crtc->funcs->reset(crtc);
|
||||||
|
|
||||||
|
list_for_each_entry(encoder, &dev->mode_config.encoder_list, head)
|
||||||
|
if (encoder->funcs->reset)
|
||||||
|
encoder->funcs->reset(encoder);
|
||||||
|
|
||||||
|
list_for_each_entry(connector, &dev->mode_config.connector_list, head)
|
||||||
|
if (connector->funcs->reset)
|
||||||
|
connector->funcs->reset(connector);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(drm_mode_config_reset);
|
||||||
|
@ -275,6 +275,7 @@ struct drm_pending_vblank_event;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* drm_crtc_funcs - control CRTCs for a given device
|
* drm_crtc_funcs - control CRTCs for a given device
|
||||||
|
* @reset: reset CRTC after state has been invalidate (e.g. resume)
|
||||||
* @dpms: control display power levels
|
* @dpms: control display power levels
|
||||||
* @save: save CRTC state
|
* @save: save CRTC state
|
||||||
* @resore: restore CRTC state
|
* @resore: restore CRTC state
|
||||||
@ -302,6 +303,8 @@ struct drm_crtc_funcs {
|
|||||||
void (*save)(struct drm_crtc *crtc); /* suspend? */
|
void (*save)(struct drm_crtc *crtc); /* suspend? */
|
||||||
/* Restore CRTC state */
|
/* Restore CRTC state */
|
||||||
void (*restore)(struct drm_crtc *crtc); /* resume? */
|
void (*restore)(struct drm_crtc *crtc); /* resume? */
|
||||||
|
/* Reset CRTC state */
|
||||||
|
void (*reset)(struct drm_crtc *crtc);
|
||||||
|
|
||||||
/* cursor controls */
|
/* cursor controls */
|
||||||
int (*cursor_set)(struct drm_crtc *crtc, struct drm_file *file_priv,
|
int (*cursor_set)(struct drm_crtc *crtc, struct drm_file *file_priv,
|
||||||
@ -379,6 +382,7 @@ struct drm_crtc {
|
|||||||
* @dpms: set power state (see drm_crtc_funcs above)
|
* @dpms: set power state (see drm_crtc_funcs above)
|
||||||
* @save: save connector state
|
* @save: save connector state
|
||||||
* @restore: restore connector state
|
* @restore: restore connector state
|
||||||
|
* @reset: reset connector after state has been invalidate (e.g. resume)
|
||||||
* @mode_valid: is this mode valid on the given connector?
|
* @mode_valid: is this mode valid on the given connector?
|
||||||
* @mode_fixup: try to fixup proposed mode for this connector
|
* @mode_fixup: try to fixup proposed mode for this connector
|
||||||
* @mode_set: set this mode
|
* @mode_set: set this mode
|
||||||
@ -396,6 +400,7 @@ struct drm_connector_funcs {
|
|||||||
void (*dpms)(struct drm_connector *connector, int mode);
|
void (*dpms)(struct drm_connector *connector, int mode);
|
||||||
void (*save)(struct drm_connector *connector);
|
void (*save)(struct drm_connector *connector);
|
||||||
void (*restore)(struct drm_connector *connector);
|
void (*restore)(struct drm_connector *connector);
|
||||||
|
void (*reset)(struct drm_connector *connector);
|
||||||
|
|
||||||
/* Check to see if anything is attached to the connector.
|
/* Check to see if anything is attached to the connector.
|
||||||
* @force is set to false whilst polling, true when checking the
|
* @force is set to false whilst polling, true when checking the
|
||||||
@ -413,6 +418,7 @@ struct drm_connector_funcs {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct drm_encoder_funcs {
|
struct drm_encoder_funcs {
|
||||||
|
void (*reset)(struct drm_encoder *encoder);
|
||||||
void (*destroy)(struct drm_encoder *encoder);
|
void (*destroy)(struct drm_encoder *encoder);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -656,6 +662,7 @@ extern struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev,
|
|||||||
struct drm_display_mode *mode);
|
struct drm_display_mode *mode);
|
||||||
extern void drm_mode_debug_printmodeline(struct drm_display_mode *mode);
|
extern void drm_mode_debug_printmodeline(struct drm_display_mode *mode);
|
||||||
extern void drm_mode_config_init(struct drm_device *dev);
|
extern void drm_mode_config_init(struct drm_device *dev);
|
||||||
|
extern void drm_mode_config_reset(struct drm_device *dev);
|
||||||
extern void drm_mode_config_cleanup(struct drm_device *dev);
|
extern void drm_mode_config_cleanup(struct drm_device *dev);
|
||||||
extern void drm_mode_set_name(struct drm_display_mode *mode);
|
extern void drm_mode_set_name(struct drm_display_mode *mode);
|
||||||
extern bool drm_mode_equal(struct drm_display_mode *mode1, struct drm_display_mode *mode2);
|
extern bool drm_mode_equal(struct drm_display_mode *mode1, struct drm_display_mode *mode2);
|
||||||
|
Loading…
Reference in New Issue
Block a user