Commit 8c10342c authored by Maarten Lankhorst's avatar Maarten Lankhorst Committed by Daniel Vetter

drm/atomic: Update legacy DPMS state during modesets, v3.

This is required for DPMS to work correctly, during a modeset
the DPMS property should be turned off, unless the state is
crtc is made active in which case it should be set to DPMS on.

Changes since v1:
- Set DPMS to off when a connector is removed from a crtc too.
- Update the legacy dpms property too.
- Add an exception for the legacy dpms paths, it updates its own state.
Changes since v2:
- Do not preserve dpms property.

Cc: dri-devel@lists.freedesktop.org
Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 9a69a9ac
...@@ -660,17 +660,31 @@ drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev, ...@@ -660,17 +660,31 @@ drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev,
struct drm_crtc_state *old_crtc_state; struct drm_crtc_state *old_crtc_state;
int i; int i;
/* clear out existing links */ /* clear out existing links and update dpms */
for_each_connector_in_state(old_state, connector, old_conn_state, i) { for_each_connector_in_state(old_state, connector, old_conn_state, i) {
if (!connector->encoder) if (connector->encoder) {
continue;
WARN_ON(!connector->encoder->crtc); WARN_ON(!connector->encoder->crtc);
connector->encoder->crtc = NULL; connector->encoder->crtc = NULL;
connector->encoder = NULL; connector->encoder = NULL;
} }
crtc = connector->state->crtc;
if ((!crtc && old_conn_state->crtc) ||
(crtc && drm_atomic_crtc_needs_modeset(crtc->state))) {
struct drm_property *dpms_prop =
dev->mode_config.dpms_property;
int mode = DRM_MODE_DPMS_OFF;
if (crtc && crtc->state->active)
mode = DRM_MODE_DPMS_ON;
connector->dpms = mode;
drm_object_property_set_value(&connector->base,
dpms_prop, mode);
}
}
/* set new links */ /* set new links */
for_each_connector_in_state(old_state, connector, old_conn_state, i) { for_each_connector_in_state(old_state, connector, old_conn_state, i) {
if (!connector->state->crtc) if (!connector->state->crtc)
......
...@@ -12349,16 +12349,9 @@ intel_modeset_update_state(struct drm_atomic_state *state) ...@@ -12349,16 +12349,9 @@ intel_modeset_update_state(struct drm_atomic_state *state)
continue; continue;
if (crtc->state->active) { if (crtc->state->active) {
struct drm_property *dpms_property =
dev->mode_config.dpms_property;
connector->dpms = DRM_MODE_DPMS_ON;
drm_object_property_set_value(&connector->base, dpms_property, DRM_MODE_DPMS_ON);
intel_encoder = to_intel_encoder(connector->encoder); intel_encoder = to_intel_encoder(connector->encoder);
intel_encoder->connectors_active = true; intel_encoder->connectors_active = true;
} else }
connector->dpms = DRM_MODE_DPMS_OFF;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment