diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-07-02 07:10:34 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-09-06 01:57:51 -0400 |
commit | f0947c376f6944ade7079df9f84bbc958a893e0f (patch) | |
tree | c8f515c697a7f60db45165cd9794d534ac829433 /drivers/gpu/drm | |
parent | 08a48469691a1b9ed6ee92e726b66d4e59ffc253 (diff) |
drm/i915: Add interfaces to read out encoder/connector hw state
It is all glorious if we try really hard to only enable/disable an
entire display pipe to ensure that everyting happens in the right
order. But if we don't know the output configuration when the driver
takes over, this will all be for vain because we'll make the hw angry
right on the first modeset - we don't know what outputs/ports are
enabled and hence have to disable everything in a rather ad-hoc way.
Hence we need to be able to read out the current hw state, so that we
can properly tear down the current hw state on the first modeset.
Obviously this is also a nice preparation for the fastboot work, where
we try to avoid the modeset on driver load if it matches what the hw
is currently using.
Furthermore we'll be using these functions to cross-check the actual
hw state with what we think it should be, to ensure that the modeset
state machine actually works as advertised.
This patch only contains the interface definitions and a little helper
for the simple case where we have a 1:1 encoder to connector mapping.
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 11 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_drv.h | 8 |
2 files changed, 19 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 5ab86949014f..7e7569b68039 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -3584,6 +3584,17 @@ void intel_connector_dpms(struct drm_connector *connector, int mode) | |||
3584 | encoder->connectors_active = false; | 3584 | encoder->connectors_active = false; |
3585 | } | 3585 | } |
3586 | 3586 | ||
3587 | /* Simple connector->get_hw_state implementation for encoders that support only | ||
3588 | * one connector and no cloning and hence the encoder state determines the state | ||
3589 | * of the connector. */ | ||
3590 | bool intel_connector_get_hw_state(struct intel_connector *connector) | ||
3591 | { | ||
3592 | enum pipe pipe; | ||
3593 | struct intel_encoder *encoder = connector->encoder; | ||
3594 | |||
3595 | return encoder->get_hw_state(encoder, &pipe); | ||
3596 | } | ||
3597 | |||
3587 | static bool intel_crtc_mode_fixup(struct drm_crtc *crtc, | 3598 | static bool intel_crtc_mode_fixup(struct drm_crtc *crtc, |
3588 | const struct drm_display_mode *mode, | 3599 | const struct drm_display_mode *mode, |
3589 | struct drm_display_mode *adjusted_mode) | 3600 | struct drm_display_mode *adjusted_mode) |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 36991dee2d40..c39c70554891 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -144,12 +144,19 @@ struct intel_encoder { | |||
144 | void (*hot_plug)(struct intel_encoder *); | 144 | void (*hot_plug)(struct intel_encoder *); |
145 | void (*enable)(struct intel_encoder *); | 145 | void (*enable)(struct intel_encoder *); |
146 | void (*disable)(struct intel_encoder *); | 146 | void (*disable)(struct intel_encoder *); |
147 | /* Read out the current hw state of this connector, returning true if | ||
148 | * the encoder is active. If the encoder is enabled it also set the pipe | ||
149 | * it is connected to in the pipe parameter. */ | ||
150 | bool (*get_hw_state)(struct intel_encoder *, enum pipe *pipe); | ||
147 | int crtc_mask; | 151 | int crtc_mask; |
148 | }; | 152 | }; |
149 | 153 | ||
150 | struct intel_connector { | 154 | struct intel_connector { |
151 | struct drm_connector base; | 155 | struct drm_connector base; |
152 | struct intel_encoder *encoder; | 156 | struct intel_encoder *encoder; |
157 | /* Reads out the current hw, returning true if the connector is enabled | ||
158 | * and active (i.e. dpms ON state). */ | ||
159 | bool (*get_hw_state)(struct intel_connector *); | ||
153 | }; | 160 | }; |
154 | 161 | ||
155 | struct intel_crtc { | 162 | struct intel_crtc { |
@@ -426,6 +433,7 @@ extern void intel_encoder_disable(struct drm_encoder *encoder); | |||
426 | extern void intel_encoder_destroy(struct drm_encoder *encoder); | 433 | extern void intel_encoder_destroy(struct drm_encoder *encoder); |
427 | extern void intel_encoder_dpms(struct intel_encoder *encoder, int mode); | 434 | extern void intel_encoder_dpms(struct intel_encoder *encoder, int mode); |
428 | extern void intel_connector_dpms(struct drm_connector *, int mode); | 435 | extern void intel_connector_dpms(struct drm_connector *, int mode); |
436 | extern bool intel_connector_get_hw_state(struct intel_connector *connector); | ||
429 | 437 | ||
430 | static inline struct intel_encoder *intel_attached_encoder(struct drm_connector *connector) | 438 | static inline struct intel_encoder *intel_attached_encoder(struct drm_connector *connector) |
431 | { | 439 | { |