Commit d8c0fafc authored by cpaul@redhat.com's avatar cpaul@redhat.com Committed by Paulo Zanoni

drm/i915/gen9: Get rid of redundant watermark values

Now that we've make skl_wm_levels make a little more sense, we can
remove all of the redundant wm information. Up until now we'd been
storing two copies of all of the skl watermarks: one being the
skl_pipe_wm structs, the other being the global wm struct in
drm_i915_private containing the raw register values. This is confusing
and problematic, since it means we're prone to accidentally letting the
two copies go out of sync. So, get rid of all of the functions
responsible for computing the register values and just use a single
helper, skl_write_wm_level(), to convert and write the new watermarks on
the fly.

Changes since v1:
- Fixup skl_write_wm_level()
- Fixup skl_wm_level_from_reg_val()
- Don't forget to copy *active to intel_crtc->wm.active.skl
Changes since v2:
- Fix usage of wrong cstate
Changes since v3 (by Paulo):
- Rebase
Reviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com> (v2)
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: default avatarLyude <cpaul@redhat.com>
Signed-off-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1476814189-6062-1-git-send-email-paulo.r.zanoni@intel.com
parent 38fac8bf
...@@ -1648,8 +1648,6 @@ struct skl_ddb_allocation { ...@@ -1648,8 +1648,6 @@ struct skl_ddb_allocation {
struct skl_wm_values { struct skl_wm_values {
unsigned dirty_pipes; unsigned dirty_pipes;
struct skl_ddb_allocation ddb; struct skl_ddb_allocation ddb;
uint32_t plane[I915_MAX_PIPES][I915_MAX_PLANES][8];
uint32_t plane_trans[I915_MAX_PIPES][I915_MAX_PLANES];
}; };
struct skl_wm_level { struct skl_wm_level {
......
...@@ -3385,6 +3385,8 @@ static void skylake_update_primary_plane(struct drm_plane *plane, ...@@ -3385,6 +3385,8 @@ static void skylake_update_primary_plane(struct drm_plane *plane,
struct intel_crtc *intel_crtc = to_intel_crtc(crtc_state->base.crtc); struct intel_crtc *intel_crtc = to_intel_crtc(crtc_state->base.crtc);
struct drm_framebuffer *fb = plane_state->base.fb; struct drm_framebuffer *fb = plane_state->base.fb;
const struct skl_wm_values *wm = &dev_priv->wm.skl_results; const struct skl_wm_values *wm = &dev_priv->wm.skl_results;
const struct skl_plane_wm *p_wm =
&crtc_state->wm.skl.optimal.planes[0];
int pipe = intel_crtc->pipe; int pipe = intel_crtc->pipe;
u32 plane_ctl; u32 plane_ctl;
unsigned int rotation = plane_state->base.rotation; unsigned int rotation = plane_state->base.rotation;
...@@ -3421,7 +3423,7 @@ static void skylake_update_primary_plane(struct drm_plane *plane, ...@@ -3421,7 +3423,7 @@ static void skylake_update_primary_plane(struct drm_plane *plane,
intel_crtc->adjusted_y = src_y; intel_crtc->adjusted_y = src_y;
if (wm->dirty_pipes & drm_crtc_mask(&intel_crtc->base)) if (wm->dirty_pipes & drm_crtc_mask(&intel_crtc->base))
skl_write_plane_wm(intel_crtc, wm, 0); skl_write_plane_wm(intel_crtc, p_wm, &wm->ddb, 0);
I915_WRITE(PLANE_CTL(pipe, 0), plane_ctl); I915_WRITE(PLANE_CTL(pipe, 0), plane_ctl);
I915_WRITE(PLANE_OFFSET(pipe, 0), (src_y << 16) | src_x); I915_WRITE(PLANE_OFFSET(pipe, 0), (src_y << 16) | src_x);
...@@ -3455,6 +3457,8 @@ static void skylake_disable_primary_plane(struct drm_plane *primary, ...@@ -3455,6 +3457,8 @@ static void skylake_disable_primary_plane(struct drm_plane *primary,
struct drm_device *dev = crtc->dev; struct drm_device *dev = crtc->dev;
struct drm_i915_private *dev_priv = to_i915(dev); struct drm_i915_private *dev_priv = to_i915(dev);
struct intel_crtc *intel_crtc = to_intel_crtc(crtc); struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
struct intel_crtc_state *cstate = to_intel_crtc_state(crtc->state);
const struct skl_plane_wm *p_wm = &cstate->wm.skl.optimal.planes[0];
int pipe = intel_crtc->pipe; int pipe = intel_crtc->pipe;
/* /*
...@@ -3462,7 +3466,8 @@ static void skylake_disable_primary_plane(struct drm_plane *primary, ...@@ -3462,7 +3466,8 @@ static void skylake_disable_primary_plane(struct drm_plane *primary,
* plane's visiblity isn't actually changing neither is its watermarks. * plane's visiblity isn't actually changing neither is its watermarks.
*/ */
if (!crtc->primary->state->visible) if (!crtc->primary->state->visible)
skl_write_plane_wm(intel_crtc, &dev_priv->wm.skl_results, 0); skl_write_plane_wm(intel_crtc, p_wm,
&dev_priv->wm.skl_results.ddb, 0);
I915_WRITE(PLANE_CTL(pipe, 0), 0); I915_WRITE(PLANE_CTL(pipe, 0), 0);
I915_WRITE(PLANE_SURF(pipe, 0), 0); I915_WRITE(PLANE_SURF(pipe, 0), 0);
...@@ -10833,12 +10838,15 @@ static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base, ...@@ -10833,12 +10838,15 @@ static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base,
struct drm_device *dev = crtc->dev; struct drm_device *dev = crtc->dev;
struct drm_i915_private *dev_priv = to_i915(dev); struct drm_i915_private *dev_priv = to_i915(dev);
struct intel_crtc *intel_crtc = to_intel_crtc(crtc); struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
struct intel_crtc_state *cstate = to_intel_crtc_state(crtc->state);
const struct skl_wm_values *wm = &dev_priv->wm.skl_results; const struct skl_wm_values *wm = &dev_priv->wm.skl_results;
const struct skl_plane_wm *p_wm =
&cstate->wm.skl.optimal.planes[PLANE_CURSOR];
int pipe = intel_crtc->pipe; int pipe = intel_crtc->pipe;
uint32_t cntl = 0; uint32_t cntl = 0;
if (INTEL_GEN(dev_priv) >= 9 && wm->dirty_pipes & drm_crtc_mask(crtc)) if (INTEL_GEN(dev_priv) >= 9 && wm->dirty_pipes & drm_crtc_mask(crtc))
skl_write_cursor_wm(intel_crtc, wm); skl_write_cursor_wm(intel_crtc, p_wm, &wm->ddb);
if (plane_state && plane_state->base.visible) { if (plane_state && plane_state->base.visible) {
cntl = MCURSOR_GAMMA_ENABLE; cntl = MCURSOR_GAMMA_ENABLE;
......
...@@ -1773,9 +1773,11 @@ bool skl_ddb_allocation_equals(const struct skl_ddb_allocation *old, ...@@ -1773,9 +1773,11 @@ bool skl_ddb_allocation_equals(const struct skl_ddb_allocation *old,
bool skl_ddb_allocation_overlaps(struct drm_atomic_state *state, bool skl_ddb_allocation_overlaps(struct drm_atomic_state *state,
struct intel_crtc *intel_crtc); struct intel_crtc *intel_crtc);
void skl_write_cursor_wm(struct intel_crtc *intel_crtc, void skl_write_cursor_wm(struct intel_crtc *intel_crtc,
const struct skl_wm_values *wm); const struct skl_plane_wm *wm,
const struct skl_ddb_allocation *ddb);
void skl_write_plane_wm(struct intel_crtc *intel_crtc, void skl_write_plane_wm(struct intel_crtc *intel_crtc,
const struct skl_wm_values *wm, const struct skl_plane_wm *wm,
const struct skl_ddb_allocation *ddb,
int plane); int plane);
uint32_t ilk_pipe_pixel_rate(const struct intel_crtc_state *pipe_config); uint32_t ilk_pipe_pixel_rate(const struct intel_crtc_state *pipe_config);
bool ilk_disable_lp_wm(struct drm_device *dev); bool ilk_disable_lp_wm(struct drm_device *dev);
......
This diff is collapsed.
...@@ -208,6 +208,8 @@ skl_update_plane(struct drm_plane *drm_plane, ...@@ -208,6 +208,8 @@ skl_update_plane(struct drm_plane *drm_plane,
struct intel_crtc *intel_crtc = to_intel_crtc(crtc); struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
const int pipe = intel_plane->pipe; const int pipe = intel_plane->pipe;
const int plane = intel_plane->plane + 1; const int plane = intel_plane->plane + 1;
const struct skl_plane_wm *p_wm =
&crtc_state->wm.skl.optimal.planes[plane];
u32 plane_ctl; u32 plane_ctl;
const struct drm_intel_sprite_colorkey *key = &plane_state->ckey; const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;
u32 surf_addr = plane_state->main.offset; u32 surf_addr = plane_state->main.offset;
...@@ -232,7 +234,7 @@ skl_update_plane(struct drm_plane *drm_plane, ...@@ -232,7 +234,7 @@ skl_update_plane(struct drm_plane *drm_plane,
plane_ctl |= skl_plane_ctl_rotation(rotation); plane_ctl |= skl_plane_ctl_rotation(rotation);
if (wm->dirty_pipes & drm_crtc_mask(crtc)) if (wm->dirty_pipes & drm_crtc_mask(crtc))
skl_write_plane_wm(intel_crtc, wm, plane); skl_write_plane_wm(intel_crtc, p_wm, &wm->ddb, plane);
if (key->flags) { if (key->flags) {
I915_WRITE(PLANE_KEYVAL(pipe, plane), key->min_value); I915_WRITE(PLANE_KEYVAL(pipe, plane), key->min_value);
...@@ -289,6 +291,7 @@ skl_disable_plane(struct drm_plane *dplane, struct drm_crtc *crtc) ...@@ -289,6 +291,7 @@ skl_disable_plane(struct drm_plane *dplane, struct drm_crtc *crtc)
struct drm_device *dev = dplane->dev; struct drm_device *dev = dplane->dev;
struct drm_i915_private *dev_priv = to_i915(dev); struct drm_i915_private *dev_priv = to_i915(dev);
struct intel_plane *intel_plane = to_intel_plane(dplane); struct intel_plane *intel_plane = to_intel_plane(dplane);
struct intel_crtc_state *cstate = to_intel_crtc_state(crtc->state);
const int pipe = intel_plane->pipe; const int pipe = intel_plane->pipe;
const int plane = intel_plane->plane + 1; const int plane = intel_plane->plane + 1;
...@@ -298,7 +301,8 @@ skl_disable_plane(struct drm_plane *dplane, struct drm_crtc *crtc) ...@@ -298,7 +301,8 @@ skl_disable_plane(struct drm_plane *dplane, struct drm_crtc *crtc)
*/ */
if (!dplane->state->visible) if (!dplane->state->visible)
skl_write_plane_wm(to_intel_crtc(crtc), skl_write_plane_wm(to_intel_crtc(crtc),
&dev_priv->wm.skl_results, plane); &cstate->wm.skl.optimal.planes[plane],
&dev_priv->wm.skl_results.ddb, plane);
I915_WRITE(PLANE_CTL(pipe, plane), 0); I915_WRITE(PLANE_CTL(pipe, plane), 0);
......
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