From mboxrd@z Thu Jan 1 00:00:00 1970 From: J L Subject: Re: [PATCH 1/1] drm/mgag200: Added resolution and bandwidth limits for various G200e products. Date: Wed, 19 Jun 2013 10:56:39 -0400 Message-ID: <51C1C6A7.4050402@matrox.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from mtxmxout7.matrox.com (mtxmxout9.matrox.com [138.11.2.99]) by gabe.freedesktop.org (Postfix) with ESMTP id 66302E6234 for ; Wed, 19 Jun 2013 08:21:15 -0700 (PDT) Received: from venus.matrox.com (venus.matrox.com [192.168.1.30]) by mtxmxout7.matrox.com (Postfix) with ESMTP id C65C91C6DAA for ; Wed, 19 Jun 2013 10:57:01 -0400 (EDT) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: dri-devel@lists.freedesktop.org Cc: Mathieu Larouche List-Id: dri-devel@lists.freedesktop.org On 13-06-17 09:19 AM, Julia Lemire wrote: > +static uint32_t mga_vga_calculate_mode_bandwidth(struct drm_display_mode * mode, > + int bits_per_pixel) > +{ > + uint64_t active_area, total_area, pixels_per_second; > + uint64_t bytes_per_pixel = (bits_per_pixel + 7) / 8; > + > + if(!mode->htotal || !mode->vtotal || !mode->clock) > + return 0; > + > + active_area = mode->hdisplay * mode->vdisplay; > + total_area = mode->htotal * mode->vtotal; > + pixels_per_second = active_area * mode->clock * 1000 / total_area; > + return (uint32_t)(pixels_per_second * bytes_per_pixel * 100 / (1024)); > +} I found a bug while testing this on a 32-bit machine linked to the 64-bit division. Sorry. -- Julia Lemire Jr. Eng./Ing. Software Designer Matrox Graphics Inc. Phone : 514 822-6000 x7010 Email :julia.lemire@matrox.com