[Intel-gfx] [PATCH 4/4] drm/i915: Simplify pll state commit by swapping new and old state
Ander Conselvan de Oliveira
ander.conselvan.de.oliveira at intel.com
Thu Jan 29 06:55:11 PST 2015
This deletes some code and is closer to what the logic will look like
with atomic mode setting.
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira at intel.com>
---
drivers/gpu/drm/i915/intel_display.c | 58 ++++++++----------------------------
1 file changed, 12 insertions(+), 46 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index fecffbb..96176c1 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3963,46 +3963,11 @@ found:
return pll;
}
-/**
- * intel_shared_dpll_start_config - start a new PLL staged config
- * @dev_priv: DRM device
- * @clear_pipes: mask of pipes that will have their PLLs freed
- *
- * Starts a new PLL staged config, copying the current config but
- * releasing the references of pipes specified in clear_pipes.
- */
-static int intel_shared_dpll_start_config(struct drm_i915_private *dev_priv,
- struct intel_atomic_state *state,
- unsigned clear_pipes)
-{
- struct intel_shared_dpll_config *pll_config;
- enum intel_dpll_id i;
-
- /* FIXME: convert this to a simple memdup */
-
- for (i = 0; i < dev_priv->num_shared_dpll; i++) {
- pll_config = &dev_priv->display_state->shared_dpll[i];
-
- memcpy(&state->shared_dpll[i], pll_config,
- sizeof *pll_config);
- state->shared_dpll[i].crtc_mask &= ~clear_pipes;
- }
-
- return 0;
-}
-
-static void intel_shared_dpll_commit(struct drm_i915_private *dev_priv,
- struct intel_atomic_state *state)
+static struct intel_atomic_state *
+intel_atomic_state_duplicate(struct drm_i915_private *dev_priv)
{
- struct intel_shared_dpll_config *pll_config;
- enum intel_dpll_id i;
-
- /* FIXME: convert this to a poiner swap */
-
- for (i = 0; i < dev_priv->num_shared_dpll; i++) {
- pll_config = &dev_priv->display_state->shared_dpll[i];
- *pll_config = state->shared_dpll[i];
- }
+ return kmemdup(dev_priv->display_state,
+ sizeof *dev_priv->display_state, GFP_KERNEL);
}
static void cpt_verify_modeset(struct drm_device *dev, int pipe)
@@ -10405,14 +10370,15 @@ static bool intel_crtc_in_use(struct drm_crtc *crtc)
static void
intel_modeset_update_state(struct drm_device *dev, unsigned prepare_pipes,
- struct intel_atomic_state *state)
+ struct intel_atomic_state **state)
{
struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_encoder *intel_encoder;
struct intel_crtc *intel_crtc;
struct drm_connector *connector;
- intel_shared_dpll_commit(dev_priv, state);
+ /* Commit PLL and other global state */
+ swap(dev_priv->display_state, *state);
for_each_intel_encoder(dev, intel_encoder) {
if (!intel_encoder->base.crtc)
@@ -11020,13 +10986,13 @@ static int __intel_set_mode_setup_plls(struct drm_device *dev,
unsigned clear_pipes = modeset_pipes | disable_pipes;
struct intel_crtc *intel_crtc;
int ret = 0;
+ int i;
if (!dev_priv->display.crtc_compute_clock)
return 0;
- ret = intel_shared_dpll_start_config(dev_priv, state, clear_pipes);
- if (ret)
- return ret;
+ for (i = 0; i < dev_priv->num_shared_dpll; i++)
+ state->shared_dpll[i].crtc_mask &= ~clear_pipes;
for_each_intel_crtc_masked(dev, modeset_pipes, intel_crtc) {
struct intel_crtc_state *crtc_state = intel_crtc->new_config;
@@ -11077,7 +11043,7 @@ static int __intel_set_mode(struct drm_crtc *crtc,
prepare_pipes &= ~disable_pipes;
}
- state = kzalloc(sizeof *state, GFP_KERNEL);
+ state = intel_atomic_state_duplicate(dev_priv);
if (!state) {
ret = -ENOMEM;
goto done;
@@ -11120,7 +11086,7 @@ static int __intel_set_mode(struct drm_crtc *crtc,
/* Only after disabling all output pipelines that will be changed can we
* update the the output configuration. */
- intel_modeset_update_state(dev, prepare_pipes, state);
+ intel_modeset_update_state(dev, prepare_pipes, &state);
modeset_update_crtc_power_domains(dev);
--
2.1.0
More information about the Intel-gfx
mailing list