From 34454ae95517d7d44175152893ea8d791d786445 Mon Sep 17 00:00:00 2001 From: Paulo Cesar Pereira de Andrade Date: Sat, 12 Apr 2008 22:36:57 -0300 Subject: [PATCH] Compile warning fixes. Cast types and removed/disable unused variables/functions. Also some minor changes to avoid warnings about mixed declarations and code, i.e. move declarations to block of code that actually use it, and don't add an ending semicollon to a macro that declares a local variable, as another semicollon was added when the macro was used. --- src/mga_bios.c | 2 +- src/mga_dac3026.c | 2 +- src/mga_dacG.c | 6 +++--- src/mga_driver.c | 6 +++--- src/mga_exa.c | 4 ++-- src/mga_vga.c | 2 ++ src/mga_video.c | 25 +++++++++++++++---------- 7 files changed, 27 insertions(+), 20 deletions(-) diff --git a/src/mga_bios.c b/src/mga_bios.c index 63c7b5e..5c5acbc 100644 --- a/src/mga_bios.c +++ b/src/mga_bios.c @@ -419,8 +419,8 @@ Bool mga_read_and_process_bios( ScrnInfoPtr pScrn ) MGAPtr pMga = MGAPTR(pScrn); #ifndef XSERVER_LIBPCIACCESS Bool pciBIOS = TRUE; -#endif int rlen; +#endif static const unsigned expected_length[] = { 0, 64, 64, 64, 128, 128 }; unsigned version; unsigned pins_len; diff --git a/src/mga_dac3026.c b/src/mga_dac3026.c index 44dd166..d7a2d53 100644 --- a/src/mga_dac3026.c +++ b/src/mga_dac3026.c @@ -864,7 +864,7 @@ MGA3026Save(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg, mgaReg->DacRegs[i] = inTi3026(MGADACregs[i]); #ifdef XSERVER_LIBPCIACCESS - pci_device_cfg_read_u32(pMga->PciInfo, & mgaReg->Option, + pci_device_cfg_read_u32(pMga->PciInfo, (uint32_t *)&mgaReg->Option, PCI_OPTION_REG); #else mgaReg->Option = pciReadLong(pMga->PciTag, PCI_OPTION_REG); diff --git a/src/mga_dacG.c b/src/mga_dacG.c index 123c76b..71bd797 100644 --- a/src/mga_dacG.c +++ b/src/mga_dacG.c @@ -953,9 +953,9 @@ MGAGSave(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg, mgaReg->PIXPLLCSaved = TRUE; #ifdef XSERVER_LIBPCIACCESS - pci_device_cfg_read_u32(pMga->PciInfo, & mgaReg->Option, + pci_device_cfg_read_u32(pMga->PciInfo, (uint32_t *)&mgaReg->Option, PCI_OPTION_REG); - pci_device_cfg_read_u32(pMga->PciInfo, & mgaReg->Option2, + pci_device_cfg_read_u32(pMga->PciInfo, (uint32_t *)&mgaReg->Option2, PCI_MGA_OPTION2); #else mgaReg->Option = pciReadLong(pMga->PciTag, PCI_OPTION_REG); @@ -964,7 +964,7 @@ MGAGSave(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg, #endif if (pMga->Chipset == PCI_CHIP_MGAG400 || pMga->Chipset == PCI_CHIP_MGAG550) #ifdef XSERVER_LIBPCIACCESS - pci_device_cfg_read_u32(pMga->PciInfo, & mgaReg->Option3, + pci_device_cfg_read_u32(pMga->PciInfo, (uint32_t *)&mgaReg->Option3, PCI_MGA_OPTION3); #else mgaReg->Option3 = pciReadLong(pMga->PciTag, PCI_MGA_OPTION3); diff --git a/src/mga_driver.c b/src/mga_driver.c index 5757ccb..1b8723b 100644 --- a/src/mga_driver.c +++ b/src/mga_driver.c @@ -136,7 +136,7 @@ static void MGAFreeScreen(int scrnIndex, int flags); static ModeStatus MGAValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags); -#if ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ >= 4) +#if defined(DEBUG) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ >= 4)) #define __must_check __attribute__((warn_unused_result)) #else #define __must_check /* */ @@ -2770,8 +2770,8 @@ MGAMapMem(ScrnInfoPtr pScrn) if (!pMga->FBDev) { #ifdef XSERVER_LIBPCIACCESS - memory[pMga->io_bar] = &pMga->IOBase; - memory[pMga->framebuffer_bar] = &pMga->FbBase; + memory[pMga->io_bar] = (void **)&pMga->IOBase; + memory[pMga->framebuffer_bar] = (void **)&pMga->FbBase; for (i = 0; i < 2; i++) { region = &dev->regions[i]; diff --git a/src/mga_exa.c b/src/mga_exa.c index 9321452..32dc1e0 100644 --- a/src/mga_exa.c +++ b/src/mga_exa.c @@ -54,7 +54,7 @@ #endif #define PMGA(x) \ - MGAPtr pMga = xf86Screens[x->drawable.pScreen->myNum]->driverPrivate; + MGAPtr pMga = xf86Screens[x->drawable.pScreen->myNum]->driverPrivate #define QUIESCE_DMA(x) \ CHECK_DMA_QUIESCENT(pMga, xf86Screens[x->drawable.pScreen->myNum]); @@ -860,7 +860,7 @@ mgaExaInit(ScreenPtr pScreen) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "X %d Y %d bpp %d\n", pScrn->virtualX, pScrn->virtualY, pScrn->bitsPerPixel); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Start at %p, size %x, osb %x\n", + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Start at %p, size %lx, osb %lx\n", pExa->memoryBase, pExa->memorySize, pExa->offScreenBase); /* In PW24 mode, we need to align to "3 64-bytes" */ diff --git a/src/mga_vga.c b/src/mga_vga.c index 9f00b3d..392e995 100644 --- a/src/mga_vga.c +++ b/src/mga_vga.c @@ -2,6 +2,8 @@ #include "config.h" #endif +#include + #include "misc.h" #include "xf86.h" #include "xf86_OSproc.h" diff --git a/src/mga_video.c b/src/mga_video.c index 0ef4497..692264e 100644 --- a/src/mga_video.c +++ b/src/mga_video.c @@ -594,15 +594,15 @@ MGAAllocateMemory( } #endif /* USE_EXA */ #ifdef USE_XAA - FBLinearPtr linear = *mem_struct; - int cpp = pMga->CurrentLayout.bitsPerPixel / 8; + if (!pMga->Exa) { + FBLinearPtr linear = *mem_struct; + int cpp = pMga->CurrentLayout.bitsPerPixel / 8; - /* XAA allocates in units of pixels at the screen bpp, so adjust size - * appropriately. - */ - size = (size + cpp - 1) / cpp; + /* XAA allocates in units of pixels at the screen bpp, so adjust size + * appropriately. + */ + size = (size + cpp - 1) / cpp; - if (!pMga->Exa) { if (linear) { if (linear->size >= size) return linear->offset * cpp; @@ -1375,6 +1375,7 @@ static void CopyMungedScanline_AXP(CARD32 *fb_ptr, short src_w, } } +#if 0 static void CopyMungedScanline_AXP2(CARD32 *fb_ptr, short src_w, CARD32 *tsp, CARD32 *tpu, CARD32 *tpv) { @@ -1394,7 +1395,7 @@ static void CopyMungedScanline_AXP2(CARD32 *fb_ptr, short src_w, fb_ptr+=4; } } - +#endif static void CopyMungedScanlineFilter_AXP(CARD32 *fb_ptr, short src_w, CARD32 *tsp1, CARD32 *tpu1, CARD32 *tpv1, @@ -1467,13 +1468,14 @@ static void CopyMungedScanlineFilter_AXP(CARD32 *fb_ptr, short src_w, } } +#if 0 static void CopyMungedScanlineFilterDown_AXP(CARD32 *fb_ptr, short src_w, CARD32 *tsp1, CARD32 *tpu1, CARD32 *tpv1, CARD32 *tsp2, CARD32 *tpu2, CARD32 *tpv2, int beta , int xds) { unsigned int k,y0_1,y1_1,y0_2,y1_2,u,v; - int yf[8], uf[4], vf[4]; + int yf[8]; for(k=src_w/8;k;k--) { y0_1=*tsp1; @@ -1505,6 +1507,7 @@ static void CopyMungedScanlineFilterDown_AXP(CARD32 *fb_ptr, short src_w, fb_ptr+=4; } } +#endif static void MGACopyScaledILOAD( ScrnInfoPtr pScrn, @@ -1802,7 +1805,7 @@ static void MGACopyILOAD( CARD32 *fb_ptr; CARD8 *ubuf, *vbuf; CARD32 *pu, *pv; - int k,l; + int l; short clip_x1, clip_x2, tmp_w; #ifdef DEBUG_MGA2164 @@ -1934,6 +1937,8 @@ static void MGACopyILOAD( fb_ptr+=src_w*2; #else CARD32 *tsp=(CARD32 *)(buf+src_x*2); + int k; + WAITFIFO(pMga->FifoSize/4); for(k=src_w/8;k;k--) { *(fb_ptr)=*(tsp); -- 1.5.3.2