diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2016-12-07 20:28:09 +0300 |
---|---|---|
committer | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2016-12-22 22:30:54 +0300 |
commit | 7039a6dc17a9ae73dcf38fe16e9e78dedbfb26e0 (patch) | |
tree | bef5923e932dcf8313c1d84a2c95e0c00fa5476f /drivers/gpu/drm | |
parent | 949d8cf8017c03ac20a153070730ea9e35f4f1d5 (diff) | |
download | linux-7039a6dc17a9ae73dcf38fe16e9e78dedbfb26e0.tar.xz |
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: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1481131693-27993-8-git-send-email-ville.syrjala@linux.intel.com
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/i915/intel_overlay.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c index 935e6bc2ccad..9be9522f1dd1 100644 --- a/drivers/gpu/drm/i915/intel_overlay.c +++ b/drivers/gpu/drm/i915/intel_overlay.c @@ -567,19 +567,17 @@ static int uv_vsubsampling(u32 format) static u32 calc_swidthsw(struct drm_i915_private *dev_priv, u32 offset, u32 width) { - u32 mask, shift, ret; - if (IS_GEN2(dev_priv)) { - mask = 0x1f; - shift = 5; - } else { - mask = 0x3f; - shift = 6; - } - ret = ((offset + width + mask) >> shift) - (offset >> shift); - if (!IS_GEN2(dev_priv)) - ret <<= 1; - ret -= 1; - return ret << 2; + u32 sw; + + if (IS_GEN2(dev_priv)) + sw = ALIGN((offset & 31) + width, 32); + else + sw = ALIGN((offset & 63) + width, 64); + + if (sw == 0) + return 0; + + return (sw - 32) >> 3; } static const u16 y_static_hcoeffs[N_HORIZ_Y_TAPS * N_PHASES] = { |