Commit 7039a6dc authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Simplify SWIDTHSW calculation

The formula in Bspec for computing the overlay SWIDTHSW is overly
obfuscated. Simplify the formula to something that's easily parsed by
humans.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1481131693-27993-8-git-send-email-ville.syrjala@linux.intel.comReviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
parent 949d8cf8
...@@ -567,19 +567,17 @@ static int uv_vsubsampling(u32 format) ...@@ -567,19 +567,17 @@ static int uv_vsubsampling(u32 format)
static u32 calc_swidthsw(struct drm_i915_private *dev_priv, u32 offset, u32 width) static u32 calc_swidthsw(struct drm_i915_private *dev_priv, u32 offset, u32 width)
{ {
u32 mask, shift, ret; u32 sw;
if (IS_GEN2(dev_priv)) {
mask = 0x1f; if (IS_GEN2(dev_priv))
shift = 5; sw = ALIGN((offset & 31) + width, 32);
} else { else
mask = 0x3f; sw = ALIGN((offset & 63) + width, 64);
shift = 6;
} if (sw == 0)
ret = ((offset + width + mask) >> shift) - (offset >> shift); return 0;
if (!IS_GEN2(dev_priv))
ret <<= 1; return (sw - 32) >> 3;
ret -= 1;
return ret << 2;
} }
static const u16 y_static_hcoeffs[N_HORIZ_Y_TAPS * N_PHASES] = { static const u16 y_static_hcoeffs[N_HORIZ_Y_TAPS * N_PHASES] = {
......
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