From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Wilson Subject: Re: [PATCH 2/2] drm/i915: Refactor panel fitting on the LVDS. Date: Sat, 17 Jul 2010 13:48:22 +0100 Message-ID: <89k83a$8v8ql7@azsmga001.ch.intel.com> References: <1279370324-12761-1-git-send-email-chris@chris-wilson.co.uk> <1279370324-12761-2-git-send-email-chris@chris-wilson.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga14.intel.com (mga14.intel.com [143.182.124.37]) by gabe.freedesktop.org (Postfix) with ESMTP id 125249E761 for ; Sat, 17 Jul 2010 05:48:26 -0700 (PDT) In-Reply-To: <1279370324-12761-2-git-send-email-chris@chris-wilson.co.uk> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Sat, 17 Jul 2010 13:38:44 +0100, Chris Wilson 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