Commit 7275f630 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Adjust .crtc_compute_clock() calling convention

Pass the full atomic state+crtc rather than the redundant
crtc+crtc_state pair. We already need the full atomic state
in the hsw+ codepath anyway.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220325123205.22140-5-ville.syrjala@linux.intel.comReviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
parent e87ba18b
...@@ -4906,7 +4906,7 @@ static int intel_crtc_atomic_check(struct intel_atomic_state *state, ...@@ -4906,7 +4906,7 @@ static int intel_crtc_atomic_check(struct intel_atomic_state *state,
if (mode_changed && crtc_state->hw.enable && if (mode_changed && crtc_state->hw.enable &&
!drm_WARN_ON(&dev_priv->drm, crtc_state->shared_dpll)) { !drm_WARN_ON(&dev_priv->drm, crtc_state->shared_dpll)) {
ret = intel_dpll_crtc_compute_clock(crtc_state); ret = intel_dpll_crtc_compute_clock(state, crtc);
if (ret) if (ret)
return ret; return ret;
} }
......
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
#include "vlv_sideband.h" #include "vlv_sideband.h"
struct intel_dpll_funcs { struct intel_dpll_funcs {
int (*crtc_compute_clock)(struct intel_crtc_state *crtc_state); int (*crtc_compute_clock)(struct intel_atomic_state *state,
struct intel_crtc *crtc);
}; };
struct intel_limit { struct intel_limit {
...@@ -759,8 +760,8 @@ chv_find_best_dpll(const struct intel_limit *limit, ...@@ -759,8 +760,8 @@ chv_find_best_dpll(const struct intel_limit *limit,
bool bxt_find_best_dpll(struct intel_crtc_state *crtc_state, bool bxt_find_best_dpll(struct intel_crtc_state *crtc_state,
struct dpll *best_clock) struct dpll *best_clock)
{ {
int refclk = 100000;
const struct intel_limit *limit = &intel_limits_bxt; const struct intel_limit *limit = &intel_limits_bxt;
int refclk = 100000;
return chv_find_best_dpll(limit, crtc_state, return chv_find_best_dpll(limit, crtc_state,
crtc_state->port_clock, refclk, crtc_state->port_clock, refclk,
...@@ -927,12 +928,12 @@ static void i8xx_compute_dpll(struct intel_crtc_state *crtc_state, ...@@ -927,12 +928,12 @@ static void i8xx_compute_dpll(struct intel_crtc_state *crtc_state,
crtc_state->dpll_hw_state.dpll = dpll; crtc_state->dpll_hw_state.dpll = dpll;
} }
static int hsw_crtc_compute_clock(struct intel_crtc_state *crtc_state) static int hsw_crtc_compute_clock(struct intel_atomic_state *state,
struct intel_crtc *crtc)
{ {
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); struct drm_i915_private *dev_priv = to_i915(state->base.dev);
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); struct intel_crtc_state *crtc_state =
struct intel_atomic_state *state = intel_atomic_get_new_crtc_state(state, crtc);
to_intel_atomic_state(crtc_state->uapi.state);
struct intel_encoder *encoder = struct intel_encoder *encoder =
intel_get_crtc_new_encoder(state, crtc_state); intel_get_crtc_new_encoder(state, crtc_state);
int ret; int ret;
...@@ -1070,12 +1071,12 @@ static void ilk_compute_dpll(struct intel_crtc_state *crtc_state, ...@@ -1070,12 +1071,12 @@ static void ilk_compute_dpll(struct intel_crtc_state *crtc_state,
crtc_state->dpll_hw_state.dpll = dpll; crtc_state->dpll_hw_state.dpll = dpll;
} }
static int ilk_crtc_compute_clock(struct intel_crtc_state *crtc_state) static int ilk_crtc_compute_clock(struct intel_atomic_state *state,
struct intel_crtc *crtc)
{ {
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); struct drm_i915_private *dev_priv = to_i915(state->base.dev);
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); struct intel_crtc_state *crtc_state =
struct intel_atomic_state *state = intel_atomic_get_new_crtc_state(state, crtc);
to_intel_atomic_state(crtc_state->uapi.state);
const struct intel_limit *limit; const struct intel_limit *limit;
int refclk = 120000; int refclk = 120000;
int ret; int ret;
...@@ -1167,11 +1168,14 @@ void chv_compute_dpll(struct intel_crtc_state *crtc_state) ...@@ -1167,11 +1168,14 @@ void chv_compute_dpll(struct intel_crtc_state *crtc_state)
(crtc_state->pixel_multiplier - 1) << DPLL_MD_UDI_MULTIPLIER_SHIFT; (crtc_state->pixel_multiplier - 1) << DPLL_MD_UDI_MULTIPLIER_SHIFT;
} }
static int chv_crtc_compute_clock(struct intel_crtc_state *crtc_state) static int chv_crtc_compute_clock(struct intel_atomic_state *state,
struct intel_crtc *crtc)
{ {
int refclk = 100000; struct drm_i915_private *i915 = to_i915(state->base.dev);
struct intel_crtc_state *crtc_state =
intel_atomic_get_new_crtc_state(state, crtc);
const struct intel_limit *limit = &intel_limits_chv; const struct intel_limit *limit = &intel_limits_chv;
struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev); int refclk = 100000;
memset(&crtc_state->dpll_hw_state, 0, memset(&crtc_state->dpll_hw_state, 0,
sizeof(crtc_state->dpll_hw_state)); sizeof(crtc_state->dpll_hw_state));
...@@ -1188,11 +1192,14 @@ static int chv_crtc_compute_clock(struct intel_crtc_state *crtc_state) ...@@ -1188,11 +1192,14 @@ static int chv_crtc_compute_clock(struct intel_crtc_state *crtc_state)
return 0; return 0;
} }
static int vlv_crtc_compute_clock(struct intel_crtc_state *crtc_state) static int vlv_crtc_compute_clock(struct intel_atomic_state *state,
struct intel_crtc *crtc)
{ {
int refclk = 100000; struct drm_i915_private *i915 = to_i915(state->base.dev);
struct intel_crtc_state *crtc_state =
intel_atomic_get_new_crtc_state(state, crtc);
const struct intel_limit *limit = &intel_limits_vlv; const struct intel_limit *limit = &intel_limits_vlv;
struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev); int refclk = 100000;
memset(&crtc_state->dpll_hw_state, 0, memset(&crtc_state->dpll_hw_state, 0,
sizeof(crtc_state->dpll_hw_state)); sizeof(crtc_state->dpll_hw_state));
...@@ -1209,10 +1216,12 @@ static int vlv_crtc_compute_clock(struct intel_crtc_state *crtc_state) ...@@ -1209,10 +1216,12 @@ static int vlv_crtc_compute_clock(struct intel_crtc_state *crtc_state)
return 0; return 0;
} }
static int g4x_crtc_compute_clock(struct intel_crtc_state *crtc_state) static int g4x_crtc_compute_clock(struct intel_atomic_state *state,
struct intel_crtc *crtc)
{ {
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); struct drm_i915_private *dev_priv = to_i915(state->base.dev);
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); struct intel_crtc_state *crtc_state =
intel_atomic_get_new_crtc_state(state, crtc);
const struct intel_limit *limit; const struct intel_limit *limit;
int refclk = 96000; int refclk = 96000;
...@@ -1255,10 +1264,12 @@ static int g4x_crtc_compute_clock(struct intel_crtc_state *crtc_state) ...@@ -1255,10 +1264,12 @@ static int g4x_crtc_compute_clock(struct intel_crtc_state *crtc_state)
return 0; return 0;
} }
static int pnv_crtc_compute_clock(struct intel_crtc_state *crtc_state) static int pnv_crtc_compute_clock(struct intel_atomic_state *state,
struct intel_crtc *crtc)
{ {
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); struct drm_i915_private *dev_priv = to_i915(state->base.dev);
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); struct intel_crtc_state *crtc_state =
intel_atomic_get_new_crtc_state(state, crtc);
const struct intel_limit *limit; const struct intel_limit *limit;
int refclk = 96000; int refclk = 96000;
...@@ -1292,10 +1303,12 @@ static int pnv_crtc_compute_clock(struct intel_crtc_state *crtc_state) ...@@ -1292,10 +1303,12 @@ static int pnv_crtc_compute_clock(struct intel_crtc_state *crtc_state)
return 0; return 0;
} }
static int i9xx_crtc_compute_clock(struct intel_crtc_state *crtc_state) static int i9xx_crtc_compute_clock(struct intel_atomic_state *state,
struct intel_crtc *crtc)
{ {
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); struct drm_i915_private *dev_priv = to_i915(state->base.dev);
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); struct intel_crtc_state *crtc_state =
intel_atomic_get_new_crtc_state(state, crtc);
const struct intel_limit *limit; const struct intel_limit *limit;
int refclk = 96000; int refclk = 96000;
...@@ -1329,10 +1342,12 @@ static int i9xx_crtc_compute_clock(struct intel_crtc_state *crtc_state) ...@@ -1329,10 +1342,12 @@ static int i9xx_crtc_compute_clock(struct intel_crtc_state *crtc_state)
return 0; return 0;
} }
static int i8xx_crtc_compute_clock(struct intel_crtc_state *crtc_state) static int i8xx_crtc_compute_clock(struct intel_atomic_state *state,
struct intel_crtc *crtc)
{ {
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); struct drm_i915_private *dev_priv = to_i915(state->base.dev);
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); struct intel_crtc_state *crtc_state =
intel_atomic_get_new_crtc_state(state, crtc);
const struct intel_limit *limit; const struct intel_limit *limit;
int refclk = 48000; int refclk = 48000;
...@@ -1400,12 +1415,12 @@ static const struct intel_dpll_funcs i8xx_dpll_funcs = { ...@@ -1400,12 +1415,12 @@ static const struct intel_dpll_funcs i8xx_dpll_funcs = {
.crtc_compute_clock = i8xx_crtc_compute_clock, .crtc_compute_clock = i8xx_crtc_compute_clock,
}; };
int intel_dpll_crtc_compute_clock(struct intel_crtc_state *crtc_state) int intel_dpll_crtc_compute_clock(struct intel_atomic_state *state,
struct intel_crtc *crtc)
{ {
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); struct drm_i915_private *i915 = to_i915(state->base.dev);
struct drm_i915_private *i915 = to_i915(crtc->base.dev);
return i915->dpll_funcs->crtc_compute_clock(crtc_state); return i915->dpll_funcs->crtc_compute_clock(state, crtc);
} }
void void
......
...@@ -10,12 +10,14 @@ ...@@ -10,12 +10,14 @@
struct dpll; struct dpll;
struct drm_i915_private; struct drm_i915_private;
struct intel_atomic_state;
struct intel_crtc; struct intel_crtc;
struct intel_crtc_state; struct intel_crtc_state;
enum pipe; enum pipe;
void intel_dpll_init_clock_hook(struct drm_i915_private *dev_priv); void intel_dpll_init_clock_hook(struct drm_i915_private *dev_priv);
int intel_dpll_crtc_compute_clock(struct intel_crtc_state *crtc_state); int intel_dpll_crtc_compute_clock(struct intel_atomic_state *state,
struct intel_crtc *crtc);
int vlv_calc_dpll_params(int refclk, struct dpll *clock); int vlv_calc_dpll_params(int refclk, struct dpll *clock);
int pnv_calc_dpll_params(int refclk, struct dpll *clock); int pnv_calc_dpll_params(int refclk, struct dpll *clock);
int i9xx_calc_dpll_params(int refclk, struct dpll *clock); int i9xx_calc_dpll_params(int refclk, struct dpll *clock);
......
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