From 8570a6e494f45700fb4ee52aa175a04def76d9aa Mon Sep 17 00:00:00 2001 From: Paulo Cesar Pereira de Andrade Date: Sat, 15 Mar 2008 22:09:44 -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 | 26 ++++++++++++++++---------- 7 files changed, 28 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 e33f914..1d4ed92 100644 --- a/src/mga_dac3026.c +++ b/src/mga_dac3026.c @@ -872,7 +872,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 1a6a565..7cff93e 100644 --- a/src/mga_dacG.c +++ b/src/mga_dacG.c @@ -961,9 +961,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); @@ -972,7 +972,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 c5d27ef..6ec579d 100644 --- a/src/mga_driver.c +++ b/src/mga_driver.c @@ -138,7 +138,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 /* */ @@ -2802,8 +2802,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..56b9fb9 100644 --- a/src/mga_vga.c +++ b/src/mga_vga.c @@ -11,6 +11,8 @@ #include "mga.h" #include "mga_reg.h" +#include "unistd.h" + #define TEXT_AMOUNT 16384 #define FONT_AMOUNT (8*8192) diff --git a/src/mga_video.c b/src/mga_video.c index a2d7979..02e3380 100644 --- a/src/mga_video.c +++ b/src/mga_video.c @@ -596,15 +596,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; @@ -1382,6 +1382,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) { @@ -1401,7 +1402,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, @@ -1474,13 +1475,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; @@ -1512,6 +1514,7 @@ static void CopyMungedScanlineFilterDown_AXP(CARD32 *fb_ptr, short src_w, fb_ptr+=4; } } +#endif static void MGACopyScaledILOAD( ScrnInfoPtr pScrn, @@ -1809,7 +1812,10 @@ static void MGACopyILOAD( CARD32 *fb_ptr; CARD8 *ubuf, *vbuf; CARD32 *pu, *pv; - int k,l; + int l; +#ifdef CUSTOM_MEMCOPY + int k; +#endif short clip_x1, clip_x2, tmp_w; #ifdef DEBUG_MGA2164 -- 1.5.3.2