Commit 944b0c76 authored by Ander Conselvan de Oliveira's avatar Ander Conselvan de Oliveira Committed by Daniel Vetter

drm/i915: Copy the staged connector config to the legacy atomic state

With this in place, we can start converting pieces of the modeset code
to look at the connector atomic state instead of the staged config.

v2: Handle the load detect staged config changes too. (Ander)
    Remove unnecessary blank line. (Daniel)
Signed-off-by: default avatarAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent d29b2f9d
...@@ -8909,6 +8909,7 @@ bool intel_get_load_detect_pipe(struct drm_connector *connector, ...@@ -8909,6 +8909,7 @@ bool intel_get_load_detect_pipe(struct drm_connector *connector,
struct drm_framebuffer *fb; struct drm_framebuffer *fb;
struct drm_mode_config *config = &dev->mode_config; struct drm_mode_config *config = &dev->mode_config;
struct drm_atomic_state *state = NULL; struct drm_atomic_state *state = NULL;
struct drm_connector_state *connector_state;
int ret, i = -1; int ret, i = -1;
DRM_DEBUG_KMS("[CONNECTOR:%d:%s], [ENCODER:%d:%s]\n", DRM_DEBUG_KMS("[CONNECTOR:%d:%s], [ENCODER:%d:%s]\n",
...@@ -8996,6 +8997,15 @@ bool intel_get_load_detect_pipe(struct drm_connector *connector, ...@@ -8996,6 +8997,15 @@ bool intel_get_load_detect_pipe(struct drm_connector *connector,
state->acquire_ctx = ctx; state->acquire_ctx = ctx;
connector_state = drm_atomic_get_connector_state(state, connector);
if (IS_ERR(connector_state)) {
ret = PTR_ERR(connector_state);
goto fail;
}
connector_state->crtc = crtc;
connector_state->best_encoder = &intel_encoder->base;
if (!mode) if (!mode)
mode = &load_detect_mode; mode = &load_detect_mode;
...@@ -9061,6 +9071,7 @@ void intel_release_load_detect_pipe(struct drm_connector *connector, ...@@ -9061,6 +9071,7 @@ void intel_release_load_detect_pipe(struct drm_connector *connector,
struct drm_crtc *crtc = encoder->crtc; struct drm_crtc *crtc = encoder->crtc;
struct intel_crtc *intel_crtc = to_intel_crtc(crtc); struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
struct drm_atomic_state *state; struct drm_atomic_state *state;
struct drm_connector_state *connector_state;
DRM_DEBUG_KMS("[CONNECTOR:%d:%s], [ENCODER:%d:%s]\n", DRM_DEBUG_KMS("[CONNECTOR:%d:%s], [ENCODER:%d:%s]\n",
connector->base.id, connector->name, connector->base.id, connector->name,
...@@ -9068,17 +9079,23 @@ void intel_release_load_detect_pipe(struct drm_connector *connector, ...@@ -9068,17 +9079,23 @@ void intel_release_load_detect_pipe(struct drm_connector *connector,
if (old->load_detect_temp) { if (old->load_detect_temp) {
state = drm_atomic_state_alloc(dev); state = drm_atomic_state_alloc(dev);
if (!state) { if (!state)
DRM_DEBUG_KMS("can't release load detect pipe\n"); goto fail;
return;
}
state->acquire_ctx = ctx; state->acquire_ctx = ctx;
connector_state = drm_atomic_get_connector_state(state, connector);
if (IS_ERR(connector_state))
goto fail;
to_intel_connector(connector)->new_encoder = NULL; to_intel_connector(connector)->new_encoder = NULL;
intel_encoder->new_crtc = NULL; intel_encoder->new_crtc = NULL;
intel_crtc->new_enabled = false; intel_crtc->new_enabled = false;
intel_crtc->new_config = NULL; intel_crtc->new_config = NULL;
connector_state->best_encoder = NULL;
connector_state->crtc = NULL;
intel_set_mode(crtc, NULL, 0, 0, NULL, state); intel_set_mode(crtc, NULL, 0, 0, NULL, state);
drm_atomic_state_free(state); drm_atomic_state_free(state);
...@@ -9094,6 +9111,11 @@ void intel_release_load_detect_pipe(struct drm_connector *connector, ...@@ -9094,6 +9111,11 @@ void intel_release_load_detect_pipe(struct drm_connector *connector,
/* Switch crtc and encoder back off if necessary */ /* Switch crtc and encoder back off if necessary */
if (old->dpms_mode != DRM_MODE_DPMS_ON) if (old->dpms_mode != DRM_MODE_DPMS_ON)
connector->funcs->dpms(connector, old->dpms_mode); connector->funcs->dpms(connector, old->dpms_mode);
return;
fail:
DRM_DEBUG_KMS("Couldn't release load detect pipe.\n");
drm_atomic_state_free(state);
} }
static int i9xx_pll_refclk(struct drm_device *dev, static int i9xx_pll_refclk(struct drm_device *dev,
...@@ -11777,9 +11799,11 @@ intel_set_config_compute_mode_changes(struct drm_mode_set *set, ...@@ -11777,9 +11799,11 @@ intel_set_config_compute_mode_changes(struct drm_mode_set *set,
static int static int
intel_modeset_stage_output_state(struct drm_device *dev, intel_modeset_stage_output_state(struct drm_device *dev,
struct drm_mode_set *set, struct drm_mode_set *set,
struct intel_set_config *config) struct intel_set_config *config,
struct drm_atomic_state *state)
{ {
struct intel_connector *connector; struct intel_connector *connector;
struct drm_connector_state *connector_state;
struct intel_encoder *encoder; struct intel_encoder *encoder;
struct intel_crtc *crtc; struct intel_crtc *crtc;
int ro; int ro;
...@@ -11843,6 +11867,14 @@ intel_modeset_stage_output_state(struct drm_device *dev, ...@@ -11843,6 +11867,14 @@ intel_modeset_stage_output_state(struct drm_device *dev,
} }
connector->new_encoder->new_crtc = to_intel_crtc(new_crtc); connector->new_encoder->new_crtc = to_intel_crtc(new_crtc);
connector_state =
drm_atomic_get_connector_state(state, &connector->base);
if (IS_ERR(connector_state))
return PTR_ERR(connector_state);
connector_state->crtc = new_crtc;
connector_state->best_encoder = &connector->new_encoder->base;
DRM_DEBUG_KMS("[CONNECTOR:%d:%s] to [CRTC:%d]\n", DRM_DEBUG_KMS("[CONNECTOR:%d:%s] to [CRTC:%d]\n",
connector->base.base.id, connector->base.base.id,
connector->base.name, connector->base.name,
...@@ -11875,9 +11907,15 @@ intel_modeset_stage_output_state(struct drm_device *dev, ...@@ -11875,9 +11907,15 @@ intel_modeset_stage_output_state(struct drm_device *dev,
} }
/* Now we've also updated encoder->new_crtc for all encoders. */ /* Now we've also updated encoder->new_crtc for all encoders. */
for_each_intel_connector(dev, connector) { for_each_intel_connector(dev, connector) {
if (connector->new_encoder) connector_state =
drm_atomic_get_connector_state(state, &connector->base);
if (connector->new_encoder) {
if (connector->new_encoder != connector->encoder) if (connector->new_encoder != connector->encoder)
connector->encoder = connector->new_encoder; connector->encoder = connector->new_encoder;
} else {
connector_state->crtc = NULL;
}
} }
for_each_intel_crtc(dev, crtc) { for_each_intel_crtc(dev, crtc) {
crtc->new_enabled = false; crtc->new_enabled = false;
...@@ -11986,7 +12024,7 @@ static int intel_crtc_set_config(struct drm_mode_set *set) ...@@ -11986,7 +12024,7 @@ static int intel_crtc_set_config(struct drm_mode_set *set)
state->acquire_ctx = dev->mode_config.acquire_ctx; state->acquire_ctx = dev->mode_config.acquire_ctx;
ret = intel_modeset_stage_output_state(dev, set, config); ret = intel_modeset_stage_output_state(dev, set, config, state);
if (ret) if (ret)
goto fail; goto fail;
......
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