#include <drm/drm_plane_helper.h>
#include "intel_atomic.h"
+#include "intel_cdclk.h"
#include "intel_display_types.h"
#include "intel_hdcp.h"
#include "intel_psr.h"
void intel_atomic_state_clear(struct drm_atomic_state *s)
{
struct intel_atomic_state *state = to_intel_atomic_state(s);
+
drm_atomic_state_default_clear(&state->base);
+
state->dpll_set = state->modeset = false;
state->global_state_changed = false;
state->active_pipes = 0;
- memset(&state->min_cdclk, 0, sizeof(state->min_cdclk));
- memset(&state->min_voltage_level, 0, sizeof(state->min_voltage_level));
- memset(&state->cdclk.logical, 0, sizeof(state->cdclk.logical));
- memset(&state->cdclk.actual, 0, sizeof(state->cdclk.actual));
- state->cdclk.pipe = INVALID_PIPE;
+ intel_cdclk_clear_state(state);
}
struct intel_crtc_state *
a->voltage_level != b->voltage_level;
}
+/**
+ * intel_cdclk_clear_state - clear the cdclk state
+ * @state: atomic state
+ *
+ * Clear the cdclk state for ww_mutex backoff.
+ */
+void intel_cdclk_clear_state(struct intel_atomic_state *state)
+{
+ memset(&state->cdclk, 0, sizeof(state->cdclk));
+ state->cdclk.pipe = INVALID_PIPE;
+}
+
/**
* intel_cdclk_swap_state - make atomic CDCLK configuration effective
* @state: atomic state
struct drm_i915_private *dev_priv = to_i915(state->base.dev);
/* FIXME maybe swap() these too */
- memcpy(dev_priv->min_cdclk, state->min_cdclk,
- sizeof(state->min_cdclk));
- memcpy(dev_priv->min_voltage_level, state->min_voltage_level,
- sizeof(state->min_voltage_level));
+ memcpy(dev_priv->cdclk.min_cdclk, state->cdclk.min_cdclk,
+ sizeof(state->cdclk.min_cdclk));
+ memcpy(dev_priv->cdclk.min_voltage_level, state->cdclk.min_voltage_level,
+ sizeof(state->cdclk.min_voltage_level));
dev_priv->cdclk.force_min_cdclk = state->cdclk.force_min_cdclk;
if (min_cdclk < 0)
return min_cdclk;
- if (state->min_cdclk[i] == min_cdclk)
+ if (state->cdclk.min_cdclk[i] == min_cdclk)
continue;
- state->min_cdclk[i] = min_cdclk;
+ state->cdclk.min_cdclk[i] = min_cdclk;
ret = intel_atomic_lock_global_state(state);
if (ret)
min_cdclk = state->cdclk.force_min_cdclk;
for_each_pipe(dev_priv, pipe)
- min_cdclk = max(state->min_cdclk[pipe], min_cdclk);
+ min_cdclk = max(state->cdclk.min_cdclk[pipe], min_cdclk);
return min_cdclk;
}
else
min_voltage_level = 0;
- if (state->min_voltage_level[i] == min_voltage_level)
+ if (state->cdclk.min_voltage_level[i] == min_voltage_level)
continue;
- state->min_voltage_level[i] = min_voltage_level;
+ state->cdclk.min_voltage_level[i] = min_voltage_level;
ret = intel_atomic_lock_global_state(state);
if (ret)
min_voltage_level = 0;
for_each_pipe(dev_priv, pipe)
- min_voltage_level = max(state->min_voltage_level[pipe],
+ min_voltage_level = max(state->cdclk.min_voltage_level[pipe],
min_voltage_level);
return min_voltage_level;
enum pipe pipe;
int ret;
- memcpy(state->min_cdclk, dev_priv->min_cdclk,
- sizeof(state->min_cdclk));
- memcpy(state->min_voltage_level, dev_priv->min_voltage_level,
- sizeof(state->min_voltage_level));
+ memcpy(state->cdclk.min_cdclk, dev_priv->cdclk.min_cdclk,
+ sizeof(state->cdclk.min_cdclk));
+ memcpy(state->cdclk.min_voltage_level, dev_priv->cdclk.min_voltage_level,
+ sizeof(state->cdclk.min_voltage_level));
/* keep the current setting */
if (!state->cdclk.force_min_cdclk_changed)
crtc->enabled_power_domains = 0;
dev_priv->active_pipes &= ~BIT(pipe);
- dev_priv->min_cdclk[pipe] = 0;
- dev_priv->min_voltage_level[pipe] = 0;
+ dev_priv->cdclk.min_cdclk[pipe] = 0;
+ dev_priv->cdclk.min_voltage_level[pipe] = 0;
bw_state->data_rate[pipe] = 0;
bw_state->num_active_planes[pipe] = 0;
min_cdclk = 0;
}
- dev_priv->min_cdclk[crtc->pipe] = min_cdclk;
- dev_priv->min_voltage_level[crtc->pipe] =
+ dev_priv->cdclk.min_cdclk[crtc->pipe] = min_cdclk;
+ dev_priv->cdclk.min_voltage_level[crtc->pipe] =
crtc_state->min_voltage_level;
intel_bw_crtc_update(bw_state, crtc_state);
const struct intel_cdclk_vals *table;
int force_min_cdclk;
+
+ /* minimum acceptable cdclk for each pipe */
+ int min_cdclk[I915_MAX_PIPES];
+ /* minimum acceptable voltage level for each pipe */
+ u8 min_voltage_level[I915_MAX_PIPES];
} cdclk;
/**
* any crtc lock is sufficient, for writing must hold all of them.
*/
u8 active_pipes;
- /* minimum acceptable cdclk for each pipe */
- int min_cdclk[I915_MAX_PIPES];
- /* minimum acceptable voltage level for each pipe */
- u8 min_voltage_level[I915_MAX_PIPES];
int dpio_phy_iosf_port[I915_NUM_PHYS_VLV];