From: Damien Lespiau Subject: Re: [PATCH] drm/i915: Compute WR PLL dividers dynamically Date: Fri, 10 May 2013 13:59:11 +0100 Message-ID: <20130510125911.GA19539@strange.amr.corp.intel.com> References: <1368018520-24556-1-git-send-email-damien.lespiau@intel.com> <20130508191354.GX5763@phenom.ffwll.local> <20130508193714.GY5763@phenom.ffwll.local> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id 3A1F5E5C0E for ; Fri, 10 May 2013 05:59:13 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20130508193714.GY5763@phenom.ffwll.local> 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: Daniel Vetter Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Wed, May 08, 2013 at 09:37:14PM +0200, Daniel Vetter wrote: > Oops, blows up on 32bit machines. I guess the igt will be useful once more > to check that the 32bit version is solid, too. Dropped from dinq for now. > -Daniel Oops indeed. Turns out the mistake was an easy one to spot. I used 1e6 as a contant, which is a double constant (!) and promoted the expression to a floating point multiplication before casting it back to a 64 bits integer. The diff between the problematic patch and the resent one (which will follow this mail) is quite straightforward then: $ git diff diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c index 9ee25e7..5c35386 100644 --- a/drivers/gpu/drm/i915/intel_ddi.c +++ b/drivers/gpu/drm/i915/intel_ddi.c @@ -530,8 +530,8 @@ static void wrpll_update_rnp(uint64_t freq2k, unsigned budget, diff = ABS_DIFF((freq2k * p * r2), (LC_FREQ_2K * n2)); diff_best = ABS_DIFF((freq2k * best->p * best->r2), (LC_FREQ_2K * best->n2)); - c = 1e6 * diff; - d = 1e6 * diff_best; + c = 1000000 * diff; + d = 1000000 * diff_best; if (a < c && b < d) { /* If both are above the budget, pick the closer */ -- Damien