[Intel-gfx] [PATCH 2/2] drm/i915: Refactor panel fitting on the LVDS.
Chris Wilson
chris at chris-wilson.co.uk
Sat Jul 17 14:48:22 CEST 2010
On Sat, 17 Jul 2010 13:38:44 +0100, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> +static inline u32 panel_fitter_scaling(u32 source, u32 target)
> +{
> + /*
> + * Floating point operation is not supported. So the FACTOR
> + * is defined, which can avoid the floating point computation
> + * when calculating the panel ratio.
> + */
> +#define ACCURACY 12
> +#define FACTOR (1 << ACCURACY)
> + u32 ratio = source * FACTOR / target;
> + return (FACTOR * (ratio + FACTOR/2)) / FACTOR;
> +}
Rounding went wrong here. Should be
return (FACTOR * ratio + FACTOR/2) / FACTOR;
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list