diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2015-09-10 11:59:07 -0400 |
---|---|---|
committer | Jani Nikula <jani.nikula@intel.com> | 2015-10-14 06:41:57 -0400 |
commit | c4816c7389d8dbcad036be7e5a34584289d9f590 (patch) | |
tree | 0e3a28aa9658ab8c284d92c859b8113c35535196 | |
parent | 2e2edebefceef201624dcc323a1f7761e0040cf5 (diff) |
drm/i915: Assign hwmode after encoder state readout
The dotclock is often calculated in encoder .get_config(), so we
shouldn't copy the adjusted_mode to hwmode until we have read out the
dotclock.
Gets rid of some warnings like these:
[drm:drm_calc_timestamping_constants [drm]] *ERROR* crtc 21: Can't calculate constants, dotclock = 0!
[drm:i915_get_vblank_timestamp] crtc 0 is disabled
v2: Steal Maarten's idea to move crtc->mode etc. assignment too
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Patrik Jakobsson <patrik.jakobsson@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91428
Reviewed-by: Patrik Jakobsson <patrik.jakobsson@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
[Jani: cherry-picked from -next to v4.3]
Acked-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 7704315e067f..ed87a7e4c32a 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -15132,33 +15132,6 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) | |||
15132 | crtc->base.state->active = crtc->active; | 15132 | crtc->base.state->active = crtc->active; |
15133 | crtc->base.enabled = crtc->active; | 15133 | crtc->base.enabled = crtc->active; |
15134 | 15134 | ||
15135 | memset(&crtc->base.mode, 0, sizeof(crtc->base.mode)); | ||
15136 | if (crtc->base.state->active) { | ||
15137 | intel_mode_from_pipe_config(&crtc->base.mode, crtc->config); | ||
15138 | intel_mode_from_pipe_config(&crtc->base.state->adjusted_mode, crtc->config); | ||
15139 | WARN_ON(drm_atomic_set_mode_for_crtc(crtc->base.state, &crtc->base.mode)); | ||
15140 | |||
15141 | /* | ||
15142 | * The initial mode needs to be set in order to keep | ||
15143 | * the atomic core happy. It wants a valid mode if the | ||
15144 | * crtc's enabled, so we do the above call. | ||
15145 | * | ||
15146 | * At this point some state updated by the connectors | ||
15147 | * in their ->detect() callback has not run yet, so | ||
15148 | * no recalculation can be done yet. | ||
15149 | * | ||
15150 | * Even if we could do a recalculation and modeset | ||
15151 | * right now it would cause a double modeset if | ||
15152 | * fbdev or userspace chooses a different initial mode. | ||
15153 | * | ||
15154 | * If that happens, someone indicated they wanted a | ||
15155 | * mode change, which means it's safe to do a full | ||
15156 | * recalculation. | ||
15157 | */ | ||
15158 | crtc->base.state->mode.private_flags = I915_MODE_FLAG_INHERITED; | ||
15159 | } | ||
15160 | |||
15161 | crtc->base.hwmode = crtc->config->base.adjusted_mode; | ||
15162 | readout_plane_state(crtc, to_intel_crtc_state(crtc->base.state)); | 15135 | readout_plane_state(crtc, to_intel_crtc_state(crtc->base.state)); |
15163 | 15136 | ||
15164 | DRM_DEBUG_KMS("[CRTC:%d] hw state readout: %s\n", | 15137 | DRM_DEBUG_KMS("[CRTC:%d] hw state readout: %s\n", |
@@ -15218,6 +15191,36 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) | |||
15218 | connector->base.name, | 15191 | connector->base.name, |
15219 | connector->base.encoder ? "enabled" : "disabled"); | 15192 | connector->base.encoder ? "enabled" : "disabled"); |
15220 | } | 15193 | } |
15194 | |||
15195 | for_each_intel_crtc(dev, crtc) { | ||
15196 | crtc->base.hwmode = crtc->config->base.adjusted_mode; | ||
15197 | |||
15198 | memset(&crtc->base.mode, 0, sizeof(crtc->base.mode)); | ||
15199 | if (crtc->base.state->active) { | ||
15200 | intel_mode_from_pipe_config(&crtc->base.mode, crtc->config); | ||
15201 | intel_mode_from_pipe_config(&crtc->base.state->adjusted_mode, crtc->config); | ||
15202 | WARN_ON(drm_atomic_set_mode_for_crtc(crtc->base.state, &crtc->base.mode)); | ||
15203 | |||
15204 | /* | ||
15205 | * The initial mode needs to be set in order to keep | ||
15206 | * the atomic core happy. It wants a valid mode if the | ||
15207 | * crtc's enabled, so we do the above call. | ||
15208 | * | ||
15209 | * At this point some state updated by the connectors | ||
15210 | * in their ->detect() callback has not run yet, so | ||
15211 | * no recalculation can be done yet. | ||
15212 | * | ||
15213 | * Even if we could do a recalculation and modeset | ||
15214 | * right now it would cause a double modeset if | ||
15215 | * fbdev or userspace chooses a different initial mode. | ||
15216 | * | ||
15217 | * If that happens, someone indicated they wanted a | ||
15218 | * mode change, which means it's safe to do a full | ||
15219 | * recalculation. | ||
15220 | */ | ||
15221 | crtc->base.state->mode.private_flags = I915_MODE_FLAG_INHERITED; | ||
15222 | } | ||
15223 | } | ||
15221 | } | 15224 | } |
15222 | 15225 | ||
15223 | /* Scan out the current hw modeset state, | 15226 | /* Scan out the current hw modeset state, |