Commit b124ea43 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Constify intel_pipe_config_compare()

Now that intel_pipe_config_compare() no longer clobbers the passed
in state we can make both crtc states const. And while at we simplify
the calling convention, and clean up intel_compare_link_m_n() a bit.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190612130801.2085-2-ville.syrjala@linux.intel.comReviewed-by: default avatarImre Deak <imre.deak@intel.com>
parent f0521558
...@@ -12292,18 +12292,14 @@ intel_compare_m_n(unsigned int m, unsigned int n, ...@@ -12292,18 +12292,14 @@ intel_compare_m_n(unsigned int m, unsigned int n,
static bool static bool
intel_compare_link_m_n(const struct intel_link_m_n *m_n, intel_compare_link_m_n(const struct intel_link_m_n *m_n,
struct intel_link_m_n *m2_n2, const struct intel_link_m_n *m2_n2,
bool adjust) bool exact)
{ {
if (m_n->tu == m2_n2->tu && return m_n->tu == m2_n2->tu &&
intel_compare_m_n(m_n->gmch_m, m_n->gmch_n, intel_compare_m_n(m_n->gmch_m, m_n->gmch_n,
m2_n2->gmch_m, m2_n2->gmch_n, !adjust) && m2_n2->gmch_m, m2_n2->gmch_n, exact) &&
intel_compare_m_n(m_n->link_m, m_n->link_n, intel_compare_m_n(m_n->link_m, m_n->link_n,
m2_n2->link_m, m2_n2->link_n, !adjust)) { m2_n2->link_m, m2_n2->link_n, exact);
return true;
}
return false;
} }
static bool static bool
...@@ -12373,11 +12369,11 @@ static bool fastboot_enabled(struct drm_i915_private *dev_priv) ...@@ -12373,11 +12369,11 @@ static bool fastboot_enabled(struct drm_i915_private *dev_priv)
} }
static bool static bool
intel_pipe_config_compare(struct drm_i915_private *dev_priv, intel_pipe_config_compare(const struct intel_crtc_state *current_config,
struct intel_crtc_state *current_config, const struct intel_crtc_state *pipe_config,
struct intel_crtc_state *pipe_config,
bool adjust) bool adjust)
{ {
struct drm_i915_private *dev_priv = to_i915(current_config->base.crtc->dev);
bool ret = true; bool ret = true;
bool fixup_inherited = adjust && bool fixup_inherited = adjust &&
(current_config->base.mode.private_flags & I915_MODE_FLAG_INHERITED) && (current_config->base.mode.private_flags & I915_MODE_FLAG_INHERITED) &&
...@@ -12448,7 +12444,7 @@ intel_pipe_config_compare(struct drm_i915_private *dev_priv, ...@@ -12448,7 +12444,7 @@ intel_pipe_config_compare(struct drm_i915_private *dev_priv,
#define PIPE_CONF_CHECK_M_N(name) do { \ #define PIPE_CONF_CHECK_M_N(name) do { \
if (!intel_compare_link_m_n(&current_config->name, \ if (!intel_compare_link_m_n(&current_config->name, \
&pipe_config->name,\ &pipe_config->name,\
adjust)) { \ !adjust)) { \
pipe_config_err(adjust, __stringify(name), \ pipe_config_err(adjust, __stringify(name), \
"(expected tu %i gmch %i/%i link %i/%i, " \ "(expected tu %i gmch %i/%i link %i/%i, " \
"found tu %i, gmch %i/%i link %i/%i)\n", \ "found tu %i, gmch %i/%i link %i/%i)\n", \
...@@ -12473,9 +12469,9 @@ intel_pipe_config_compare(struct drm_i915_private *dev_priv, ...@@ -12473,9 +12469,9 @@ intel_pipe_config_compare(struct drm_i915_private *dev_priv,
*/ */
#define PIPE_CONF_CHECK_M_N_ALT(name, alt_name) do { \ #define PIPE_CONF_CHECK_M_N_ALT(name, alt_name) do { \
if (!intel_compare_link_m_n(&current_config->name, \ if (!intel_compare_link_m_n(&current_config->name, \
&pipe_config->name, adjust) && \ &pipe_config->name, !adjust) && \
!intel_compare_link_m_n(&current_config->alt_name, \ !intel_compare_link_m_n(&current_config->alt_name, \
&pipe_config->name, adjust)) { \ &pipe_config->name, !adjust)) { \
pipe_config_err(adjust, __stringify(name), \ pipe_config_err(adjust, __stringify(name), \
"(expected tu %i gmch %i/%i link %i/%i, " \ "(expected tu %i gmch %i/%i link %i/%i, " \
"or tu %i gmch %i/%i link %i/%i, " \ "or tu %i gmch %i/%i link %i/%i, " \
...@@ -12985,8 +12981,7 @@ verify_crtc_state(struct drm_crtc *crtc, ...@@ -12985,8 +12981,7 @@ verify_crtc_state(struct drm_crtc *crtc,
intel_pipe_config_sanity_check(dev_priv, pipe_config); intel_pipe_config_sanity_check(dev_priv, pipe_config);
sw_config = to_intel_crtc_state(new_crtc_state); sw_config = to_intel_crtc_state(new_crtc_state);
if (!intel_pipe_config_compare(dev_priv, sw_config, if (!intel_pipe_config_compare(sw_config, pipe_config, false)) {
pipe_config, false)) {
I915_STATE_WARN(1, "pipe state doesn't match!\n"); I915_STATE_WARN(1, "pipe state doesn't match!\n");
intel_dump_pipe_config(pipe_config, NULL, "[hw state]"); intel_dump_pipe_config(pipe_config, NULL, "[hw state]");
intel_dump_pipe_config(sw_config, NULL, "[sw state]"); intel_dump_pipe_config(sw_config, NULL, "[sw state]");
...@@ -13431,14 +13426,10 @@ static int calc_watermark_data(struct intel_atomic_state *state) ...@@ -13431,14 +13426,10 @@ static int calc_watermark_data(struct intel_atomic_state *state)
return 0; return 0;
} }
static void intel_crtc_check_fastset(struct intel_crtc_state *old_crtc_state, static void intel_crtc_check_fastset(const struct intel_crtc_state *old_crtc_state,
struct intel_crtc_state *new_crtc_state) struct intel_crtc_state *new_crtc_state)
{ {
struct drm_i915_private *dev_priv = if (!intel_pipe_config_compare(old_crtc_state, new_crtc_state, true))
to_i915(new_crtc_state->base.crtc->dev);
if (!intel_pipe_config_compare(dev_priv, old_crtc_state,
new_crtc_state, true))
return; return;
new_crtc_state->base.mode_changed = false; new_crtc_state->base.mode_changed = false;
......
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