Commit 2013ab18 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915/fbc: Extract {skl,glk}_fbc_program_cfb_stride()

Declutter gen7_fbc_activate() by sucking the override
stride programming stuff into helpers.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211104144520.22605-3-ville.syrjala@linux.intel.comAcked-by: default avatarJani Nikula <jani.nikula@intel.com>
Reviewed-by: default avatarMika Kahola <mika.kahola@intel.com>
parent b50364af
...@@ -360,32 +360,45 @@ static bool ilk_fbc_is_active(struct drm_i915_private *dev_priv) ...@@ -360,32 +360,45 @@ static bool ilk_fbc_is_active(struct drm_i915_private *dev_priv)
return intel_de_read(dev_priv, ILK_DPFC_CONTROL) & DPFC_CTL_EN; return intel_de_read(dev_priv, ILK_DPFC_CONTROL) & DPFC_CTL_EN;
} }
static void gen7_fbc_activate(struct drm_i915_private *dev_priv) static void glk_fbc_program_cfb_stride(struct drm_i915_private *i915)
{ {
struct intel_fbc *fbc = &dev_priv->fbc; struct intel_fbc *fbc = &i915->fbc;
const struct intel_fbc_reg_params *params = &fbc->params; const struct intel_fbc_reg_params *params = &fbc->params;
u32 dpfc_ctl; u32 val = 0;
if (DISPLAY_VER(dev_priv) >= 10) { if (params->override_cfb_stride)
u32 val = 0; val |= FBC_STRIDE_OVERRIDE |
FBC_STRIDE(params->override_cfb_stride / fbc->limit);
if (params->override_cfb_stride) intel_de_write(i915, GLK_FBC_STRIDE, val);
val |= FBC_STRIDE_OVERRIDE | }
FBC_STRIDE(params->override_cfb_stride / fbc->limit);
intel_de_write(dev_priv, GLK_FBC_STRIDE, val); static void skl_fbc_program_cfb_stride(struct drm_i915_private *i915)
} else if (DISPLAY_VER(dev_priv) == 9) { {
u32 val = 0; struct intel_fbc *fbc = &i915->fbc;
const struct intel_fbc_reg_params *params = &fbc->params;
u32 val = 0;
/* Display WA #0529: skl, kbl, bxt. */ /* Display WA #0529: skl, kbl, bxt. */
if (params->override_cfb_stride) if (params->override_cfb_stride)
val |= CHICKEN_FBC_STRIDE_OVERRIDE | val |= CHICKEN_FBC_STRIDE_OVERRIDE |
CHICKEN_FBC_STRIDE(params->override_cfb_stride / fbc->limit); CHICKEN_FBC_STRIDE(params->override_cfb_stride / fbc->limit);
intel_de_rmw(dev_priv, CHICKEN_MISC_4, intel_de_rmw(i915, CHICKEN_MISC_4,
CHICKEN_FBC_STRIDE_OVERRIDE | CHICKEN_FBC_STRIDE_OVERRIDE |
CHICKEN_FBC_STRIDE_MASK, val); CHICKEN_FBC_STRIDE_MASK, val);
} }
static void gen7_fbc_activate(struct drm_i915_private *dev_priv)
{
struct intel_fbc *fbc = &dev_priv->fbc;
const struct intel_fbc_reg_params *params = &fbc->params;
u32 dpfc_ctl;
if (DISPLAY_VER(dev_priv) >= 10)
glk_fbc_program_cfb_stride(dev_priv);
else if (DISPLAY_VER(dev_priv) == 9)
skl_fbc_program_cfb_stride(dev_priv);
dpfc_ctl = 0; dpfc_ctl = 0;
if (IS_IVYBRIDGE(dev_priv)) if (IS_IVYBRIDGE(dev_priv))
......
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