[PATCH video-mga] xf86-video-mga: Fix-to-always-set-HiPri-for-G200e4

Stefan Dirsch sndirsch at suse.de
Tue Jun 13 15:56:01 UTC 2017


On Mon, Jun 12, 2017 at 04:08:42PM -0400, mathieu.larouche at matrox.com wrote:
> From: Mathieu Larouche <mathieu.larouche at matrox.com>
> 
>   - Changed the HiPri value for G200e4 to always be 0.
>   - Added Bandwith limitation to block resolution above 1920x1200x60Hz
> ---
>  src/mga_driver.c | 43 ++++++++++++++++++++++++++-----------------
>  1 file changed, 26 insertions(+), 17 deletions(-)
> 
> diff --git a/src/mga_driver.c b/src/mga_driver.c
> index 79c6da7..615518a 100644
> --- a/src/mga_driver.c
> +++ b/src/mga_driver.c
> @@ -2969,14 +2969,21 @@ MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
>              }
>  
>              
> -            ulMemoryBandwidth = (mode->Clock * ulBitsPerPixel) / 1000;
> -
> -            if      (ulMemoryBandwidth    > 3100)  ucHiPriLvl = 0;
> -            else if (ulMemoryBandwidth    > 2600)  ucHiPriLvl = 1;
> -            else if (ulMemoryBandwidth    > 1900)  ucHiPriLvl = 2;
> -            else if (ulMemoryBandwidth    > 1160)  ucHiPriLvl = 3;
> -            else if (ulMemoryBandwidth    > 440)   ucHiPriLvl = 4;
> -            else ucHiPriLvl = 5;
> +            if (pMga->reg_1e24 >= 0x04)
> +            {
> +                ucHiPriLvl = 0;
> +            }
> +            else
> +            {
> +                 ulMemoryBandwidth = (mode->Clock * ulBitsPerPixel) / 1000;
> +
> +                if      (ulMemoryBandwidth    > 3100)  ucHiPriLvl = 0;
> +                else if (ulMemoryBandwidth    > 2600)  ucHiPriLvl = 1;
> +                else if (ulMemoryBandwidth    > 1900)  ucHiPriLvl = 2;
> +                else if (ulMemoryBandwidth    > 1160)  ucHiPriLvl = 3;
> +                else if (ulMemoryBandwidth    > 440)   ucHiPriLvl = 4;
> +                else ucHiPriLvl = 5;
> +            }

mga_driver.c:3373: warning: 'ulMemoryBandwidth' may be used uninitialized in
this function

That's because for G200e4 it's no longer initialized, but later still
referenced.

xf86DrvMsg(pScrn->scrnIndex, X_INFO, "MemoryBandwidth == %d\n",
ulMemoryBandwidth);

Either initialize it or no longer reference it on G200e4. ;-)

Thanks,
Stefan

Public Key available
------------------------------------------------------
Stefan Dirsch (Res. & Dev.)   SUSE LINUX GmbH
Tel: 0911-740 53 0            Maxfeldstraße 5
FAX: 0911-740 53 479          D-90409 Nürnberg
http://www.suse.de            Germany 
---------------------------------------------------------------
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham
Norton, HRB 21284 (AG Nürnberg)
---------------------------------------------------------------


More information about the xorg-devel mailing list