From mboxrd@z Thu Jan 1 00:00:00 1970 From: Laurent Pinchart Date: Thu, 22 Nov 2012 08:50:10 +0000 Subject: Re: [PATCH v12 3/6] fbmon: add videomode helpers Message-Id: <1554720.pFHYnMF1G4@avalon> List-Id: References: <1353426896-6045-1-git-send-email-s.trumtrar@pengutronix.de> <96696218.4l3uYOulV3@avalon> <20121122062000.GW10369@pengutronix.de> In-Reply-To: <20121122062000.GW10369-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Sascha Hauer Cc: linux-fbdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, David Airlie , devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org, Florian Tobias Schandinat , dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, Tomi Valkeinen , kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org, Steffen Trumtrar , Guennady Liakhovetski , linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Hi Sascha, On Thursday 22 November 2012 07:20:00 Sascha Hauer wrote: > On Wed, Nov 21, 2012 at 11:02:44PM +0100, Laurent Pinchart wrote: > > Hi Steffen, > > > > > + > > > + htotal = vm->hactive + vm->hfront_porch + vm->hback_porch + > > > + vm->hsync_len; > > > + vtotal = vm->vactive + vm->vfront_porch + vm->vback_porch + > > > + vm->vsync_len; > > > + fbmode->refresh = (vm->pixelclock * 1000) / (htotal * vtotal); > > > > This will fail if vm->pixelclock >= ((1 << 32) / 1000). The easiest > > solution is probably to use 64-bit computation. > > You have displays with a pixelclock > 4GHz? vm->pixelclock is expressed in Hz. vm->pixelclock * 1000 will thus overflow if the clock frequency is >= ~4.3 MHz. I have displays with a clock frequency higher than that :-) -- Regards, Laurent Pinchart From mboxrd@z Thu Jan 1 00:00:00 1970 From: Laurent Pinchart Subject: Re: [PATCH v12 3/6] fbmon: add videomode helpers Date: Thu, 22 Nov 2012 09:50:10 +0100 Message-ID: <1554720.pFHYnMF1G4@avalon> References: <1353426896-6045-1-git-send-email-s.trumtrar@pengutronix.de> <96696218.4l3uYOulV3@avalon> <20121122062000.GW10369@pengutronix.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20121122062000.GW10369-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org Sender: "devicetree-discuss" To: Sascha Hauer Cc: linux-fbdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, David Airlie , devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org, Florian Tobias Schandinat , dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, Tomi Valkeinen , kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org, Steffen Trumtrar , Guennady Liakhovetski , linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: devicetree@vger.kernel.org Hi Sascha, On Thursday 22 November 2012 07:20:00 Sascha Hauer wrote: > On Wed, Nov 21, 2012 at 11:02:44PM +0100, Laurent Pinchart wrote: > > Hi Steffen, > > > > > + > > > + htotal = vm->hactive + vm->hfront_porch + vm->hback_porch + > > > + vm->hsync_len; > > > + vtotal = vm->vactive + vm->vfront_porch + vm->vback_porch + > > > + vm->vsync_len; > > > + fbmode->refresh = (vm->pixelclock * 1000) / (htotal * vtotal); > > > > This will fail if vm->pixelclock >= ((1 << 32) / 1000). The easiest > > solution is probably to use 64-bit computation. > > You have displays with a pixelclock > 4GHz? vm->pixelclock is expressed in Hz. vm->pixelclock * 1000 will thus overflow if the clock frequency is >= ~4.3 MHz. I have displays with a clock frequency higher than that :-) -- Regards, Laurent Pinchart From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from perceval.ideasonboard.com ([95.142.166.194]:58457 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756776Ab2KVT0C (ORCPT ); Thu, 22 Nov 2012 14:26:02 -0500 From: Laurent Pinchart To: Sascha Hauer Cc: Steffen Trumtrar , devicetree-discuss@lists.ozlabs.org, Rob Herring , linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, Thierry Reding , Guennady Liakhovetski , linux-media@vger.kernel.org, Tomi Valkeinen , Stephen Warren , kernel@pengutronix.de, Florian Tobias Schandinat , David Airlie Subject: Re: [PATCH v12 3/6] fbmon: add videomode helpers Date: Thu, 22 Nov 2012 09:50:10 +0100 Message-ID: <1554720.pFHYnMF1G4@avalon> In-Reply-To: <20121122062000.GW10369@pengutronix.de> References: <1353426896-6045-1-git-send-email-s.trumtrar@pengutronix.de> <96696218.4l3uYOulV3@avalon> <20121122062000.GW10369@pengutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-media-owner@vger.kernel.org List-ID: Hi Sascha, On Thursday 22 November 2012 07:20:00 Sascha Hauer wrote: > On Wed, Nov 21, 2012 at 11:02:44PM +0100, Laurent Pinchart wrote: > > Hi Steffen, > > > > > + > > > + htotal = vm->hactive + vm->hfront_porch + vm->hback_porch + > > > + vm->hsync_len; > > > + vtotal = vm->vactive + vm->vfront_porch + vm->vback_porch + > > > + vm->vsync_len; > > > + fbmode->refresh = (vm->pixelclock * 1000) / (htotal * vtotal); > > > > This will fail if vm->pixelclock >= ((1 << 32) / 1000). The easiest > > solution is probably to use 64-bit computation. > > You have displays with a pixelclock > 4GHz? vm->pixelclock is expressed in Hz. vm->pixelclock * 1000 will thus overflow if the clock frequency is >= ~4.3 MHz. I have displays with a clock frequency higher than that :-) -- Regards, Laurent Pinchart