Skip to content

Commit

Permalink
drm/i915: Set crtc->new_config to NULL for pipes that are about to be…
Browse files Browse the repository at this point in the history
… disabled

crtc->new_config is only relevant for pipes that are going to be active
post-modeset. Set the pointer to NULL for all pipes that are going to
be disabled. This is done to help catch bugs where some piece of code
would go looking at crtc->new_config even if the data there is stale.

v2: Clear new_config in disable_crtc_nofb() too (Imre)

Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
  • Loading branch information
Ville Syrjälä authored and Daniel Vetter committed Jan 24, 2014
1 parent 7d00a1f commit 7bd0a8e
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions drivers/gpu/drm/i915/intel_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -8787,6 +8787,11 @@ static void intel_modeset_update_staged_output_state(struct drm_device *dev)
list_for_each_entry(crtc, &dev->mode_config.crtc_list,
base.head) {
crtc->new_enabled = crtc->base.enabled;

if (crtc->new_enabled)
crtc->new_config = &crtc->config;
else
crtc->new_config = NULL;
}
}

Expand Down Expand Up @@ -9219,7 +9224,9 @@ intel_modeset_update_state(struct drm_device *dev, unsigned prepare_pipes)
list_for_each_entry(intel_crtc, &dev->mode_config.crtc_list,
base.head) {
WARN_ON(intel_crtc->base.enabled != intel_crtc_in_use(&intel_crtc->base));
WARN_ON(intel_crtc->new_config != &intel_crtc->config);
WARN_ON(intel_crtc->new_config &&
intel_crtc->new_config != &intel_crtc->config);
WARN_ON(intel_crtc->base.enabled != !!intel_crtc->new_config);
}

list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
Expand Down Expand Up @@ -9818,6 +9825,11 @@ static void intel_set_config_restore_state(struct drm_device *dev,
count = 0;
list_for_each_entry(crtc, &dev->mode_config.crtc_list, base.head) {
crtc->new_enabled = config->save_crtc_enabled[count++];

if (crtc->new_enabled)
crtc->new_config = &crtc->config;
else
crtc->new_config = NULL;
}

count = 0;
Expand Down Expand Up @@ -10019,6 +10031,11 @@ intel_modeset_stage_output_state(struct drm_device *dev,
crtc->new_enabled ? "en" : "dis");
config->mode_changed = true;
}

if (crtc->new_enabled)
crtc->new_config = &crtc->config;
else
crtc->new_config = NULL;
}

return 0;
Expand All @@ -10045,6 +10062,7 @@ static void disable_crtc_nofb(struct intel_crtc *crtc)
}

crtc->new_enabled = false;
crtc->new_config = NULL;
}

static int intel_crtc_set_config(struct drm_mode_set *set)
Expand Down Expand Up @@ -10289,8 +10307,6 @@ static void intel_crtc_init(struct drm_device *dev, int pipe)
dev_priv->plane_to_crtc_mapping[intel_crtc->plane] = &intel_crtc->base;
dev_priv->pipe_to_crtc_mapping[intel_crtc->pipe] = &intel_crtc->base;

intel_crtc->new_config = &intel_crtc->config;

drm_crtc_helper_add(&intel_crtc->base, &intel_helper_funcs);
}

Expand Down

0 comments on commit 7bd0a8e

Please sign in to comment.