|
|
7d2c2f2 |
From 0042e1e7a03a2fb5d6c464c03ce84d55b31add11 Mon Sep 17 00:00:00 2001
|
|
|
7d2c2f2 |
From: Matt Roper <matthew.d.roper@intel.com>
|
|
|
7d2c2f2 |
Date: Thu, 12 May 2016 07:05:55 -0700
|
|
|
7d2c2f2 |
Subject: [PATCH 01/17] drm/i915: Reorganize WM structs/unions in CRTC state
|
|
|
7d2c2f2 |
|
|
|
7d2c2f2 |
Reorganize the nested structures and unions we have for pipe watermark
|
|
|
7d2c2f2 |
data in intel_crtc_state so that platform-specific data can be added in
|
|
|
7d2c2f2 |
a more sensible manner (and save a bit of memory at the same time).
|
|
|
7d2c2f2 |
|
|
|
7d2c2f2 |
The change basically changes the organization from:
|
|
|
7d2c2f2 |
|
|
|
7d2c2f2 |
union {
|
|
|
7d2c2f2 |
struct intel_pipe_wm ilk;
|
|
|
7d2c2f2 |
struct intel_pipe_wm skl;
|
|
|
7d2c2f2 |
} optimal;
|
|
|
7d2c2f2 |
|
|
|
7d2c2f2 |
struct intel_pipe_wm intermediate /* ILK-only */
|
|
|
7d2c2f2 |
|
|
|
7d2c2f2 |
to
|
|
|
7d2c2f2 |
|
|
|
7d2c2f2 |
union {
|
|
|
7d2c2f2 |
struct {
|
|
|
7d2c2f2 |
struct intel_pipe_wm intermediate;
|
|
|
7d2c2f2 |
struct intel_pipe_wm optimal;
|
|
|
7d2c2f2 |
} ilk;
|
|
|
7d2c2f2 |
|
|
|
7d2c2f2 |
struct {
|
|
|
7d2c2f2 |
struct intel_pipe_wm optimal;
|
|
|
7d2c2f2 |
} skl;
|
|
|
7d2c2f2 |
}
|
|
|
7d2c2f2 |
|
|
|
7d2c2f2 |
There should be no functional change here, but it will allow us to add
|
|
|
7d2c2f2 |
more platform-specific fields going forward (and more easily extend to
|
|
|
7d2c2f2 |
other platform types like VLV).
|
|
|
7d2c2f2 |
|
|
|
7d2c2f2 |
While we're at it, let's move the entire watermark substructure out to
|
|
|
7d2c2f2 |
its own structure definition to make the code slightly more readable.
|
|
|
7d2c2f2 |
|
|
|
7d2c2f2 |
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
|
|
|
7d2c2f2 |
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
|
|
|
7d2c2f2 |
Link: http://patchwork.freedesktop.org/patch/msgid/1463061971-19638-2-git-send-email-matthew.d.roper@intel.com
|
|
|
7d2c2f2 |
---
|
|
|
7d2c2f2 |
drivers/gpu/drm/i915/intel_display.c | 2 +-
|
|
|
7d2c2f2 |
drivers/gpu/drm/i915/intel_drv.h | 61 +++++++++++++++++++++---------------
|
|
|
7d2c2f2 |
drivers/gpu/drm/i915/intel_pm.c | 18 +++++------
|
|
|
7d2c2f2 |
3 files changed, 45 insertions(+), 36 deletions(-)
|
|
|
7d2c2f2 |
|
|
|
7d2c2f2 |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
|
|
|
7d2c2f2 |
index d19b392..4633aec 100644
|
|
|
7d2c2f2 |
--- a/drivers/gpu/drm/i915/intel_display.c
|
|
|
7d2c2f2 |
+++ b/drivers/gpu/drm/i915/intel_display.c
|
|
|
7d2c2f2 |
@@ -12027,7 +12027,7 @@ static int intel_crtc_atomic_check(struct drm_crtc *crtc,
|
|
|
7d2c2f2 |
}
|
|
|
7d2c2f2 |
} else if (dev_priv->display.compute_intermediate_wm) {
|
|
|
7d2c2f2 |
if (HAS_PCH_SPLIT(dev_priv) && INTEL_GEN(dev_priv) < 9)
|
|
|
7d2c2f2 |
- pipe_config->wm.intermediate = pipe_config->wm.optimal.ilk;
|
|
|
7d2c2f2 |
+ pipe_config->wm.ilk.intermediate = pipe_config->wm.ilk.optimal;
|
|
|
7d2c2f2 |
}
|
|
|
7d2c2f2 |
|
|
|
7d2c2f2 |
if (INTEL_INFO(dev)->gen >= 9) {
|
|
|
7d2c2f2 |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
|
|
|
7d2c2f2 |
index 4a24b00..5a186bf 100644
|
|
|
7d2c2f2 |
--- a/drivers/gpu/drm/i915/intel_drv.h
|
|
|
7d2c2f2 |
+++ b/drivers/gpu/drm/i915/intel_drv.h
|
|
|
7d2c2f2 |
@@ -405,6 +405,40 @@ struct skl_pipe_wm {
|
|
|
7d2c2f2 |
uint32_t linetime;
|
|
|
7d2c2f2 |
};
|
|
|
7d2c2f2 |
|
|
|
7d2c2f2 |
+struct intel_crtc_wm_state {
|
|
|
7d2c2f2 |
+ union {
|
|
|
7d2c2f2 |
+ struct {
|
|
|
7d2c2f2 |
+ /*
|
|
|
7d2c2f2 |
+ * Intermediate watermarks; these can be
|
|
|
7d2c2f2 |
+ * programmed immediately since they satisfy
|
|
|
7d2c2f2 |
+ * both the current configuration we're
|
|
|
7d2c2f2 |
+ * switching away from and the new
|
|
|
7d2c2f2 |
+ * configuration we're switching to.
|
|
|
7d2c2f2 |
+ */
|
|
|
7d2c2f2 |
+ struct intel_pipe_wm intermediate;
|
|
|
7d2c2f2 |
+
|
|
|
7d2c2f2 |
+ /*
|
|
|
7d2c2f2 |
+ * Optimal watermarks, programmed post-vblank
|
|
|
7d2c2f2 |
+ * when this state is committed.
|
|
|
7d2c2f2 |
+ */
|
|
|
7d2c2f2 |
+ struct intel_pipe_wm optimal;
|
|
|
7d2c2f2 |
+ } ilk;
|
|
|
7d2c2f2 |
+
|
|
|
7d2c2f2 |
+ struct {
|
|
|
7d2c2f2 |
+ /* gen9+ only needs 1-step wm programming */
|
|
|
7d2c2f2 |
+ struct skl_pipe_wm optimal;
|
|
|
7d2c2f2 |
+ } skl;
|
|
|
7d2c2f2 |
+ };
|
|
|
7d2c2f2 |
+
|
|
|
7d2c2f2 |
+ /*
|
|
|
7d2c2f2 |
+ * Platforms with two-step watermark programming will need to
|
|
|
7d2c2f2 |
+ * update watermark programming post-vblank to switch from the
|
|
|
7d2c2f2 |
+ * safe intermediate watermarks to the optimal final
|
|
|
7d2c2f2 |
+ * watermarks.
|
|
|
7d2c2f2 |
+ */
|
|
|
7d2c2f2 |
+ bool need_postvbl_update;
|
|
|
7d2c2f2 |
+};
|
|
|
7d2c2f2 |
+
|
|
|
7d2c2f2 |
struct intel_crtc_state {
|
|
|
7d2c2f2 |
struct drm_crtc_state base;
|
|
|
7d2c2f2 |
|
|
|
7d2c2f2 |
@@ -558,32 +592,7 @@ struct intel_crtc_state {
|
|
|
7d2c2f2 |
/* IVB sprite scaling w/a (WaCxSRDisabledForSpriteScaling:ivb) */
|
|
|
7d2c2f2 |
bool disable_lp_wm;
|
|
|
7d2c2f2 |
|
|
|
7d2c2f2 |
- struct {
|
|
|
7d2c2f2 |
- /*
|
|
|
7d2c2f2 |
- * Optimal watermarks, programmed post-vblank when this state
|
|
|
7d2c2f2 |
- * is committed.
|
|
|
7d2c2f2 |
- */
|
|
|
7d2c2f2 |
- union {
|
|
|
7d2c2f2 |
- struct intel_pipe_wm ilk;
|
|
|
7d2c2f2 |
- struct skl_pipe_wm skl;
|
|
|
7d2c2f2 |
- } optimal;
|
|
|
7d2c2f2 |
-
|
|
|
7d2c2f2 |
- /*
|
|
|
7d2c2f2 |
- * Intermediate watermarks; these can be programmed immediately
|
|
|
7d2c2f2 |
- * since they satisfy both the current configuration we're
|
|
|
7d2c2f2 |
- * switching away from and the new configuration we're switching
|
|
|
7d2c2f2 |
- * to.
|
|
|
7d2c2f2 |
- */
|
|
|
7d2c2f2 |
- struct intel_pipe_wm intermediate;
|
|
|
7d2c2f2 |
-
|
|
|
7d2c2f2 |
- /*
|
|
|
7d2c2f2 |
- * Platforms with two-step watermark programming will need to
|
|
|
7d2c2f2 |
- * update watermark programming post-vblank to switch from the
|
|
|
7d2c2f2 |
- * safe intermediate watermarks to the optimal final
|
|
|
7d2c2f2 |
- * watermarks.
|
|
|
7d2c2f2 |
- */
|
|
|
7d2c2f2 |
- bool need_postvbl_update;
|
|
|
7d2c2f2 |
- } wm;
|
|
|
7d2c2f2 |
+ struct intel_crtc_wm_state wm;
|
|
|
7d2c2f2 |
|
|
|
7d2c2f2 |
/* Gamma mode programmed on the pipe */
|
|
|
7d2c2f2 |
uint32_t gamma_mode;
|
|
|
7d2c2f2 |
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
|
|
|
7d2c2f2 |
index a7ef45d..4353fec 100644
|
|
|
7d2c2f2 |
--- a/drivers/gpu/drm/i915/intel_pm.c
|
|
|
7d2c2f2 |
+++ b/drivers/gpu/drm/i915/intel_pm.c
|
|
|
7d2c2f2 |
@@ -2309,7 +2309,7 @@ static int ilk_compute_pipe_wm(struct intel_crtc_state *cstate)
|
|
|
7d2c2f2 |
int level, max_level = ilk_wm_max_level(dev), usable_level;
|
|
|
7d2c2f2 |
struct ilk_wm_maximums max;
|
|
|
7d2c2f2 |
|
|
|
7d2c2f2 |
- pipe_wm = &cstate->wm.optimal.ilk;
|
|
|
7d2c2f2 |
+ pipe_wm = &cstate->wm.ilk.optimal;
|
|
|
7d2c2f2 |
|
|
|
7d2c2f2 |
for_each_intel_plane_on_crtc(dev, intel_crtc, intel_plane) {
|
|
|
7d2c2f2 |
struct intel_plane_state *ps;
|
|
|
7d2c2f2 |
@@ -2391,7 +2391,7 @@ static int ilk_compute_intermediate_wm(struct drm_device *dev,
|
|
|
7d2c2f2 |
struct intel_crtc *intel_crtc,
|
|
|
7d2c2f2 |
struct intel_crtc_state *newstate)
|
|
|
7d2c2f2 |
{
|
|
|
7d2c2f2 |
- struct intel_pipe_wm *a = &newstate->wm.intermediate;
|
|
|
7d2c2f2 |
+ struct intel_pipe_wm *a = &newstate->wm.ilk.intermediate;
|
|
|
7d2c2f2 |
struct intel_pipe_wm *b = &intel_crtc->wm.active.ilk;
|
|
|
7d2c2f2 |
int level, max_level = ilk_wm_max_level(dev);
|
|
|
7d2c2f2 |
|
|
|
7d2c2f2 |
@@ -2400,7 +2400,7 @@ static int ilk_compute_intermediate_wm(struct drm_device *dev,
|
|
|
7d2c2f2 |
* currently active watermarks to get values that are safe both before
|
|
|
7d2c2f2 |
* and after the vblank.
|
|
|
7d2c2f2 |
*/
|
|
|
7d2c2f2 |
- *a = newstate->wm.optimal.ilk;
|
|
|
7d2c2f2 |
+ *a = newstate->wm.ilk.optimal;
|
|
|
7d2c2f2 |
a->pipe_enabled |= b->pipe_enabled;
|
|
|
7d2c2f2 |
a->sprites_enabled |= b->sprites_enabled;
|
|
|
7d2c2f2 |
a->sprites_scaled |= b->sprites_scaled;
|
|
|
7d2c2f2 |
@@ -2429,7 +2429,7 @@ static int ilk_compute_intermediate_wm(struct drm_device *dev,
|
|
|
7d2c2f2 |
* If our intermediate WM are identical to the final WM, then we can
|
|
|
7d2c2f2 |
* omit the post-vblank programming; only update if it's different.
|
|
|
7d2c2f2 |
*/
|
|
|
7d2c2f2 |
- if (memcmp(a, &newstate->wm.optimal.ilk, sizeof(*a)) == 0)
|
|
|
7d2c2f2 |
+ if (memcmp(a, &newstate->wm.ilk.optimal, sizeof(*a)) == 0)
|
|
|
7d2c2f2 |
newstate->wm.need_postvbl_update = false;
|
|
|
7d2c2f2 |
|
|
|
7d2c2f2 |
return 0;
|
|
|
7d2c2f2 |
@@ -3678,7 +3678,7 @@ static void skl_update_wm(struct drm_crtc *crtc)
|
|
|
7d2c2f2 |
struct drm_i915_private *dev_priv = dev->dev_private;
|
|
|
7d2c2f2 |
struct skl_wm_values *results = &dev_priv->wm.skl_results;
|
|
|
7d2c2f2 |
struct intel_crtc_state *cstate = to_intel_crtc_state(crtc->state);
|
|
|
7d2c2f2 |
- struct skl_pipe_wm *pipe_wm = &cstate->wm.optimal.skl;
|
|
|
7d2c2f2 |
+ struct skl_pipe_wm *pipe_wm = &cstate->wm.skl.optimal;
|
|
|
7d2c2f2 |
|
|
|
7d2c2f2 |
|
|
|
7d2c2f2 |
/* Clear all dirty flags */
|
|
|
7d2c2f2 |
@@ -3757,7 +3757,7 @@ static void ilk_initial_watermarks(struct intel_crtc_state *cstate)
|
|
|
7d2c2f2 |
struct intel_crtc *intel_crtc = to_intel_crtc(cstate->base.crtc);
|
|
|
7d2c2f2 |
|
|
|
7d2c2f2 |
mutex_lock(&dev_priv->wm.wm_mutex);
|
|
|
7d2c2f2 |
- intel_crtc->wm.active.ilk = cstate->wm.intermediate;
|
|
|
7d2c2f2 |
+ intel_crtc->wm.active.ilk = cstate->wm.ilk.intermediate;
|
|
|
7d2c2f2 |
ilk_program_watermarks(dev_priv);
|
|
|
7d2c2f2 |
mutex_unlock(&dev_priv->wm.wm_mutex);
|
|
|
7d2c2f2 |
}
|
|
|
7d2c2f2 |
@@ -3769,7 +3769,7 @@ static void ilk_optimize_watermarks(struct intel_crtc_state *cstate)
|
|
|
7d2c2f2 |
|
|
|
7d2c2f2 |
mutex_lock(&dev_priv->wm.wm_mutex);
|
|
|
7d2c2f2 |
if (cstate->wm.need_postvbl_update) {
|
|
|
7d2c2f2 |
- intel_crtc->wm.active.ilk = cstate->wm.optimal.ilk;
|
|
|
7d2c2f2 |
+ intel_crtc->wm.active.ilk = cstate->wm.ilk.optimal;
|
|
|
7d2c2f2 |
ilk_program_watermarks(dev_priv);
|
|
|
7d2c2f2 |
}
|
|
|
7d2c2f2 |
mutex_unlock(&dev_priv->wm.wm_mutex);
|
|
|
7d2c2f2 |
@@ -3826,7 +3826,7 @@ static void skl_pipe_wm_get_hw_state(struct drm_crtc *crtc)
|
|
|
7d2c2f2 |
struct skl_wm_values *hw = &dev_priv->wm.skl_hw;
|
|
|
7d2c2f2 |
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
|
|
|
7d2c2f2 |
struct intel_crtc_state *cstate = to_intel_crtc_state(crtc->state);
|
|
|
7d2c2f2 |
- struct skl_pipe_wm *active = &cstate->wm.optimal.skl;
|
|
|
7d2c2f2 |
+ struct skl_pipe_wm *active = &cstate->wm.skl.optimal;
|
|
|
7d2c2f2 |
enum pipe pipe = intel_crtc->pipe;
|
|
|
7d2c2f2 |
int level, i, max_level;
|
|
|
7d2c2f2 |
uint32_t temp;
|
|
|
7d2c2f2 |
@@ -3892,7 +3892,7 @@ static void ilk_pipe_wm_get_hw_state(struct drm_crtc *crtc)
|
|
|
7d2c2f2 |
struct ilk_wm_values *hw = &dev_priv->wm.hw;
|
|
|
7d2c2f2 |
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
|
|
|
7d2c2f2 |
struct intel_crtc_state *cstate = to_intel_crtc_state(crtc->state);
|
|
|
7d2c2f2 |
- struct intel_pipe_wm *active = &cstate->wm.optimal.ilk;
|
|
|
7d2c2f2 |
+ struct intel_pipe_wm *active = &cstate->wm.ilk.optimal;
|
|
|
7d2c2f2 |
enum pipe pipe = intel_crtc->pipe;
|
|
|
7d2c2f2 |
static const i915_reg_t wm0_pipe_reg[] = {
|
|
|
7d2c2f2 |
[PIPE_A] = WM0_PIPEA_ILK,
|
|
|
7d2c2f2 |
--
|
|
|
7d2c2f2 |
2.7.4
|
|
|
7d2c2f2 |
|