diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/regsmi.h | 12 | ||||
-rw-r--r-- | src/smi.h | 33 | ||||
-rw-r--r-- | src/smi_accel.c | 23 | ||||
-rw-r--r-- | src/smi_dac.c | 6 | ||||
-rw-r--r-- | src/smi_dga.c | 41 | ||||
-rw-r--r-- | src/smi_driver.c | 366 | ||||
-rw-r--r-- | src/smi_exa.c | 89 | ||||
-rw-r--r-- | src/smi_hwcurs.c | 54 | ||||
-rw-r--r-- | src/smi_i2c.c | 27 | ||||
-rw-r--r-- | src/smi_shadow.c | 14 | ||||
-rw-r--r-- | src/smi_video.c | 341 | ||||
-rw-r--r-- | src/smi_xaa.c | 104 |
12 files changed, 468 insertions, 642 deletions
diff --git a/src/regsmi.h b/src/regsmi.h index 209622c..7d0d6f6 100644 --- a/src/regsmi.h +++ b/src/regsmi.h @@ -106,17 +106,17 @@ VGAOUT8(SMIPtr pSmi, int port, CARD8 data) #define IN_SEQ(pSmi, index) \ VGAIN8_INDEX((pSmi), VGA_SEQ_INDEX, VGA_SEQ_DATA, (index)) -#define WRITE_DPR(pSmi, dpr, data) MMIO_OUT32(pSmi->DPRBase, dpr, data); DEBUG((VERBLEV, "DPR%02X = %08X\n", dpr, data)) +#define WRITE_DPR(pSmi, dpr, data) MMIO_OUT32(pSmi->DPRBase, dpr, data); DEBUG("DPR%02X = %08X\n", dpr, data) #define READ_DPR(pSmi, dpr) MMIO_IN32(pSmi->DPRBase, dpr) -#define WRITE_VPR(pSmi, vpr, data) MMIO_OUT32(pSmi->VPRBase, vpr, data); DEBUG((VERBLEV, "VPR%02X = %08X\n", vpr, data)) +#define WRITE_VPR(pSmi, vpr, data) MMIO_OUT32(pSmi->VPRBase, vpr, data); DEBUG("VPR%02X = %08X\n", vpr, data) #define READ_VPR(pSmi, vpr) MMIO_IN32(pSmi->VPRBase, vpr) -#define WRITE_CPR(pSmi, cpr, data) MMIO_OUT32(pSmi->CPRBase, cpr, data); DEBUG((VERBLEV, "CPR%02X = %08X\n", cpr, data)) +#define WRITE_CPR(pSmi, cpr, data) MMIO_OUT32(pSmi->CPRBase, cpr, data); DEBUG("CPR%02X = %08X\n", cpr, data) #define READ_CPR(pSmi, cpr) MMIO_IN32(pSmi->CPRBase, cpr) -#define WRITE_FPR(pSmi, fpr, data) MMIO_OUT32(pSmi->FPRBase, fpr, data); DEBUG((VERBLEV, "FPR%02X = %08X\n", fpr, data)) +#define WRITE_FPR(pSmi, fpr, data) MMIO_OUT32(pSmi->FPRBase, fpr, data); DEBUG("FPR%02X = %08X\n", fpr, data) #define READ_FPR(pSmi, fpr) MMIO_IN32(pSmi->FPRBase, fpr) -#define WRITE_DCR(pSmi, dcr, data) MMIO_OUT32(pSmi->DCRBase, dcr, data); DEBUG((VERBLEV, "DCR%02X = %08X\n", dcr, data)) +#define WRITE_DCR(pSmi, dcr, data) MMIO_OUT32(pSmi->DCRBase, dcr, data); DEBUG("DCR%02X = %08X\n", dcr, data) #define READ_DCR(pSmi, dcr) MMIO_IN32(pSmi->DCRBase, dcr) -#define WRITE_SCR(pSmi, scr, data) MMIO_OUT32(pSmi->SCRBase, scr, data); DEBUG((VERBLEV, "SCR%02X = %08X\n", scr, data)) +#define WRITE_SCR(pSmi, scr, data) MMIO_OUT32(pSmi->SCRBase, scr, data); DEBUG("SCR%02X = %08X\n", scr, data) #define READ_SCR(pSmi, scr) MMIO_IN32(pSmi->SCRBase, scr) #define CHECK_SECONDARY(pSmi) \ @@ -65,7 +65,7 @@ authorization from the XFree86 Project and Silicon Motion. /******************************************************************************/ #ifndef SMI_DEBUG -# define SMI_DEBUG 0 +#define SMI_DEBUG 0 #endif #define SMI_USE_IMAGE_WRITES 0 @@ -276,20 +276,25 @@ typedef struct /******************************************************************************/ #if SMI_DEBUG -# define VERBLEV 1 -# define ENTER_PROC(PROCNAME) xf86ErrorFVerb(VERBLEV, "ENTER\t" PROCNAME \ - "(%d)\n", __LINE__); xf86Break1() -# define DEBUG_PROC(PROCNAME) xf86ErrorFVerb(VERBLEV, "DEBUG\t" PROCNAME \ - "(%d)\n", __LINE__); xf86Break2() -# define LEAVE_PROC(PROCNAME) xf86ErrorFVerb(VERBLEV, "LEAVE\t" PROCNAME \ - "(%d)\n", __LINE__); xf86Break1() -# define DEBUG(arg) xf86ErrorFVerb arg +extern int smi_indent; +# define VERBLEV 1 +# define ENTER() xf86ErrorFVerb(VERBLEV, "%*c %s\n",\ + smi_indent++, '>', __FUNCTION__) +# define LEAVE() xf86ErrorFVerb(VERBLEV, "%*c %s\n",\ + --smi_indent, '<', __FUNCTION__) +# define RETURN(value) \ + do { \ + xf86ErrorFVerb(VERBLEV, "%*c %s\n", \ + --smi_indent, '<', __FUNCTION__); \ + return (value); \ + } while (0) +# define DEBUG(...) xf86ErrorFVerb(VERBLEV, __VA_ARGS__) #else -# define VERBLEV 4 -# define ENTER_PROC(PROCNAME) -# define DEBUG_PROC(PROCNAME) -# define LEAVE_PROC(PROCNAME) -# define DEBUG(arg) +# define VERBLEV 4 +# define ENTER() /**/ +# define LEAVE() /**/ +# define RETURN(value) return (value) +# define DEBUG(...) /**/ #endif /* Some Silicon Motion structs & registers */ diff --git a/src/smi_accel.c b/src/smi_accel.c index a68a28f..0862692 100644 --- a/src/smi_accel.c +++ b/src/smi_accel.c @@ -41,7 +41,7 @@ SMI_GEReset(ScrnInfoPtr pScrn, int from_timeout, int line, char *file) unsigned int iTempVal; CARD8 tmp; - ENTER_PROC("SMI_GEReset"); + ENTER(); if (from_timeout) { if (pSmi->GEResetCnt++ < 10 || xf86GetVerbosity() > 1) { @@ -67,7 +67,7 @@ SMI_GEReset(ScrnInfoPtr pScrn, int from_timeout, int line, char *file) VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x15, tmp); SMI_EngineReset(pScrn); - LEAVE_PROC("SMI_GEReset"); + LEAVE(); } /* The sync function for the GE */ @@ -76,7 +76,7 @@ SMI_AccelSync(ScrnInfoPtr pScrn) { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_AccelSync"); + ENTER(); WaitIdleEmpty(); /* #161 */ if (IS_MSOC(pSmi)) { @@ -96,7 +96,7 @@ SMI_AccelSync(ScrnInfoPtr pScrn) } } - LEAVE_PROC("SMI_AccelSync"); + LEAVE(); } void @@ -107,7 +107,7 @@ SMI_EngineReset(ScrnInfoPtr pScrn) int i; int xyAddress[] = { 320, 400, 512, 640, 800, 1024, 1280, 1600, 2048 }; - ENTER_PROC("SMI_EngineReset"); + ENTER(); pSmi->Stride = ((pSmi->width * pSmi->Bpp + 15) & ~15) / pSmi->Bpp; if(pScrn->bitsPerPixel==24) @@ -145,7 +145,7 @@ SMI_EngineReset(ScrnInfoPtr pScrn) SMI_DisableClipping(pScrn); - LEAVE_PROC("SMI_EngineReset"); + LEAVE(); } /******************************************************************************/ @@ -158,9 +158,8 @@ SMI_SetClippingRectangle(ScrnInfoPtr pScrn, int left, int top, int right, { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_SetClippingRectangle"); - DEBUG((VERBLEV, "left=%d top=%d right=%d bottom=%d\n", left, top, right, - bottom)); + ENTER(); + DEBUG("left=%d top=%d right=%d bottom=%d\n", left, top, right, bottom); /* CZ 26.10.2001: this code prevents offscreen pixmaps being drawn ??? left = max(left, 0); @@ -193,7 +192,7 @@ SMI_SetClippingRectangle(ScrnInfoPtr pScrn, int left, int top, int right, WRITE_DPR(pSmi, 0x2C, pSmi->ScissorsLeft); WRITE_DPR(pSmi, 0x30, pSmi->ScissorsRight); - LEAVE_PROC("SMI_SetClippingRectangle"); + LEAVE(); } void @@ -201,7 +200,7 @@ SMI_DisableClipping(ScrnInfoPtr pScrn) { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_DisableClipping"); + ENTER(); pSmi->ScissorsLeft = 0; if (pScrn->bitsPerPixel == 24) { @@ -220,7 +219,7 @@ SMI_DisableClipping(ScrnInfoPtr pScrn) WRITE_DPR(pSmi, 0x2C, pSmi->ScissorsLeft); WRITE_DPR(pSmi, 0x30, pSmi->ScissorsRight); - LEAVE_PROC("SMI_DisableClipping"); + LEAVE(); } CARD32 diff --git a/src/smi_dac.c b/src/smi_dac.c index a5cfd77..f72c77e 100644 --- a/src/smi_dac.c +++ b/src/smi_dac.c @@ -87,9 +87,9 @@ SMI_CommonCalcClock(int scrnIndex, long freq, int min_m, int min_n1, } } - DEBUG((VERBLEV, "Clock parameters for %1.6f MHz: m=%d, n1=%d, n2=%d\n", - ((double)(best_m) / (double)(best_n1) / (1 << best_n2)) * BASE_FREQ, - best_m, best_n1, best_n2)); + DEBUG("Clock parameters for %1.6f MHz: m=%d, n1=%d, n2=%d\n", + ((double)(best_m) / (double)(best_n1) / (1 << best_n2)) * BASE_FREQ, + best_m, best_n1, best_n2); if (SMI_LYNX_SERIES(pSmi->Chipset)) { *ndiv = best_n1 | (best_n2 << 6); diff --git a/src/smi_dga.c b/src/smi_dga.c index a51b0b1..32e6824 100644 --- a/src/smi_dga.c +++ b/src/smi_dga.c @@ -76,7 +76,7 @@ SMI_DGAInit(ScreenPtr pScreen) int num = 0; Bool ret; - ENTER_PROC("SMI_DGAInit"); + ENTER(); pMode = firstMode = pScrn->modes; @@ -84,8 +84,7 @@ SMI_DGAInit(ScreenPtr pScreen) newmodes = xrealloc(modes, (num + 1) * sizeof(DGAModeRec)); if (newmodes == NULL) { xfree(modes); - LEAVE_PROC("SMI_DGAInit"); - return FALSE; + RETURN(FALSE); } modes = newmodes; @@ -144,8 +143,8 @@ SMI_DGAInit(ScreenPtr pScreen) pSmi->DGAModes = modes; ret = DGAInit(pScreen, &SMI_DGAFuncs, modes, num); - LEAVE_PROC("SMI_DGAInit"); - return ret; + + RETURN(ret); } static Bool @@ -155,7 +154,7 @@ SMI_SetMode(ScrnInfoPtr pScrn, DGAModePtr pMode) int index = pScrn->pScreen->myNum; SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_SetMode"); + ENTER(); if (pMode == NULL) { /* restore the original mode */ @@ -178,8 +177,7 @@ SMI_SetMode(ScrnInfoPtr pScrn, DGAModePtr pMode) SMI_SwitchMode(index, pMode->mode, 0); } - LEAVE_PROC("SMI_SetMode"); - return TRUE; + RETURN(TRUE); } @@ -188,11 +186,9 @@ SMI_GetViewport(ScrnInfoPtr pScrn) { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_GetViewport"); - - LEAVE_PROC("SMI_GetViewport"); + ENTER(); - return pSmi->DGAViewportStatus; + RETURN(pSmi->DGAViewportStatus); } static void @@ -200,12 +196,12 @@ SMI_SetViewport(ScrnInfoPtr pScrn, int x, int y, int flags) { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_SetViewport"); + ENTER(); SMI_AdjustFrame(pScrn->pScreen->myNum, x, y, flags); pSmi->DGAViewportStatus = 0; - LEAVE_PROC("SMI_SetViewport"); + LEAVE(); } static void @@ -213,7 +209,7 @@ SMI_FillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned long color) { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_FillRect"); + ENTER(); if (pSmi->XAAInfoRec) { (*pSmi->XAAInfoRec->SetupForSolidFill)(pScrn, color, GXcopy, ~0); @@ -221,7 +217,7 @@ SMI_FillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned long color) SET_SYNC_FLAG(pSmi->XAAInfoRec); } - LEAVE_PROC("SMI_FillRect"); + LEAVE(); } static void @@ -230,7 +226,7 @@ SMI_BlitRect(ScrnInfoPtr pScrn, int srcx, int srcy, int w, int h, int dstx, { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_BlitRect"); + ENTER(); if (pSmi->XAAInfoRec) { int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; @@ -241,7 +237,7 @@ SMI_BlitRect(ScrnInfoPtr pScrn, int srcx, int srcy, int w, int h, int dstx, SET_SYNC_FLAG(pSmi->XAAInfoRec); } - LEAVE_PROC("SMI_BlitRect"); + LEAVE(); } static void @@ -250,7 +246,7 @@ SMI_BlitTransRect(ScrnInfoPtr pScrn, int srcx, int srcy, int w, int h, int dstx, { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_BlitTraneRect"); + ENTER(); if (pSmi->XAAInfoRec) { int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; @@ -261,7 +257,7 @@ SMI_BlitTransRect(ScrnInfoPtr pScrn, int srcx, int srcy, int w, int h, int dstx, SET_SYNC_FLAG(pSmi->XAAInfoRec); } - LEAVE_PROC("SMI_BlitTraneRect"); + LEAVE(); } static Bool @@ -270,7 +266,7 @@ SMI_OpenFramebuffer(ScrnInfoPtr pScrn, char **name, unsigned char **mem, { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_OpenFrameBuffer"); + ENTER(); *name = NULL; /* no special device */ *mem = (unsigned char*)pSmi->FBBase; @@ -278,7 +274,6 @@ SMI_OpenFramebuffer(ScrnInfoPtr pScrn, char **name, unsigned char **mem, *offset = 0; *flags = DGA_NEED_ROOT; - LEAVE_PROC("SMI_OpenFrameBuffer"); - return TRUE; + RETURN(TRUE); } diff --git a/src/smi_driver.c b/src/smi_driver.c index c32e248..e469fc2 100644 --- a/src/smi_driver.c +++ b/src/smi_driver.c @@ -100,6 +100,10 @@ static Bool SMI_DriverFunc(ScrnInfoPtr pScrn , xorgDriverFuncOp op,pointer ptr); (SILICONMOTION_VERSION_MINOR << 16) | \ (SILICONMOTION_PATCHLEVEL)) +#if SMI_DEBUG +int smi_indent = 1; +#endif + /* for dualhead */ int gSMIEntityIndex = -1; @@ -391,7 +395,7 @@ siliconmotionSetup(pointer module, pointer opts, int *errmaj, int *errmin) static Bool SMI_GetRec(ScrnInfoPtr pScrn) { - ENTER_PROC("SMI_GetRec"); + ENTER(); /* * Allocate an 'Chip'Rec, and hook it into pScrn->driverPrivate. @@ -402,8 +406,7 @@ SMI_GetRec(ScrnInfoPtr pScrn) pScrn->driverPrivate = xnfcalloc(sizeof(SMIRec), 1); } - LEAVE_PROC("SMI_GetRec"); - return TRUE; + RETURN(TRUE); } static void @@ -411,7 +414,7 @@ SMI_FreeRec(ScrnInfoPtr pScrn) { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_FreeRec"); + ENTER(); if (pScrn->driverPrivate != NULL) { xfree(pScrn->driverPrivate); @@ -428,27 +431,27 @@ SMI_FreeRec(ScrnInfoPtr pScrn) pSmi->mode = NULL; } - LEAVE_PROC("SMI_FreeRec"); + LEAVE(); } static const OptionInfoRec * SMI_AvailableOptions(int chipid, int busid) { - ENTER_PROC("SMI_AvailableOptions"); - LEAVE_PROC("SMI_AvailableOptions"); - return SMIOptions; + ENTER(); + + RETURN(SMIOptions); } static void SMI_Identify(int flags) { - ENTER_PROC("SMI_Identify"); + ENTER(); xf86PrintChipsets(SILICONMOTION_NAME, "driver (version " SILICONMOTION_VERSION_NAME ") for Silicon Motion Lynx chipsets", SMIChipsets); - LEAVE_PROC("SMI_Identify"); + LEAVE(); } static Bool @@ -461,21 +464,17 @@ SMI_Probe(DriverPtr drv, int flags) int numUsed; Bool foundScreen = FALSE; - ENTER_PROC("SMI_Probe"); + ENTER(); numDevSections = xf86MatchDevice(SILICONMOTION_DRIVER_NAME, &devSections); - if (numDevSections <= 0) { + if (numDevSections <= 0) /* There's no matching device section in the config file, so quit now. */ - LEAVE_PROC("SMI_Probe"); - return FALSE; - } + RETURN(FALSE); #ifndef XSERVER_LIBPCIACCESS - if (xf86GetPciVideoInfo() == NULL) { - LEAVE_PROC("SMI_Probe"); - return FALSE; - } + if (xf86GetPciVideoInfo() == NULL) + RETURN(FALSE); #endif numUsed = xf86MatchPciInstances(SILICONMOTION_NAME, PCI_SMI_VENDOR_ID, @@ -484,10 +483,8 @@ SMI_Probe(DriverPtr drv, int flags) /* Free it since we don't need that list after this */ xfree(devSections); - if (numUsed <= 0) { - LEAVE_PROC("SMI_Probe"); - return FALSE; - } + if (numUsed <= 0) + RETURN(FALSE); if (flags & PROBE_DETECT) foundScreen = TRUE; @@ -527,8 +524,7 @@ SMI_Probe(DriverPtr drv, int flags) } xfree(usedChips); - LEAVE_PROC("SMI_Probe"); - return foundScreen; + RETURN(foundScreen); } static Bool @@ -544,21 +540,17 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags) int vgaCRIndex, vgaIOBase; vbeInfoPtr pVbe = NULL; - ENTER_PROC("SMI_PreInit"); + ENTER(); /* Ignoring the Type list for now. It might be needed when multiple cards * are supported. */ - if (pScrn->numEntities > 1) { - LEAVE_PROC("SMI_PreInit"); - return FALSE; - } + if (pScrn->numEntities > 1) + RETURN(FALSE); /* Allocate the SMIRec driverPrivate */ - if (!SMI_GetRec(pScrn)) { - LEAVE_PROC("SMI_PreInit"); - return FALSE; - } + if (!SMI_GetRec(pScrn)) + RETURN(FALSE); pSmi = SMIPTR(pScrn); /* Find the PCI slot for this screen */ @@ -583,15 +575,13 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags) if (flags & PROBE_DETECT) { if (!IS_MSOC(pSmi)) SMI_ProbeDDC(pScrn, xf86GetEntityInfo(pScrn->entityList[0])->index); - LEAVE_PROC("SMI_PreInit"); - return TRUE; + RETURN(TRUE); } if (pEnt->location.type != BUS_PCI || pEnt->resources) { xfree(pEnt); SMI_FreeRec(pScrn); - LEAVE_PROC("SMI_PreInit"); - return FALSE; + RETURN(FALSE); } pSmi->pEnt = pEnt; pSmi->PciInfo = xf86GetPciInfoForEntity(pEnt->index); @@ -601,37 +591,30 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags) if (!IS_MSOC(pSmi)) { /* The vgahw module should be loaded here when needed */ - if (!xf86LoadSubModule(pScrn, "vgahw")) { - LEAVE_PROC("SMI_PreInit"); - return FALSE; - } + if (!xf86LoadSubModule(pScrn, "vgahw")) + RETURN(FALSE); xf86LoaderReqSymLists(vgahwSymbols, NULL); /* * Allocate a vgaHWRec */ - if (!vgaHWGetHWRec(pScrn)) { - LEAVE_PROC("SMI_PreInit"); - return FALSE; - } + if (!vgaHWGetHWRec(pScrn)) + RETURN(FALSE); } /* * The first thing we should figure out is the depth, bpp, etc. */ - if (!xf86SetDepthBpp(pScrn, 0, 0, 0, Support32bppFb)) { - LEAVE_PROC("SMI_PreInit"); - return FALSE; - } + if (!xf86SetDepthBpp(pScrn, 0, 0, 0, Support32bppFb)) + RETURN(FALSE); /* Check that the returned depth is one we support */ if (pScrn->depth != 8 && pScrn->depth != 16 && pScrn->depth != 24) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Given depth (%d) is not supported by this driver\n", pScrn->depth); - LEAVE_PROC("SMI_PreInit"); - return FALSE; + RETURN(FALSE); } xf86PrintDepthBpp(pScrn); @@ -649,24 +632,19 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags) rgb masks = {0, 0, 0}; #endif - if (!xf86SetWeight(pScrn, zeros, masks)) { - LEAVE_PROC("SMI_PreInit"); - return FALSE; - } + if (!xf86SetWeight(pScrn, zeros, masks)) + RETURN(FALSE); } - if (!xf86SetDefaultVisual(pScrn, -1)) { - LEAVE_PROC("SMI_PreInit"); - return FALSE; - } + if (!xf86SetDefaultVisual(pScrn, -1)) + RETURN(FALSE); /* We don't currently support DirectColor at > 8bpp */ if (pScrn->depth > 8 && pScrn->defaultVisual != TrueColor) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Given default visual (%s) " "is not supported at depth %d\n", xf86GetVisualName(pScrn->defaultVisual), pScrn->depth); - LEAVE_PROC("SMI_PreInit"); - return FALSE; + RETURN(FALSE); } /* We use a programmable clock */ @@ -681,7 +659,8 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags) /* Process the options */ if (!(pSmi->Options = xalloc(sizeof(SMIOptions)))) - return FALSE; + RETURN(FALSE); + memcpy(pSmi->Options, SMIOptions, sizeof(SMIOptions)); xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pSmi->Options); @@ -904,15 +883,13 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags) if (pScrn->chipset == NULL) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ChipID 0x%04X is not " "recognised\n", pSmi->Chipset); - LEAVE_PROC("SMI_PreInit"); - return FALSE; + RETURN(FALSE); } if (pSmi->Chipset < 0) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Chipset \"%s\" is not " "recognised\n", pScrn->chipset); - LEAVE_PROC("SMI_PreInit"); - return FALSE; + RETURN(FALSE); } xf86DrvMsg(pScrn->scrnIndex, from, "Chipset: \"%s\"\n", pScrn->chipset); @@ -956,7 +933,7 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags) if (pScrn->bitsPerPixel != 16) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Dualhead only supported at " "depth 16\n"); - return FALSE; + RETURN(FALSE); } } @@ -1030,10 +1007,9 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags) Gamma zeros = { 0.0, 0.0, 0.0 }; if (!xf86SetGamma(pScrn, zeros)) { - LEAVE_PROC("SMI_PreInit"); SMI_EnableVideo(pScrn); SMI_UnmapMem(pScrn); - return FALSE; + RETURN(FALSE); } } @@ -1090,8 +1066,7 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags) if (i == -1) { SMI_FreeRec(pScrn); - LEAVE_PROC("SMI_PreInit"); - return FALSE; + RETURN(FALSE); } /* Prune the modes marked as invalid */ @@ -1100,8 +1075,7 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags) if (i == 0 || pScrn->modes == NULL) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n"); SMI_FreeRec(pScrn); - LEAVE_PROC("SMI_PreInit"); - return FALSE; + RETURN(FALSE); } xf86SetCrtcForModes(pScrn, 0); @@ -1116,8 +1090,7 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags) if (xf86LoadSubModule(pScrn, "fb") == NULL) { SMI_FreeRec(pScrn); - LEAVE_PROC("SMI_PreInit"); - return FALSE; + RETURN(FALSE); } if (!pSmi->NoAccel) { @@ -1146,8 +1119,7 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags) if (!pSmi->useEXA) { if (!xf86LoadSubModule(pScrn, "xaa")) { SMI_FreeRec(pScrn); - LEAVE_PROC("SMI_PreInit"); - return FALSE; + RETURN(FALSE); } xf86LoaderReqSymLists(xaaSymbols, NULL); } else { @@ -1162,8 +1134,7 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags) &req, &errmaj, &errmin)) { LoaderErrorMsg(NULL, "exa", errmaj, errmin); SMI_FreeRec(pScrn); - LEAVE_PROC("SMI_PreInit"); - return FALSE; + RETURN(FALSE); } xf86LoaderReqSymLists(exaSymbols, NULL); } @@ -1173,8 +1144,7 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags) if (pSmi->hwcursor) { if (!xf86LoadSubModule(pScrn, "ramdac")) { SMI_FreeRec(pScrn); - LEAVE_PROC("SMI_PreInit"); - return FALSE; + RETURN(FALSE); } xf86LoaderReqSymLists(ramdacSymbols, NULL); } @@ -1182,14 +1152,12 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags) if (pSmi->shadowFB) { if (!xf86LoadSubModule(pScrn, "shadowfb")) { SMI_FreeRec(pScrn); - LEAVE_PROC("SMI_PreInit"); - return FALSE; + RETURN(FALSE); } xf86LoaderReqSymLists(shadowSymbols, NULL); } - LEAVE_PROC("SMI_PreInit"); - return TRUE; + RETURN(TRUE); } /* @@ -1204,7 +1172,7 @@ SMI_EnterVT(int scrnIndex, int flags) SMIPtr pSmi = SMIPTR(pScrn); Bool ret; - ENTER_PROC("SMI_EnterVT"); + ENTER(); /* Enable MMIO and map memory */ SMI_MapMem(pScrn); @@ -1261,8 +1229,7 @@ SMI_EnterVT(int scrnIndex, int flags) if (!pSmi->NoAccel) SMI_EngineReset(pScrn); - LEAVE_PROC("SMI_EnterVT"); - return ret; + RETURN(ret); } /* @@ -1280,7 +1247,7 @@ SMI_LeaveVT(int scrnIndex, int flags) vgaHWPtr hwp = VGAHWPTR(pScrn); vgaRegPtr vgaSavePtr = &hwp->SavedReg; - ENTER_PROC("SMI_LeaveVT"); + ENTER(); /* #670 */ if (pSmi->shadowFB) { @@ -1310,7 +1277,7 @@ SMI_LeaveVT(int scrnIndex, int flags) SMI_WriteMode(pScrn, vgaSavePtr, SMISavePtr); SMI_UnmapMem(pScrn); - LEAVE_PROC("SMI_LeaveVT"); + LEAVE(); } /* @@ -1332,7 +1299,7 @@ SMI_Save(ScrnInfoPtr pScrn) int vgaCRIndex = vgaIOBase + VGA_CRTC_INDEX_OFFSET; int vgaCRData = vgaIOBase + VGA_CRTC_DATA_OFFSET; - ENTER_PROC("SMI_Save"); + ENTER(); /* Save the standard VGA registers */ vgaHWSave(pScrn, vgaSavePtr, VGA_SR_ALL); @@ -1472,7 +1439,7 @@ SMI_Save(ScrnInfoPtr pScrn) SMI_PrintRegs(pScrn); } - LEAVE_PROC("SMI_Save"); + LEAVE(); } /* @@ -1485,7 +1452,7 @@ SMI_WriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, SMIRegPtr restore) { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_WriteMode"); + ENTER(); if (!IS_MSOC(pSmi)) { int i; @@ -1698,7 +1665,7 @@ SMI_WriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, SMIRegPtr restore) vgaHWProtect(pScrn, FALSE); } - LEAVE_PROC("SMI_WriteMode"); + LEAVE(); } static void @@ -2068,12 +2035,10 @@ SMI_MapMem(ScrnInfoPtr pScrn) SMIPtr pSmi = SMIPTR(pScrn); vgaHWPtr hwp; - ENTER_PROC("SMI_MapMem"); + ENTER(); - if (pSmi->MapBase == NULL && SMI_MapMmio(pScrn) == FALSE) { - LEAVE_PROC("SMI_MapMem"); - return (FALSE); - } + if (pSmi->MapBase == NULL && SMI_MapMmio(pScrn) == FALSE) + RETURN(FALSE); pScrn->memPhysBase = PCI_REGION_BASE(pSmi->PciInfo, 0, REGION_MEM); @@ -2117,15 +2082,14 @@ SMI_MapMem(ScrnInfoPtr pScrn) result); if (err) - return FALSE; + RETURN(FALSE); } #endif if (pSmi->FBBase == NULL) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Internal error: could not map framebuffer.\n"); - LEAVE_PROC("SMI_MapMem"); - return (FALSE); + RETURN(FALSE); } xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, VERBLEV, @@ -2170,10 +2134,8 @@ SMI_MapMem(ScrnInfoPtr pScrn) /* Map the VGA memory when the primary video */ if (xf86IsPrimaryPci(pSmi->PciInfo)) { hwp->MapSize = 0x10000; - if (!vgaHWMapMem(pScrn)) { - LEAVE_PROC("SMI_MapMem"); - return FALSE; - } + if (!vgaHWMapMem(pScrn)) + RETURN(FALSE); pSmi->PrimaryVidMapped = TRUE; } } @@ -2181,8 +2143,7 @@ SMI_MapMem(ScrnInfoPtr pScrn) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Reserved: %08lX\n", (unsigned long)pSmi->FBReserved); - LEAVE_PROC("SMI_MapMem"); - return TRUE; + RETURN(TRUE); } /* UnMapMem - contains half of pre-4.0 EnterLeave function. The EnterLeave @@ -2194,7 +2155,7 @@ SMI_UnmapMem(ScrnInfoPtr pScrn) { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_UnmapMem"); + ENTER(); /* Unmap VGA mem if mapped. */ if (pSmi->PrimaryVidMapped) { @@ -2216,7 +2177,7 @@ SMI_UnmapMem(ScrnInfoPtr pScrn) pSmi->FBBase = NULL; } - LEAVE_PROC("SMI_UnmapMem"); + LEAVE(); } /* This gets called at the start of each server generation. */ @@ -2228,13 +2189,11 @@ SMI_ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) SMIPtr pSmi = SMIPTR(pScrn); EntityInfoPtr pEnt; - ENTER_PROC("SMI_ScreenInit"); + ENTER(); /* Map MMIO regs and framebuffer */ - if (!SMI_MapMem(pScrn)) { - LEAVE_PROC("SMI_ScreenInit"); - return FALSE; - } + if (!SMI_MapMem(pScrn)) + RETURN(FALSE); pEnt = xf86GetEntityInfo(pScrn->entityList[0]); @@ -2254,10 +2213,8 @@ SMI_ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pSmi->rotate=0; /* Initialize the first mode */ - if (!pSmi->ModeInit(pScrn, pScrn->currentMode)) { - LEAVE_PROC("SMI_ScreenInit"); - return FALSE; - } + if (!pSmi->ModeInit(pScrn, pScrn->currentMode)) + RETURN(FALSE); /* * The next step is to setup the screen's visuals, and initialise the @@ -2276,16 +2233,14 @@ SMI_ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) /* Setup the visuals we support. */ if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), - pScrn->rgbBits, pScrn->defaultVisual)) { - LEAVE_PROC("SMI_ScreenInit"); - return FALSE; - } - if (!miSetPixmapDepths ()) return FALSE; + pScrn->rgbBits, pScrn->defaultVisual)) + RETURN(FALSE); - if (!SMI_InternalScreenInit(scrnIndex, pScreen)) { - LEAVE_PROC("SMI_ScreenInit"); - return FALSE; - } + if (!miSetPixmapDepths ()) + RETURN(FALSE); + + if (!SMI_InternalScreenInit(scrnIndex, pScreen)) + RETURN(FALSE); xf86SetBlackWhitePixels(pScreen); @@ -2352,17 +2307,10 @@ SMI_ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) /* Initialize acceleration layer */ if (!pSmi->NoAccel) { - if (!pSmi->useEXA) { - if (!SMI_XAAInit(pScreen)) { - LEAVE_PROC("SMI_ScreenInit"); - return FALSE; - } - } else { - if (!SMI_EXAInit(pScreen)) { - LEAVE_PROC("SMI_ScreenInit"); - return FALSE; - } - } + if (!pSmi->useEXA && !SMI_XAAInit(pScreen)) + RETURN(FALSE); + else if (pSmi->useEXA && !SMI_EXAInit(pScreen)) + RETURN(FALSE); } miInitializeBackingStore(pScreen); @@ -2404,10 +2352,8 @@ SMI_ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } /* Initialise default colormap */ - if (!miCreateDefColormap(pScreen)) { - LEAVE_PROC("SMI_ScreenInit"); - return FALSE; - } + if (!miCreateDefColormap(pScreen)) + RETURN(FALSE); /* Initialize colormap layer. Must follow initialization of the default * colormap. And SetGamma call, else it will load palette with solid white. @@ -2416,10 +2362,8 @@ SMI_ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if (!xf86HandleColormaps(pScreen, 256, pScrn->rgbBits, IS_MSOC(pSmi) ? SMI501_LoadPalette : SMI_LoadPalette, NULL, CMAP_RELOAD_ON_MODE_SWITCH | - CMAP_PALETTED_TRUECOLOR)) { - LEAVE_PROC("SMI_ScreenInit"); - return FALSE; - } + CMAP_PALETTED_TRUECOLOR)) + RETURN(FALSE); pScreen->SaveScreen = SMI_SaveScreen; pSmi->CloseScreen = pScreen->CloseScreen; @@ -2441,8 +2385,7 @@ SMI_ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); } - LEAVE_PROC("SMI_ScreenInit"); - return TRUE; + RETURN(TRUE); } /* Common init routines needed in EnterVT and ScreenInit */ @@ -2457,7 +2400,7 @@ SMI_InternalScreenInit(int scrnIndex, ScreenPtr pScreen) int xDpi, yDpi; int ret; - ENTER_PROC("SMI_InternalScreenInit"); + ENTER(); if (pSmi->rotate) { width = pScrn->virtualY; @@ -2514,8 +2457,8 @@ SMI_InternalScreenInit(int scrnIndex, ScreenPtr pScreen) * pScreen fields. */ - DEBUG((VERBLEV, "\tInitializing FB @ 0x%08X for %dx%d (%d)\n", - pSmi->FBBase, width, height, pScrn->displayWidth)); + DEBUG("\tInitializing FB @ 0x%08X for %dx%d (%d)\n", + pSmi->FBBase, width, height, pScrn->displayWidth); switch (pScrn->bitsPerPixel) { case 8: case 16: @@ -2527,8 +2470,7 @@ SMI_InternalScreenInit(int scrnIndex, ScreenPtr pScreen) default: xf86DrvMsg(scrnIndex, X_ERROR, "Internal error: invalid bpp (%d) " "in SMI_InternalScreenInit\n", pScrn->bitsPerPixel); - LEAVE_PROC("SMI_InternalScreenInit"); - return FALSE; + RETURN(FALSE); } if (IS_MSOC(pSmi) && pScrn->bitsPerPixel == 8) { @@ -2542,9 +2484,8 @@ SMI_InternalScreenInit(int scrnIndex, ScreenPtr pScreen) WRITE_DCR (pSmi, DCR800 + 4, 0x00FFFFFF); /* Panel Palette */ } } - - LEAVE_PROC("SMI_InternalScreenInit"); - return ret; + + RETURN(ret); } /* Checks if a mode is suitable for the selected configuration. */ @@ -2555,7 +2496,7 @@ SMI_ValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) SMIPtr pSmi = SMIPTR(pScrn); float refresh; - ENTER_PROC("SMI_ValidMode"); + ENTER(); refresh = (mode->VRefresh > 0) ? mode->VRefresh : mode->Clock * 1000.0 / mode->VTotal / mode->HTotal; xf86DrvMsg(scrnIndex, X_INFO, "Mode: %dx%d %d-bpp, %fHz\n", mode->HDisplay, @@ -2564,18 +2505,14 @@ SMI_ValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) if (pSmi->shadowFB) { int mem; - if (pScrn->bitsPerPixel == 24) { - LEAVE_PROC("SMI_ValidMode"); - return MODE_BAD; - } + if (pScrn->bitsPerPixel == 24) + RETURN(MODE_BAD); mem = (pScrn->virtualX * pScrn->bitsPerPixel / 8 + 15) & ~15; mem *= pScrn->virtualY * 2; - if (mem > pSmi->FBReserved) /* PDR#1074 */ { - LEAVE_PROC("SMI_ValidMode"); - return MODE_MEM; - } + if (mem > pSmi->FBReserved) /* PDR#1074 */ + RETURN(MODE_MEM); } if (!(((mode->HDisplay == 1280) && (mode->VDisplay == 1024)) || @@ -2592,11 +2529,10 @@ SMI_ValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) ((mode->HDisplay == 720) && (mode->VDisplay == 480)))) { xf86DrvMsg (pScrn->scrnIndex, X_INFO, "HDisplay %d, VDisplay %d\n", mode->HDisplay, mode->VDisplay); - return (MODE_BAD_WIDTH); + RETURN(MODE_BAD_WIDTH); } - LEAVE_PROC("SMI_ValidMode"); - return MODE_OK; + RETURN(MODE_OK); } static void @@ -2659,7 +2595,7 @@ SMI_ModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) int panelIndex, modeIndex, i, vclk; unsigned char tmp; - ENTER_PROC("SMI_ModeInit"); + ENTER(); pSmi->Bpp = pScrn->bitsPerPixel / 8; if (pSmi->rotate) { @@ -2673,10 +2609,8 @@ SMI_ModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) pSmi->Stride = (pSmi->width * pSmi->Bpp + 15) & ~15; } - if (!vgaHWInit(pScrn, mode)) { - LEAVE_PROC("SMI_ModeInit"); - return FALSE; - } + if (!vgaHWInit(pScrn, mode)) + RETURN(FALSE); new->modeInit = TRUE; @@ -2903,8 +2837,7 @@ SMI_ModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) new->CCR66 = (new->CCR66 & 0xF3) | 0x04; /* Gamma correct ON */ break; default: - LEAVE_PROC("SMI_ModeInit"); - return FALSE; + RETURN(FALSE); } } #endif @@ -3121,8 +3054,7 @@ SMI_ModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) pScrn->frameY1=pScrn->frameY0 + pScrn->currentMode->VDisplay - 1; SMI_AdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); - LEAVE_PROC("SMI_ModeInit"); - return TRUE; + RETURN(TRUE); } /* @@ -3139,7 +3071,7 @@ SMI_CloseScreen(int scrnIndex, ScreenPtr pScreen) SMIPtr pSmi = SMIPTR(pScrn); Bool ret; - ENTER_PROC("SMI_CloseScreen"); + ENTER(); if (pScrn->vtSema) { if (!IS_MSOC(pSmi)) { @@ -3187,8 +3119,7 @@ SMI_CloseScreen(int scrnIndex, ScreenPtr pScreen) pScreen->CloseScreen = pSmi->CloseScreen; ret = (*pScreen->CloseScreen)(scrnIndex, pScreen); - LEAVE_PROC("SMI_CloseScreen"); - return ret; + RETURN(ret); } static void @@ -3203,12 +3134,11 @@ SMI_SaveScreen(ScreenPtr pScreen, int mode) SMIPtr pSmi = SMIPTR(xf86Screens[pScreen->myNum]); Bool ret; - ENTER_PROC("SMI_SaveScreen"); + ENTER(); ret = !IS_MSOC(pSmi) && vgaHWSaveScreen(pScreen, mode); - LEAVE_PROC("SMI_SaveScreen"); - return ret; + RETURN(ret); } void @@ -3218,7 +3148,7 @@ SMI_AdjustFrame(int scrnIndex, int x, int y, int flags) SMIPtr pSmi = SMIPTR(pScrn); CARD32 Base, lcdBase; - ENTER_PROC("SMI_AdjustFrame"); + ENTER(); if (pSmi->ShowCache && y) { y += pScrn->virtualY - 1; @@ -3277,7 +3207,7 @@ SMI_AdjustFrame(int scrnIndex, int x, int y, int flags) WRITE_FPR(pSmi, FPR0C, Base >> 3); } - LEAVE_PROC("SMI_AdjustFrame"); + LEAVE(); } Bool @@ -3286,7 +3216,7 @@ SMI_SwitchMode(int scrnIndex, DisplayModePtr mode, int flags) Bool ret; SMIPtr pSmi = SMIPTR(xf86Screens[scrnIndex]); - ENTER_PROC("SMI_SwitchMode"); + ENTER(); pSmi->IsSwitching = TRUE; ret = pSmi->ModeInit(xf86Screens[scrnIndex], mode); @@ -3294,8 +3224,7 @@ SMI_SwitchMode(int scrnIndex, DisplayModePtr mode, int flags) SMI_EngineReset(xf86Screens[scrnIndex]); pSmi->IsSwitching = FALSE; - LEAVE_PROC("SMI_SwitchMode"); - return ret; + RETURN(ret); } void @@ -3305,7 +3234,7 @@ SMI_LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies, SMIPtr pSmi = SMIPTR(pScrn); int i; - ENTER_PROC("SMI_LoadPalette"); + ENTER(); /* Enable both the CRT and LCD DAC RAM paths, so both palettes are updated */ if (pSmi->Chipset == SMI_LYNX3DM || pSmi->Chipset == SMI_COUGAR3DR) { @@ -3317,15 +3246,15 @@ SMI_LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies, } for(i = 0; i < numColors; i++) { - DEBUG((VERBLEV, "pal[%d] = %d %d %d\n", indicies[i], - colors[indicies[i]].red, colors[indicies[i]].green, colors[indicies[i]].blue)); + DEBUG("pal[%d] = %d %d %d\n", indicies[i], + colors[indicies[i]].red, colors[indicies[i]].green, colors[indicies[i]].blue); VGAOUT8(pSmi, VGA_DAC_WRITE_ADDR, indicies[i]); VGAOUT8(pSmi, VGA_DAC_DATA, colors[indicies[i]].red); VGAOUT8(pSmi, VGA_DAC_DATA, colors[indicies[i]].green); VGAOUT8(pSmi, VGA_DAC_DATA, colors[indicies[i]].blue); } - LEAVE_PROC("SMI_LoadPalette"); + LEAVE(); } static void @@ -3358,7 +3287,7 @@ SMI_EnableMmio(ScrnInfoPtr pScrn) { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_EnableMmio"); + ENTER(); if (!IS_MSOC(pSmi)) { vgaHWPtr hwp = VGAHWPTR(pScrn); @@ -3383,7 +3312,7 @@ SMI_EnableMmio(ScrnInfoPtr pScrn) outb(pSmi->PIOBase + VGA_SEQ_DATA, tmp & ~0x03); } - LEAVE_PROC("SMI_EnableMmio"); + LEAVE(); } void @@ -3391,7 +3320,7 @@ SMI_DisableMmio(ScrnInfoPtr pScrn) { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_DisableMmio"); + ENTER(); if (!IS_MSOC(pSmi)) { vgaHWPtr hwp = VGAHWPTR(pScrn); @@ -3407,7 +3336,7 @@ SMI_DisableMmio(ScrnInfoPtr pScrn) outb(pSmi->PIOBase + VGA_SEQ_DATA, pSmi->SR18Value); /* PDR#521 */ } - LEAVE_PROC("SMI_DisableMmio"); + LEAVE(); } /* This function is used to debug, it prints out the contents of Lynx regs */ @@ -3506,7 +3435,7 @@ SMI_DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, vgaHWPtr hwp = VGAHWPTR(pScrn); CARD8 SR01, SR20, SR21, SR22, SR23, SR24, SR31, SR34; - ENTER_PROC("SMI_DisplayPowerManagementSet"); + ENTER(); /* If we already are in the requested DPMS mode, just return */ if (pSmi->CurrentDPMS != PowerManagementMode) { @@ -3537,7 +3466,7 @@ SMI_DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x01, SR01 & ~0x20); } - LEAVE_PROC("SMI_DisplayPowerManagementSet"); + LEAVE(); return; } } @@ -3608,7 +3537,7 @@ SMI_DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, default: xf86ErrorFVerb(VERBLEV, "Invalid PowerManagementMode %d passed to " "SMI_DisplayPowerManagementSet\n", PowerManagementMode); - LEAVE_PROC("SMI_DisplayPowerManagementSet"); + LEAVE(); return; } @@ -3631,7 +3560,7 @@ SMI_DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, pSmi->CurrentDPMS = PowerManagementMode; } - LEAVE_PROC("SMI_DisplayPowerManagementSet"); + LEAVE(); } static void @@ -3652,15 +3581,14 @@ SMI_ddc1Read(ScrnInfoPtr pScrn) SMIPtr pSmi = SMIPTR(pScrn); unsigned int ret; - ENTER_PROC("SMI_ddc1Read"); + ENTER(); while (hwp->readST01(hwp) & 0x8) ; while (!(hwp->readST01(hwp) & 0x8)) ; ret = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x72) & 0x08; - LEAVE_PROC("SMI_ddc1Read"); - return ret; + RETURN(ret); } static Bool @@ -3672,7 +3600,7 @@ SMI_ddc1(int scrnIndex) xf86MonPtr pMon; unsigned char tmp; - ENTER_PROC("SMI_ddc1"); + ENTER(); tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x72); VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x72, tmp | 0x20); @@ -3687,8 +3615,7 @@ SMI_ddc1(int scrnIndex) VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x72, tmp); - LEAVE_PROC("SMI_ddc1"); - return success; + RETURN(success); } static void SMI_SetShadowDimensions(ScrnInfoPtr pScrn,int width,int height){ @@ -3713,7 +3640,7 @@ SMI_DriverFunc(ScrnInfoPtr pScrn, xorgDriverFuncOp op, pointer ptr) xorgRRConfig rconf = ((xorgRRRotation*)ptr)->RRConfig; SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_DriverFunc"); + ENTER(); if(op==RR_GET_INFO){ if(pSmi->randrRotation) ((xorgRRRotation*)ptr)->RRRotations = RR_Rotate_0 | RR_Rotate_90 | RR_Rotate_270; @@ -3721,10 +3648,8 @@ SMI_DriverFunc(ScrnInfoPtr pScrn, xorgDriverFuncOp op, pointer ptr) ((xorgRRRotation*)ptr)->RRRotations = RR_Rotate_0; }else if(op==RR_SET_CONFIG){ - if(!pSmi->randrRotation){ - LEAVE_PROC("SMI_DriverFunc"); - return FALSE; - } + if(!pSmi->randrRotation) + RETURN(FALSE); if(rconf.rotation==RR_Rotate_0){ if(pSmi->rotate!=0){ @@ -3749,15 +3674,10 @@ SMI_DriverFunc(ScrnInfoPtr pScrn, xorgDriverFuncOp op, pointer ptr) else pSmi->rotate=SMI_ROTATE_CW; - }else{ - LEAVE_PROC("SMI_DriverFunc"); - return FALSE; - } - }else{ - LEAVE_PROC("SMI_DriverFunc"); - return FALSE; - } + }else + RETURN(FALSE); + }else + RETURN(FALSE); - LEAVE_PROC("SMI_DriverFunc"); - return TRUE; + RETURN(TRUE); } diff --git a/src/smi_exa.c b/src/smi_exa.c index 9b50344..05e90d8 100644 --- a/src/smi_exa.c +++ b/src/smi_exa.c @@ -64,12 +64,11 @@ SMI_EXAInit(ScreenPtr pScreen) ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_EXAInit"); + ENTER(); if (!(pSmi->EXADriverPtr = exaDriverAlloc())) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to allocate EXADriverRec.\n"); - LEAVE_PROC("SMI_EXAInit"); - return FALSE; + RETURN(FALSE); } pSmi->EXADriverPtr->exa_major = 2; @@ -136,13 +135,12 @@ SMI_EXAInit(ScreenPtr pScreen) if(!exaDriverInit(pScreen, pSmi->EXADriverPtr)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "exaDriverInit failed.\n"); - LEAVE_PROC("SMI_EXAInit"); - return FALSE; - } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "EXA Acceleration enabled.\n"); - LEAVE_PROC("SMI_EXAInit"); - return TRUE; + RETURN(FALSE); } + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "EXA Acceleration enabled.\n"); + + RETURN(TRUE); } static void @@ -151,11 +149,11 @@ SMI_EXASync(ScreenPtr pScreen, int marker) ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; SMIPtr pSmi = SMIPTR(xf86Screens[pScreen->myNum]); - ENTER_PROC("SMI_EXASync"); + ENTER(); SMI_AccelSync(pScrn); - LEAVE_PROC("SMI_EXASync"); + LEAVE(); } /* ----------------------------------------------------- EXA Copy ---------------------------------------------- */ @@ -189,15 +187,13 @@ SMI_PrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, int ydir, int src_pitch, dst_pitch; unsigned long src_offset, dst_offset; - ENTER_PROC("SMI_PrepareCopy"); - DEBUG((VERBLEV, "xdir=%d ydir=%d alu=%02X", xdir, ydir, alu)); + ENTER(); + DEBUG("xdir=%d ydir=%d alu=%02X", xdir, ydir, alu); /* Bit Mask not supported > 16 bpp */ if ((pSrcPixmap->drawable.bitsPerPixel > 16) && - (!EXA_PM_IS_SOLID(&pSrcPixmap->drawable, planemask))) { - LEAVE_PROC("SMI_PrepareCopy"); - return FALSE; - } + (!EXA_PM_IS_SOLID(&pSrcPixmap->drawable, planemask))) + RETURN(FALSE); /* calculate pitch in pixel unit */ src_pitch = exaGetPixmapPitch(pSrcPixmap) / (pSrcPixmap->drawable.bitsPerPixel >> 3); @@ -240,8 +236,7 @@ SMI_PrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, int ydir, WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd); - LEAVE_PROC("SMI_PrepareCopy"); - return TRUE; + RETURN(TRUE); } static void @@ -251,9 +246,9 @@ SMI_Copy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum]; SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_Copy"); - DEBUG((VERBLEV, "srcX=%d srcY=%d dstX=%d dstY=%d width=%d height=%d\n", - srcX, srcY, dstX, dstY, width, height)); + ENTER(); + DEBUG("srcX=%d srcY=%d dstX=%d dstY=%d width=%d height=%d\n", + srcX, srcY, dstX, dstY, width, height); if (pSmi->AccelCmd & SMI_RIGHT_TO_LEFT) { srcX += width - 1; @@ -283,15 +278,15 @@ SMI_Copy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, WRITE_DPR(pSmi, 0x04, (dstX << 16) + (dstY & 0xFFFF)); WRITE_DPR(pSmi, 0x08, (width << 16) + (height & 0xFFFF)); - LEAVE_PROC("SMI_Copy"); + LEAVE(); } static void SMI_DoneCopy(PixmapPtr pDstPixmap) { - ENTER_PROC("SMI_DoneCopy"); + ENTER(); - LEAVE_PROC("SMI_DoneCopy"); + LEAVE(); } /* ----------------------------------------------------- EXA Solid --------------------------------------------- */ @@ -324,19 +319,17 @@ SMI_PrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg) int dst_pitch; unsigned long dst_offset; - ENTER_PROC("SMI_PrepareSolid"); - DEBUG((VERBLEV, "alu=%02X\n", alu)); + ENTER(); + DEBUG("alu=%02X\n", alu); /* HW ignores alpha */ if (pPixmap->drawable.bitsPerPixel == 32) - return FALSE; + RETURN(FALSE); /* Bit Mask not supported > 16 bpp */ if ((pPixmap->drawable.bitsPerPixel > 16) && - (!EXA_PM_IS_SOLID(&pPixmap->drawable, planemask))) { - LEAVE_PROC("SMI_PrepareCopy"); - return FALSE; - } + (!EXA_PM_IS_SOLID(&pPixmap->drawable, planemask))) + RETURN(FALSE); /* calculate pitch in pixel unit */ dst_pitch = exaGetPixmapPitch(pPixmap) / (pPixmap->drawable.bitsPerPixel >> 3); @@ -377,8 +370,7 @@ SMI_PrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg) WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd); - LEAVE_PROC("SMI_PrepareSolid"); - return TRUE; + RETURN(TRUE); } static void @@ -388,8 +380,8 @@ SMI_Solid(PixmapPtr pPixmap, int x1, int y1, int x2, int y2) SMIPtr pSmi = SMIPTR(pScrn); int w, h; - ENTER_PROC("SMI_Solid"); - DEBUG((VERBLEV, "x1=%d y1=%d x2=%d y2=%d\n", x1, y1, x2, y2)); + ENTER(); + DEBUG("x1=%d y1=%d x2=%d y2=%d\n", x1, y1, x2, y2); w = (x2 - x1); h = (y2 - y1); @@ -407,15 +399,15 @@ SMI_Solid(PixmapPtr pPixmap, int x1, int y1, int x2, int y2) WRITE_DPR(pSmi, 0x04, (x1 << 16) | (y1 & 0xFFFF)); WRITE_DPR(pSmi, 0x08, (w << 16) | (h & 0xFFFF)); - LEAVE_PROC("SMI_Solid"); + LEAVE(); } static void SMI_DoneSolid(PixmapPtr pPixmap) { - ENTER_PROC("SMI_DoneSolid"); + ENTER(); - LEAVE_PROC("SMI_DoneSolid"); + LEAVE(); } /* --------------------------------------- EXA DFS & UTS ---------------------------------------- */ @@ -427,9 +419,9 @@ SMI_DownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h, unsigned char *src = pSrc->devPrivate.ptr; int src_pitch = exaGetPixmapPitch(pSrc); - ENTER_PROC("SMI_DownloadFromScreen"); - DEBUG((VERBLEV, "x=%d y=%d w=%d h=%d dst=%d dst_pitch=%d\n", - x, y, w, h, dst, dst_pitch)); + ENTER(); + DEBUG("x=%d y=%d w=%d h=%d dst=%d dst_pitch=%d\n", + x, y, w, h, dst, dst_pitch); exaWaitSync(pSrc->drawable.pScreen); @@ -442,8 +434,7 @@ SMI_DownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h, dst += dst_pitch; } - LEAVE_PROC("SMI_DownloadFromScreen"); - return TRUE; + RETURN(TRUE); } Bool @@ -455,9 +446,9 @@ SMI_UploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, int dst_pixelpitch, src_pixelpitch, align, aligned_pitch; unsigned long dst_offset; - ENTER_PROC("SMI_UploadToScreen"); - DEBUG((VERBLEV, "x=%d y=%d w=%d h=%d src=%d src_pitch=%d\n", - x, y, w, h, src, src_pitch)); + ENTER(); + DEBUG("x=%d y=%d w=%d h=%d src=%d src_pitch=%d\n", + x, y, w, h, src, src_pitch); if (pDst->drawable.bitsPerPixel == 24) { align = 16; @@ -517,8 +508,6 @@ SMI_UploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, exaWaitSync(pDst->drawable.pScreen); - LEAVE_PROC("SMI_UploadToScreen"); - - return TRUE; + RETURN(TRUE); } diff --git a/src/smi_hwcurs.c b/src/smi_hwcurs.c index 7fda65e..290f47a 100644 --- a/src/smi_hwcurs.c +++ b/src/smi_hwcurs.c @@ -74,14 +74,12 @@ SMI_RealizeCursor(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) unsigned char * pmask = bits->mask; int x, y, srcwidth, i; - ENTER_PROC("SMI_RealizeCursor"); + ENTER(); /* Allocate memory */ ram = (unsigned char *) xcalloc(1, 1024); - if (ram == NULL) { - LEAVE_PROC("SMI_RealizeCursor"); - return NULL; - } + if (ram == NULL) + RETURN(NULL); /* Calculate cursor information */ srcwidth = ((bits->width + 31) / 8) & ~3; @@ -200,8 +198,7 @@ SMI_RealizeCursor(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) break; } - LEAVE_PROC("SMI_RealizeCursor"); - return ram; + RETURN(ram); } /* From the SMI Windows CE driver */ @@ -289,7 +286,7 @@ SMI501_RealizeCursor(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) int x, y, srcwidth, i; unsigned int MaxCursor; - ENTER_PROC("SMI501_RealizeCursor"); + ENTER(); /* Allocate memory */ ram = (unsigned char *) xcalloc (1, SMI501_CURSOR_SIZE); @@ -297,10 +294,8 @@ SMI501_RealizeCursor(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) usram = (unsigned short *) ram; MaxCursor = MAX_CURSOR_501; - if (ram == NULL) { - LEAVE_PROC("SMI501_RealizeCursor"); - return (NULL); - } + if (ram == NULL) + RETURN(NULL); /* Calculate cursor information */ srcwidth = ((bits->width + 31) / 8) & ~3; @@ -332,9 +327,7 @@ SMI501_RealizeCursor(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) SMI501_RotateCursorShape(infoPtr, pSmi->rotate, ram); - LEAVE_PROC("SMI501_RealizeCursor"); - - return (ram); + RETURN(ram); } static void @@ -342,7 +335,7 @@ SMI_LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_LoadCursorImage"); + ENTER(); if (IS_MSOC(pSmi)) { /* Write address, disabling the HW cursor */ @@ -385,7 +378,7 @@ SMI_LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) /* Copy cursor image to framebuffer storage */ memcpy(pSmi->FBBase + pSmi->FBCursorOffset, src, 1024); - LEAVE_PROC("SMI_LoadCursorImage"); + LEAVE(); } static void @@ -393,7 +386,7 @@ SMI_ShowCursor(ScrnInfoPtr pScrn) { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_ShowCursor"); + ENTER(); if (IS_MSOC(pSmi)) { CARD32 uiPanelTmp; @@ -428,7 +421,7 @@ SMI_ShowCursor(ScrnInfoPtr pScrn) } } - LEAVE_PROC("SMI_ShowCursor"); + LEAVE(); } static void @@ -436,7 +429,7 @@ SMI_HideCursor(ScrnInfoPtr pScrn) { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_HideCursor"); + ENTER(); if (IS_MSOC(pSmi)) { CARD32 uiPanelTmp; @@ -471,7 +464,7 @@ SMI_HideCursor(ScrnInfoPtr pScrn) } } - LEAVE_PROC("SMI_HideCursor"); + LEAVE(); } static void @@ -480,7 +473,7 @@ SMI_SetCursorPosition(ScrnInfoPtr pScrn, int x, int y) SMIPtr pSmi = SMIPTR(pScrn); int xoff, yoff; - ENTER_PROC("SMI_SetCursorPosition"); + ENTER(); /* Calculate coordinates for rotation */ switch (pSmi->rotate) { @@ -568,7 +561,7 @@ SMI_SetCursorPosition(ScrnInfoPtr pScrn, int x, int y) } } - LEAVE_PROC("SMI_SetCursorPosition"); + LEAVE(); } static void @@ -577,7 +570,7 @@ SMI_SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) SMIPtr pSmi = SMIPTR(pScrn); unsigned char packedFG, packedBG; - ENTER_PROC("SMI_SetCursorColors"); + ENTER(); if (IS_MSOC(pSmi)) { /* for the SMI501 HWCursor, there are 4 possible colors, one of which @@ -639,7 +632,7 @@ SMI_SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) } } - LEAVE_PROC("SMI_SetCursorColors"); + LEAVE(); } Bool @@ -650,14 +643,12 @@ SMI_HWCursorInit(ScreenPtr pScreen) xf86CursorInfoPtr infoPtr; Bool ret; - ENTER_PROC("SMI_HWCursorInit"); + ENTER(); /* Create cursor infor record */ infoPtr = xf86CreateCursorInfoRec(); - if (infoPtr == NULL) { - LEAVE_PROC("SMI_HWCursorInit"); - return FALSE; - } + if (infoPtr == NULL) + RETURN(FALSE); pSmi->CursorInfoRec = infoPtr; @@ -691,7 +682,6 @@ SMI_HWCursorInit(ScreenPtr pScreen) /* Proceed with cursor initialization */ ret = xf86InitCursor(pScreen, infoPtr); - LEAVE_PROC("SMI_HWCursorInit"); - return ret; + RETURN(ret); } diff --git a/src/smi_i2c.c b/src/smi_i2c.c index a829463..f38b514 100644 --- a/src/smi_i2c.c +++ b/src/smi_i2c.c @@ -40,31 +40,16 @@ authorization from the XFree86 Project and Silicon Motion. #include "smi.h" -#undef VERBLEV -#undef ENTER_PROC -#undef DEBUG_PROC -#undef LEAVE_PROC -#undef DEBUG -#define VERBLEV 2 -#define ENTER_PROC(PROCNAME) -#define DEBUG_PROC(PROCNAME) -#define LEAVE_PROC(PROCNAME) -#define DEBUG(arg) - static void SMI_I2CPutBits(I2CBusPtr b, int clock, int data) { SMIPtr pSmi = SMIPTR(xf86Screens[b->scrnIndex]); unsigned int reg = 0x30; - ENTER_PROC("SMI_I2CPutBits"); - if (clock) reg |= 0x01; if (data) reg |= 0x02; VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x72, reg); - - LEAVE_PROC("SMI_I2CPutBits"); } static void @@ -73,12 +58,8 @@ SMI_I2CGetBits(I2CBusPtr b, int *clock, int *data) SMIPtr pSmi = SMIPTR(xf86Screens[b->scrnIndex]); unsigned int reg = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x72); - ENTER_PROC("SMI_I2CGetBits"); - *clock = reg & 0x04; *data = reg & 0x08; - - LEAVE_PROC("SMI_I2CGetBits"); } Bool @@ -86,14 +67,10 @@ SMI_I2CInit(ScrnInfoPtr pScrn) { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_I2CInit"); - if (pSmi->I2C == NULL) { I2CBusPtr I2CPtr = xf86CreateI2CBusRec(); - if (I2CPtr == NULL) { - LEAVE_PROC("SMI_I2CInit"); + if (I2CPtr == NULL) return FALSE; - } I2CPtr->BusName = "I2C bus"; I2CPtr->scrnIndex = pScrn->scrnIndex; @@ -102,14 +79,12 @@ SMI_I2CInit(ScrnInfoPtr pScrn) if (!xf86I2CBusInit(I2CPtr)) { xf86DestroyI2CBusRec(I2CPtr, TRUE, TRUE); - LEAVE_PROC("SMI_I2CInit"); return FALSE; } pSmi->I2C = I2CPtr; } - LEAVE_PROC("SMI_I2CInit"); return TRUE; } diff --git a/src/smi_shadow.c b/src/smi_shadow.c index 113a2ec..496f255 100644 --- a/src/smi_shadow.c +++ b/src/smi_shadow.c @@ -60,11 +60,12 @@ void SMI_RefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox) SMIPtr pSmi = SMIPTR(pScrn); int width, height, srcX, srcY, destX, destY; - ENTER_PROC("SMI_RefreshArea"); + ENTER(); /* #671 */ if (pSmi->polyLines) { pSmi->polyLines = FALSE; + LEAVE(); return; } @@ -93,7 +94,7 @@ void SMI_RefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox) width = pbox->x2 - srcX; height = pbox->y2 - srcY; - DEBUG((VERBLEV, "x=%d y=%d w=%d h=%d\n", srcX, srcY, width, height)); + DEBUG("x=%d y=%d w=%d h=%d\n", srcX, srcY, width, height); if ((width > 0) && (height > 0)) { switch (pSmi->rotate) { @@ -167,7 +168,7 @@ void SMI_RefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox) WRITE_DPR(pSmi, 0x3C, (pSmi->Stride << 16) | pSmi->Stride); WRITE_DPR(pSmi, 0x44, 0); - LEAVE_PROC("SMI_RefreshArea"); + LEAVE(); } /* Custom version for the 730 series (Cougar3DR). @@ -179,11 +180,12 @@ void SMI_RefreshArea730(ScrnInfoPtr pScrn, int num, BoxPtr pbox) int width, height, srcX, srcY, destX, destY; int maxPixels, tempWidth; - ENTER_PROC("SMI_RefreshArea730"); + ENTER(); /* #671 */ if (pSmi->polyLines) { pSmi->polyLines = FALSE; + LEAVE(); return; } @@ -216,7 +218,7 @@ void SMI_RefreshArea730(ScrnInfoPtr pScrn, int num, BoxPtr pbox) width = pbox->x2 - srcX; height = pbox->y2 - srcY; - DEBUG((VERBLEV, "x=%d y=%d w=%d h=%d\n", srcX, srcY, width, height)); + DEBUG("x=%d y=%d w=%d h=%d\n", srcX, srcY, width, height); if ((width > 0) && (height > 0)) { switch (pSmi->rotate) { @@ -308,7 +310,7 @@ void SMI_RefreshArea730(ScrnInfoPtr pScrn, int num, BoxPtr pbox) WRITE_DPR(pSmi, 0x3C, (pSmi->Stride << 16) | pSmi->Stride); WRITE_DPR(pSmi, 0x44, 0); - LEAVE_PROC("SMI_RefreshArea730"); + LEAVE(); } /******************************************************************************\ diff --git a/src/smi_video.c b/src/smi_video.c index 17a5ced..a94d086 100644 --- a/src/smi_video.c +++ b/src/smi_video.c @@ -552,7 +552,7 @@ SMI_AddEncoding(XF86VideoEncodingPtr enc, int i, char* input_string; char channel_string[20]; - ENTER_PROC("SMI_AddEncoding"); + ENTER(); norm_string = VideoNorms[norm].name; input_string = VideoInputs[input].name; @@ -561,17 +561,15 @@ SMI_AddEncoding(XF86VideoEncodingPtr enc, int i, enc[i].name = xalloc(strlen(norm_string) + strlen(input_string) + strlen(channel_string)+3); - if (NULL == enc[i].name) { - LEAVE_PROC("SMI_AddEncoding"); - return -1; - } + if (NULL == enc[i].name) + RETURN(-1); + enc[i].width = VideoNorms[norm].Wa; enc[i].height = VideoNorms[norm].Ha; enc[i].rate = VideoNorms[norm].rate; sprintf(enc[i].name,"%s-%s-%s", norm_string, input_string, channel_string); - LEAVE_PROC("SMI_AddEncoding"); - return 0; + RETURN(0); } @@ -584,7 +582,7 @@ SMI_BuildEncodings(SMI_PortPtr p) { int ch, n; - ENTER_PROC("SMI_BuildEncodings"); + ENTER(); /* allocate memory for encoding array */ p->enc = xalloc(sizeof(XF86VideoEncodingRec) * N_ENCODINGS); @@ -627,7 +625,7 @@ SMI_BuildEncodings(SMI_PortPtr p) p->nenc++; } } - LEAVE_PROC("SMI_BuildEncodings"); + LEAVE(); return; fail: @@ -640,7 +638,7 @@ SMI_BuildEncodings(SMI_PortPtr p) if (p->enc) xfree(p->enc); p->enc = NULL; p->nenc = 0; - LEAVE_PROC("SMI_BuildEncodings"); + LEAVE(); } @@ -659,19 +657,21 @@ SMI_InitVideo(ScreenPtr pScreen) XF86VideoAdaptorPtr newAdaptor = NULL; int numAdaptors; - if (IS_MSOC(psmi) && psmi->IsSecondary) - return; + ENTER(); - ENTER_PROC("SMI_InitVideo"); + if (IS_MSOC(psmi) && psmi->IsSecondary) { + LEAVE(); + return; + } numAdaptors = xf86XVListGenericAdaptors(pScrn, &ptrAdaptors); - DEBUG((VERBLEV, "numAdaptors=%d\n", numAdaptors)); + DEBUG("numAdaptors=%d\n", numAdaptors); /* if (psmi->rotate == 0) */ /* { */ newAdaptor = SMI_SetupVideo(pScreen); - DEBUG((VERBLEV, "newAdaptor=%p\n", newAdaptor)); + DEBUG("newAdaptor=%p\n", newAdaptor); SMI_InitOffscreenImages(pScreen); /* } */ @@ -692,7 +692,7 @@ SMI_InitVideo(ScreenPtr pScreen) } if (numAdaptors != 0) { - DEBUG((VERBLEV, "ScreenInit %i\n",numAdaptors)); + DEBUG("ScreenInit %i\n",numAdaptors); xf86XVScreenInit(pScreen, ptrAdaptors, numAdaptors); } @@ -700,7 +700,7 @@ SMI_InitVideo(ScreenPtr pScreen) xfree(newAdaptors); } - LEAVE_PROC("SMI_InitVideo"); + LEAVE(); } @@ -784,8 +784,8 @@ SetAttrSAA7111(ScrnInfoPtr pScrn, int i, int value) input = pPort->input[value]; channel = pPort->channel[value]; - DEBUG((VERBLEV, "SetAttribute XV_ENCODING: %d. norm=%d input=%d channel=%d\n", - value, norm, input, channel)); + DEBUG("SetAttribute XV_ENCODING: %d. norm=%d input=%d channel=%d\n", + value, norm, input, channel); /* set video norm */ if (!xf86I2CWriteVec(&(pPort->I2CDev), SAA7111VideoStd[norm], @@ -812,22 +812,22 @@ SetAttrSAA7111(ScrnInfoPtr pScrn, int i, int value) switch (i) { case XV_CAPTURE_BRIGHTNESS: - DEBUG((VERBLEV, "SetAttribute XV_BRIGHTNESS: %d\n", value)); + DEBUG("SetAttribute XV_BRIGHTNESS: %d\n", value); slave_adr = 0x0a; break; case XV_CONTRAST: - DEBUG((VERBLEV, "SetAttribute XV_CONTRAST: %d\n", value)); + DEBUG("SetAttribute XV_CONTRAST: %d\n", value); slave_adr = 0x0b; break; case XV_SATURATION: - DEBUG((VERBLEV, "SetAttribute XV_SATURATION: %d\n", value)); + DEBUG("SetAttribute XV_SATURATION: %d\n", value); slave_adr = 0x0c; break; case XV_HUE: - DEBUG((VERBLEV, "SetAttribute XV_HUE: %d\n", value)); + DEBUG("SetAttribute XV_HUE: %d\n", value); slave_adr = 0x0d; break; @@ -845,10 +845,10 @@ SetAttrSAA7111(ScrnInfoPtr pScrn, int i, int value) I2CByte i2c_bytes[32]; int i; xf86I2CReadBytes(&(pPort->I2CDev), 0, i2c_bytes, 32); - DEBUG((VERBLEV, "SAA7111 Registers\n")); + DEBUG("SAA7111 Registers\n"); for (i=0; i<32; i++) { - DEBUG((VERBLEV, "%02X=%02X ", i, i2c_bytes[i])); - if ((i&7) == 7) DEBUG((VERBLEV, "\n")); + DEBUG("%02X=%02X ", i, i2c_bytes[i]); + if ((i&7) == 7) DEBUG("\n"); } } @@ -870,14 +870,12 @@ SMI_SetupVideo(ScreenPtr pScreen) SMI_PortPtr smiPortPtr; XF86VideoAdaptorPtr ptrAdaptor; - ENTER_PROC("SMI_SetupVideo"); + ENTER(); ptrAdaptor = xcalloc(1, sizeof(XF86VideoAdaptorRec) + sizeof(DevUnion) + sizeof(SMI_PortRec)); - if (ptrAdaptor == NULL) { - LEAVE_PROC("SMI_SetupVideo"); - return NULL; - } + if (ptrAdaptor == NULL) + RETURN(NULL); ptrAdaptor->type = XvInputMask #if SMI_USE_CAPTURE @@ -957,11 +955,8 @@ SMI_SetupVideo(ScreenPtr pScreen) #if 0 /* aaa does not work ? */ if (xf86I2CProbeAddress(pSmi->I2C, SAA7111)) - { - LEAVE_PROC("SMI_SetupVideo"); - return(NULL); - } - DEBUG((VERBLEV, "SAA7111 detected\n")); + RETURN(NULL); + DEBUG("SAA7111 detected\n"); #endif smiPortPtr->I2CDev.DevName = "SAA 7111A"; @@ -978,7 +973,7 @@ SMI_SetupVideo(ScreenPtr pScreen) xvContrast = MAKE_ATOM(XV_CONTRAST_NAME); xvInterlaced = MAKE_ATOM(XV_INTERLACED_NAME); - DEBUG((VERBLEV, "SAA7111 intialized\n")); + DEBUG("SAA7111 intialized\n"); } else { xf86DestroyI2CDevRec(&(smiPortPtr->I2CDev),FALSE); @@ -1002,8 +997,8 @@ SMI_SetupVideo(ScreenPtr pScreen) xvCapBrightness = MAKE_ATOM(XV_CAPTURE_BRIGHTNESS_NAME); SMI_ResetVideo(pScrn); - LEAVE_PROC("SMI_SetupVideo"); - return ptrAdaptor; + + RETURN(ptrAdaptor); } @@ -1014,7 +1009,7 @@ SMI_ResetVideo(ScrnInfoPtr pScrn) SMI_PortPtr pPort = (SMI_PortPtr) pSmi->ptrAdaptor->pPortPrivates[0].ptr; int r, g, b; - ENTER_PROC("SMI_ResetVideo"); + ENTER(); SetAttr(pScrn, XV_ENCODING, 0); /* Encoding = pal-composite-0 */ SetAttr(pScrn, XV_BRIGHTNESS, 128); /* Brightness = 128 (CCIR level) */ @@ -1044,7 +1039,7 @@ SMI_ResetVideo(ScrnInfoPtr pScrn) SetKeyReg(pSmi, FPR5C, 0xEDEDED | (pPort->Attribute[XV_BRIGHTNESS] << 24)); - LEAVE_PROC("SMI_ResetVideo"); + LEAVE(); } @@ -1076,9 +1071,9 @@ SMI_PutVideo( int size, width, height, fbPitch; int top, left; - ENTER_PROC("SMI_PutVideo"); + ENTER(); - DEBUG((VERBLEV, "Interlaced Video %d\n", pPort->Attribute[XV_INTERLACED])); + DEBUG("Interlaced Video %d\n", pPort->Attribute[XV_INTERLACED]); if (!pPort->Attribute[XV_INTERLACED]) { /* no interlace: lines will be doubled */ @@ -1092,9 +1087,9 @@ SMI_PutVideo( /* only even values allowed (UV-phase) */ vid_x &= ~1; - DEBUG((VERBLEV, "vid_x=%d vid_y=%d drw_x=%d drw_y=%d " - "vid_w=%d vid_h=%d drw_w=%d drw_h=%d\n", - vid_x, vid_y, drw_x, drw_y, vid_w, vid_h, drw_w, drw_h)); + DEBUG("vid_x=%d vid_y=%d drw_x=%d drw_y=%d " + "vid_w=%d vid_h=%d drw_w=%d drw_h=%d\n", + vid_x, vid_y, drw_x, drw_y, vid_w, vid_h, drw_w, drw_h); x1 = vid_x; y1 = vid_y; @@ -1110,15 +1105,13 @@ SMI_PutVideo( dstBox.y2 = drw_y + drw_h; #if 1 - if (!SMI_ClipVideo(pScrn, &dstBox, &x1, &y1, &x2, &y2, clipBoxes, width, height)) { + if (!SMI_ClipVideo(pScrn, &dstBox, &x1, &y1, &x2, &y2, clipBoxes, width, height)) #else - if (!xf86XVClipVideoHelper(&dstBox, &x1, &y1, &x2, &y2, clipBoxes, width, height)) { + if (!xf86XVClipVideoHelper(&dstBox, &x1, &y1, &x2, &y2, clipBoxes, width, height)) #endif - LEAVE_PROC("SMI_PutVideo"); - return Success; - } + RETURN(Success); - DEBUG((VERBLEV, "Clip: x1=%d y1=%d x2=%d y2=%d\n", x1 >> 16, y1 >> 16, x2 >> 16, y2 >> 16)); + DEBUG("Clip: x1=%d y1=%d x2=%d y2=%d\n", x1 >> 16, y1 >> 16, x2 >> 16, y2 >> 16); dstBox.x1 -= pScrn->frameX0; dstBox.y1 -= pScrn->frameY0; @@ -1239,8 +1232,8 @@ SMI_PutVideo( do { size = vid_pitch * height; - DEBUG((VERBLEV, "SMI_AllocateMemory: vid_pitch=%d height=%d size=%d\n", - vid_pitch, height, size)); + DEBUG("SMI_AllocateMemory: vid_pitch=%d height=%d size=%d\n", + vid_pitch, height, size); pPort->video_offset = SMI_AllocateMemory(pScrn, &pPort->video_memory, size); if (pPort->video_offset == 0) { if ((cpr00 & 0x000C0000) == 0) { @@ -1266,27 +1259,26 @@ SMI_PutVideo( width = vid_w / 4; cpr00 ^= 0x00030000; } else { - DEBUG((VERBLEV, "allocate error\n")); - LEAVE_PROC("SMI_PutVideo"); - return BadAlloc; + DEBUG("allocate error\n"); + RETURN(BadAlloc); } } } } while (pPort->video_offset == 0); - DEBUG((VERBLEV, "xscale==%d yscale=%d width=%d height=%d\n", - xscale, yscale, width, height)); + DEBUG("xscale==%d yscale=%d width=%d height=%d\n", + xscale, yscale, width, height); /* aaa whats this ----------------------v ? vid_address = (pPort->area->box.y1 * fbPitch) + ((y1 >> 16) * vid_pitch);*/ vid_address = pPort->video_offset; - DEBUG((VERBLEV, "test RegionsEqual\n")); + DEBUG("test RegionsEqual\n"); if (!REGION_EQUAL(pScrn->pScreen, &pPort->clip, clipBoxes)) { DEBUG((VERBLEV, "RegionCopy\n")); REGION_COPY(pScrn->pScreen, &pPort->clip, clipBoxes); - DEBUG((VERBLEV, "FillKey\n")); + DEBUG("FillKey\n"); xf86XVFillKeyHelper(pScrn->pScreen, pPort->Attribute[XV_COLORKEY], clipBoxes); } @@ -1359,9 +1351,9 @@ SMI_PutVideo( WRITE_VPR(pSmi, 0x00, vpr00); pPort->videoStatus = CLIENT_VIDEO_ON; - DEBUG((VERBLEV, "SMI_PutVideo success\n")); - LEAVE_PROC("SMI_PutVideo"); - return Success; + DEBUG("SMI_PutVideo success\n"); + + RETURN(Success); } #endif @@ -1376,7 +1368,7 @@ SMI_StopVideo( SMI_PortPtr pPort = (SMI_PortPtr) data; SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_StopVideo"); + ENTER(); REGION_EMPTY(pScrn->pScreen, &pPort->clip); @@ -1411,7 +1403,7 @@ SMI_StopVideo( } } - LEAVE_PROC("SMI_StopVideo"); + LEAVE(); } static int @@ -1426,7 +1418,7 @@ SMI_SetPortAttribute( SMI_PortPtr pPort = (SMI_PortPtr) data; SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_SetPortAttribute"); + ENTER(); if (attribute == xvColorKey) { int r, g, b; @@ -1467,8 +1459,7 @@ SMI_SetPortAttribute( res = BadMatch; } - LEAVE_PROC("SMI_SetPortAttribute"); - return res; + RETURN(res); } @@ -1482,7 +1473,7 @@ SMI_GetPortAttribute( { SMI_PortPtr pPort = (SMI_PortPtr) data; - ENTER_PROC("SMI_GetPortAttribute"); + ENTER(); if (attribute == xvEncoding) *value = pPort->Attribute[XV_ENCODING]; else if (attribute == xvBrightness) @@ -1497,13 +1488,10 @@ SMI_GetPortAttribute( *value = pPort->Attribute[XV_HUE]; else if (attribute == xvColorKey) *value = pPort->Attribute[XV_COLORKEY]; - else { - LEAVE_PROC("SMI_GetPortAttribute"); - return BadMatch; - } + else + RETURN(BadMatch); - LEAVE_PROC("SMI_GetPortAttribute"); - return Success; + RETURN(Success); } @@ -1522,12 +1510,12 @@ SMI_QueryBestSize( { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_QueryBestSize"); + ENTER(); *p_w = min(drw_w, pSmi->lcdWidth); *p_h = min(drw_h, pSmi->lcdHeight); - LEAVE_PROC("SMI_QueryBestSize"); + LEAVE(); } @@ -1562,7 +1550,7 @@ SMI_PutImage( int left, top, nPixels, nLines; unsigned char *dstStart; - ENTER_PROC("SMI_PutImage"); + ENTER(); if(pSmi->rotate){ /* As we cannot display it rotated, we pretend it has */ @@ -1582,10 +1570,8 @@ SMI_PutImage( dstBox.x2 = drw_x + drw_w; dstBox.y2 = drw_y + drw_h; - if (!SMI_ClipVideo(pScrn, &dstBox, &x1, &y1, &x2, &y2, clipBoxes, width, height)) { - LEAVE_PROC("SMI_PutImage"); - return Success; - } + if (!SMI_ClipVideo(pScrn, &dstBox, &x1, &y1, &x2, &y2, clipBoxes, width, height)) + RETURN(Success); if(pSmi->rotate){ /* Now, transform the coordinates back */ @@ -1641,10 +1627,8 @@ SMI_PutImage( size = dstPitch * height; pPort->video_offset = SMI_AllocateMemory(pScrn, &pPort->video_memory, size); - if (pPort->video_offset == 0) { - LEAVE_PROC("SMI_PutImage"); - return BadAlloc; - } + if (pPort->video_offset == 0) + RETURN(BadAlloc); top = y1 >> 16; left = (x1 >> 16) & ~1; @@ -1694,8 +1678,8 @@ SMI_PutImage( &dstBox, src_w, src_h, drw_w, drw_h); pPort->videoStatus = CLIENT_VIDEO_ON; - LEAVE_PROC("SMI_PutImage"); - return Success; + + RETURN(Success); } @@ -1713,7 +1697,7 @@ SMI_QueryImageAttributes( SMIPtr pSmi = SMIPTR(pScrn); int size, tmp; - ENTER_PROC("SMI_QueryImageAttributes"); + ENTER(); if (*width > pSmi->lcdWidth) { *width = pSmi->lcdWidth; @@ -1776,8 +1760,7 @@ SMI_QueryImageAttributes( break; } - LEAVE_PROC("SMI_QueryImageAttributes"); - return size; + RETURN(size); } @@ -1823,8 +1806,8 @@ SMI_ClipVideo( pScrn->frameX1 + 1 , pScrn->frameY1 + 1}; BoxPtr extents = REGION_EXTENTS(pScreen, reg); - ENTER_PROC("SMI_ClipVideo"); - DEBUG((VERBLEV, "ClipVideo(%d): x1=%d y1=%d x2=%d y2=%d\n", __LINE__, *x1 >> 16, *y1 >> 16, *x2 >> 16, *y2 >> 16)); + ENTER(); + DEBUG("ClipVideo(%d): x1=%d y1=%d x2=%d y2=%d\n", __LINE__, *x1 >> 16, *y1 >> 16, *x2 >> 16, *y2 >> 16); /* Rotate the viewport before clipping */ if (pSmi->rotate) @@ -1843,7 +1826,7 @@ SMI_ClipVideo( *x1 <<= 16; *y1 <<= 16; *x2 <<= 16; *y2 <<= 16; - DEBUG((VERBLEV, "ClipVideo(%d): x1=%d y1=%d x2=%d y2=%d\n", __LINE__, *x1 >> 16, *y1 >> 16, *x2 >> 16, *y2 >> 16)); + DEBUG("ClipVideo(%d): x1=%d y1=%d x2=%d y2=%d\n", __LINE__, *x1 >> 16, *y1 >> 16, *x2 >> 16, *y2 >> 16); diff = extents->x1 - dst->x1; if (diff > 0) { @@ -1869,7 +1852,7 @@ SMI_ClipVideo( *y2 -= diff * vscale; } - DEBUG((VERBLEV, "ClipVideo(%d): x1=%d y1=%d x2=%d y2=%d\n", __LINE__, *x1 >> 16, *y1 >> 16, *x2 >> 16, *y2 >> 16)); + DEBUG("ClipVideo(%d): x1=%d y1=%d x2=%d y2=%d\n", __LINE__, *x1 >> 16, *y1 >> 16, *x2 >> 16, *y2 >> 16); if (*x1 < 0) { diff = (-*x1 + hscale - 1) / hscale; @@ -1883,7 +1866,7 @@ SMI_ClipVideo( *y1 += diff * vscale; } - DEBUG((VERBLEV, "ClipVideo(%d): x1=%d y1=%d x2=%d y2=%d\n", __LINE__, *x1 >> 16, *y1 >> 16, *x2 >> 16, *y2 >> 16)); + DEBUG("ClipVideo(%d): x1=%d y1=%d x2=%d y2=%d\n", __LINE__, *x1 >> 16, *y1 >> 16, *x2 >> 16, *y2 >> 16); #if 0 /* aaa was macht dieser code? */ delta = *x2 - (width << 16); @@ -1903,12 +1886,10 @@ SMI_ClipVideo( } #endif - DEBUG((VERBLEV, "ClipVideo(%d): x1=%d y1=%d x2=%d y2=%d\n", __LINE__, *x1 >> 16, *y1 >> 16, *x2 >> 16, *y2 >> 16)); + DEBUG("ClipVideo(%d): x1=%d y1=%d x2=%d y2=%d\n", __LINE__, *x1 >> 16, *y1 >> 16, *x2 >> 16, *y2 >> 16); - if ((*x1 >= *x2) || (*y1 >= *y2)) { - LEAVE_PROC("SMI_ClipVideo"); - return FALSE; - } + if ((*x1 >= *x2) || (*y1 >= *y2)) + RETURN(FALSE); if ((dst->x1 != extents->x1) || (dst->y1 != extents->y1) || (dst->x2 != extents->x2) || (dst->y2 != extents->y2)) { @@ -1918,10 +1899,9 @@ SMI_ClipVideo( REGION_UNINIT(pScrn->pScreen, &clipReg); } - DEBUG((VERBLEV, "ClipVideo(%d): x1=%d y1=%d x2=%d y2=%d\n", __LINE__, *x1 >> 16, *y1 >> 16, *x2 >> 16, *y2 >> 16)); + DEBUG("ClipVideo(%d): x1=%d y1=%d x2=%d y2=%d\n", __LINE__, *x1 >> 16, *y1 >> 16, *x2 >> 16, *y2 >> 16); - LEAVE_PROC("SMI_ClipVideo"); - return TRUE; + RETURN(TRUE); } static void @@ -1947,7 +1927,7 @@ SMI_DisplayVideo( CARD32 vpr00; int hstretch, vstretch; - ENTER_PROC("SMI_DisplayVideo"); + ENTER(); vpr00 = READ_VPR(pSmi, 0x00) & ~0x0CB800FF; @@ -1993,7 +1973,7 @@ SMI_DisplayVideo( WRITE_VPR(pSmi, 0x20, (pitch >> 3) | ((pitch >> 3) << 16)); WRITE_VPR(pSmi, 0x24, (hstretch << 8) | vstretch); - LEAVE_PROC("SMI_DisplayVideo"); + LEAVE(); } static void @@ -2014,7 +1994,7 @@ SMI_DisplayVideo0501(ScrnInfoPtr pScrn, CARD32 dcr40; int hstretch, vstretch; - ENTER_PROC("SMI_DisplayVideo0501"); + ENTER(); dcr40 = READ_DCR(pSmi, DCR40) & ~0x00003FFF; @@ -2073,7 +2053,7 @@ SMI_DisplayVideo0501(ScrnInfoPtr pScrn, WRITE_DCR(pSmi, DCR40, dcr40 | (1 << 2)); - LEAVE_PROC("SMI_DisplayVideo0501"); + LEAVE(); } static void @@ -2099,7 +2079,7 @@ SMI_DisplayVideo0730( CARD32 fpr00; int hstretch, vstretch; - ENTER_PROC("SMI_DisplayVideo0730"); + ENTER(); fpr00 = READ_FPR(pSmi, 0x00) & ~(FPR00_MASKBITS); @@ -2145,7 +2125,7 @@ SMI_DisplayVideo0730( WRITE_FPR(pSmi, FPR24, (hstretch & 0xFF00) | ((vstretch & 0xFF00)>>8)); WRITE_FPR(pSmi, FPR68, ((hstretch & 0x00FF)<<8) | (vstretch & 0x00FF)); - LEAVE_PROC("SMI_DisplayVideo0730"); + LEAVE(); } static void @@ -2199,48 +2179,38 @@ SMI_SendI2C( SMI_I2CDataPtr i2cData ) { - SMIPtr pSmi = SMIPTR(pScrn); - I2CDevPtr dev; - int status = Success; + SMIPtr pSmi = SMIPTR(pScrn); + I2CDevPtr dev; + int status = Success; - ENTER_PROC("SMI_SendI2C"); + ENTER(); - if (pSmi->I2C == NULL) - { - LEAVE_PROC("SMI_SendI2C"); - return(BadAlloc); - } + if (pSmi->I2C == NULL) + RETURN(BadAlloc); - dev = xf86CreateI2CDevRec(); - if (dev == NULL) - { - LEAVE_PROC("SMI_SendI2C"); - return(BadAlloc); - } - dev->DevName = devName; - dev->SlaveAddr = device; - dev->pI2CBus = pSmi->I2C; + dev = xf86CreateI2CDevRec(); + if (dev == NULL) + RETURN(BadAlloc); - if (!xf86I2CDevInit(dev)) - { + dev->DevName = devName; + dev->SlaveAddr = device; + dev->pI2CBus = pSmi->I2C; + + if (!xf86I2CDevInit(dev)) + status = BadAlloc; + else { + while (i2cData->address != 0xFF || i2cData->data != 0xFF) { /* PDR#676 */ + if (!xf86I2CWriteByte(dev, i2cData->address, i2cData->data)) { status = BadAlloc; + break; + } + i2cData++; } - else - { - while (i2cData->address != 0xFF || i2cData->data != 0xFF) /* PDR#676 */ - { - if (!xf86I2CWriteByte(dev, i2cData->address, i2cData->data)) - { - status = BadAlloc; - break; - } - i2cData++; - } - } + } - xf86DestroyI2CDevRec(dev, TRUE); - LEAVE_PROC("SMI_SendI2C"); - return(status); + xf86DestroyI2CDevRec(dev, TRUE); + + RETURN(status); } #endif @@ -2260,11 +2230,11 @@ SMI_InitOffscreenImages( SMIPtr pSmi = SMIPTR(pScrn); SMI_PortPtr pPort = (SMI_PortPtr) pSmi->ptrAdaptor->pPortPrivates[0].ptr; - ENTER_PROC("SMI_InitOffscreenImages"); + ENTER(); offscreenImages = xalloc(sizeof(XF86OffscreenImageRec)); if (offscreenImages == NULL) { - LEAVE_PROC("SMI_InitOffscreenImages"); + LEAVE(); return; } @@ -2289,7 +2259,7 @@ SMI_InitOffscreenImages( } xf86XVRegisterOffscreenImages(pScreen, offscreenImages, 1); - LEAVE_PROC("SMI_InitOffscreenImages"); + LEAVE(); } static void @@ -2299,12 +2269,12 @@ SMI_VideoSave(ScreenPtr pScreen, ExaOffscreenArea *area) SMIPtr pSmi = SMIPTR(pScrn); SMI_PortPtr pPort = pSmi->ptrAdaptor->pPortPrivates[0].ptr; - ENTER_PROC("SMI_VideoSave"); + ENTER(); if (pPort->video_memory == area) pPort->video_memory = NULL; - LEAVE_PROC("SMI_VideoSave"); + LEAVE(); } static CARD32 @@ -2314,14 +2284,14 @@ SMI_AllocateMemory(ScrnInfoPtr pScrn, void **mem_struct, int size) SMIPtr pSmi = SMIPTR(pScrn); int offset = 0; - ENTER_PROC("SMI_AllocateMemory"); + ENTER(); if (pSmi->useEXA) { ExaOffscreenArea *area = *mem_struct; if (area != NULL) { if (area->size >= size) - return area->offset; + RETURN(area->offset); exaOffscreenFree(pScrn->pScreen, area); } @@ -2343,10 +2313,10 @@ SMI_AllocateMemory(ScrnInfoPtr pScrn, void **mem_struct, int size) if (linear) { if (linear->size >= size) - return linear->offset * pSmi->Bpp; + RETURN(linear->offset * pSmi->Bpp); if (xf86ResizeOffscreenLinear(linear, size)) - return linear->offset * pSmi->Bpp; + RETURN(linear->offset * pSmi->Bpp); xf86FreeOffscreenLinear(linear); } @@ -2356,7 +2326,7 @@ SMI_AllocateMemory(ScrnInfoPtr pScrn, void **mem_struct, int size) xf86QueryLargestOffscreenLinear(pScreen, &max_size, 16, PRIORITY_EXTREME); if (max_size < size) - return 0; + RETURN(0); xf86PurgeUnlockedOffscreenAreas(pScreen); } @@ -2366,11 +2336,10 @@ SMI_AllocateMemory(ScrnInfoPtr pScrn, void **mem_struct, int size) if ((*mem_struct = linear) != NULL) offset = linear->offset * pSmi->Bpp; - DEBUG((VERBLEV, "offset = %p\n", offset)); + DEBUG("offset = %p\n", offset); } - LEAVE_PROC("SMI_AllocateMemory"); - return offset; + RETURN(offset); } static void @@ -2381,7 +2350,7 @@ SMI_FreeMemory( { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_FreeMemory"); + ENTER(); if (pSmi->useEXA) { ExaOffscreenArea *area = mem_struct; @@ -2395,7 +2364,7 @@ SMI_FreeMemory( xf86FreeOffscreenLinear(linear); } - LEAVE_PROC("SMI_FreeMemory"); + LEAVE(); } static int @@ -2412,12 +2381,10 @@ SMI_AllocSurface( void *surface_memory = NULL; SMI_OffscreenPtr ptrOffscreen; - ENTER_PROC("SMI_AllocSurface"); + ENTER(); - if ((width > pSmi->lcdWidth) || (height > pSmi->lcdHeight)) { - LEAVE_PROC("SMI_AllocSurface"); - return BadAlloc; - } + if (width > pSmi->lcdWidth || height > pSmi->lcdHeight) + RETURN(BadAlloc); switch (id) { case FOURCC_YV12: @@ -2434,8 +2401,7 @@ SMI_AllocSurface( bpp = 4; break; default: - LEAVE_PROC("SMI_AllocSurface"); - return BadAlloc; + RETURN(BadAlloc); } width = (width + 1) & ~1; @@ -2443,23 +2409,19 @@ SMI_AllocSurface( size = pitch * height; offset = SMI_AllocateMemory(pScrn, &surface_memory, size); - if (offset == 0) { - LEAVE_PROC("SMI_AllocSurface"); - return BadAlloc; - } + if (offset == 0) + RETURN(BadAlloc); surface->pitches = xalloc(sizeof(int)); if (surface->pitches == NULL) { SMI_FreeMemory(pScrn, surface_memory); - LEAVE_PROC("SMI_AllocSurface"); - return BadAlloc; + RETURN(BadAlloc); } surface->offsets = xalloc(sizeof(int)); if (surface->offsets == NULL) { xfree(surface->pitches); SMI_FreeMemory(pScrn, surface_memory); - LEAVE_PROC("SMI_AllocSurface"); - return BadAlloc; + RETURN(BadAlloc); } ptrOffscreen = xalloc(sizeof(SMI_OffscreenRec)); @@ -2467,8 +2429,7 @@ SMI_AllocSurface( xfree(surface->offsets); xfree(surface->pitches); SMI_FreeMemory(pScrn, surface_memory); - LEAVE_PROC("SMI_AllocSurface"); - return BadAlloc; + RETURN(BadAlloc); } surface->pScrn = pScrn; @@ -2482,8 +2443,7 @@ SMI_AllocSurface( ptrOffscreen->surface_memory = surface_memory; ptrOffscreen->isOn = FALSE; - LEAVE_PROC("SMI_AllocSurface"); - return Success; + RETURN(Success); } static int @@ -2494,7 +2454,7 @@ SMI_FreeSurface( ScrnInfoPtr pScrn = surface->pScrn; SMI_OffscreenPtr ptrOffscreen = (SMI_OffscreenPtr) surface->devPrivate.ptr; - ENTER_PROC("SMI_FreeSurface"); + ENTER(); if (ptrOffscreen->isOn) { SMI_StopSurface(surface); @@ -2505,8 +2465,7 @@ SMI_FreeSurface( xfree(surface->offsets); xfree(surface->devPrivate.ptr); - LEAVE_PROC("SMI_FreeSurface"); - return Success; + RETURN(Success); } static int @@ -2529,7 +2488,7 @@ SMI_DisplaySurface( INT32 x1, y1, x2, y2; BoxRec dstBox; - ENTER_PROC("SMI_DisplaySurface"); + ENTER(); x1 = vid_x; x2 = vid_x + vid_w; @@ -2542,10 +2501,8 @@ SMI_DisplaySurface( dstBox.y2 = drw_y + drw_h; if (!SMI_ClipVideo(surface->pScrn, &dstBox, &x1, &y1, &x2, &y2, clipBoxes, - surface->width, surface->height)) { - LEAVE_PROC("SMI_DisplaySurface"); - return Success; - } + surface->width, surface->height)) + RETURN(Success); dstBox.x1 -= surface->pScrn->frameX0; dstBox.y1 -= surface->pScrn->frameY0; @@ -2578,8 +2535,7 @@ SMI_DisplaySurface( pPort->freeTime = currentTime.milliseconds + FREE_DELAY; } - LEAVE_PROC("SMI_DisplaySurface"); - return Success; + RETURN(Success); } static int @@ -2589,7 +2545,7 @@ SMI_StopSurface( { SMI_OffscreenPtr ptrOffscreen = (SMI_OffscreenPtr) surface->devPrivate.ptr; - ENTER_PROC("SMI_StopSurface"); + ENTER(); if (ptrOffscreen->isOn) { SMIPtr pSmi = SMIPTR(surface->pScrn); @@ -2602,8 +2558,7 @@ SMI_StopSurface( ptrOffscreen->isOn = FALSE; } - LEAVE_PROC("SMI_StopSurface"); - return Success; + RETURN(Success); } static int diff --git a/src/smi_xaa.c b/src/smi_xaa.c index 51d79c6..3414a01 100644 --- a/src/smi_xaa.c +++ b/src/smi_xaa.c @@ -75,13 +75,11 @@ SMI_XAAInit(ScreenPtr pScreen) Bool ret; /*int numLines, maxLines;*/ - ENTER_PROC("SMI_XAAInit"); + ENTER(); pSmi->XAAInfoRec = infoPtr = XAACreateInfoRec(); - if (infoPtr == NULL) { - LEAVE_PROC("SMI_AccelInit"); - return FALSE; - } + if (infoPtr == NULL) + RETURN(FALSE); infoPtr->Flags = PIXMAP_CACHE | LINEAR_FRAMEBUFFER @@ -222,8 +220,7 @@ SMI_XAAInit(ScreenPtr pScreen) infoPtr->ValidatePolylines = SMI_ValidatePolylines; } - LEAVE_PROC("SMI_XAAInit"); - return ret; + RETURN(ret); } /******************************************************************************/ @@ -236,9 +233,8 @@ SMI_SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop, { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_SetupForScreenToScreenCopy"); - DEBUG((VERBLEV, "xdir=%d ydir=%d rop=%02X trans=%08X\n", xdir, ydir, - rop, trans)); + ENTER(); + DEBUG("xdir=%d ydir=%d rop=%02X trans=%08X\n", xdir, ydir, rop, trans); #if __BYTE_ORDER == __BIG_ENDIAN if (pScrn->depth >= 24) @@ -264,7 +260,7 @@ SMI_SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop, pSmi->ClipTurnedOn = FALSE; } - LEAVE_PROC("SMI_SetupForScreenToScreenCopy"); + LEAVE(); } static void @@ -273,8 +269,8 @@ SMI_SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2, { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_SubsequentScreenToScreenCopy"); - DEBUG((VERBLEV, "x1=%d y1=%d x2=%d y2=%d w=%d h=%d\n", x1, y1, x2, y2, w, h)); + ENTER(); + DEBUG("x1=%d y1=%d x2=%d y2=%d w=%d h=%d\n", x1, y1, x2, y2, w, h); if (pSmi->AccelCmd & SMI_RIGHT_TO_LEFT) { x1 += w - 1; @@ -306,7 +302,7 @@ SMI_SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2, WRITE_DPR(pSmi, 0x08, (w << 16) + (h & 0xFFFF)); WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd); - LEAVE_PROC("SMI_SubsequentScreenToScreenCopy"); + LEAVE(); } /******************************************************************************/ @@ -319,8 +315,8 @@ SMI_SetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_SetupForSolidFill"); - DEBUG((VERBLEV, "color=%08X rop=%02X\n", color, rop)); + ENTER(); + DEBUG("color=%08X rop=%02X\n", color, rop); pSmi->AccelCmd = XAAGetPatternROP(rop) | SMI_BITBLT @@ -350,7 +346,7 @@ SMI_SetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, WRITE_DPR(pSmi, 0x34, 0xFFFFFFFF); WRITE_DPR(pSmi, 0x38, 0xFFFFFFFF); - LEAVE_PROC("SMI_SetupForSolidFill"); + LEAVE(); } void @@ -358,8 +354,8 @@ SMI_SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h) { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_SubsequentSolidFillRect"); - DEBUG((VERBLEV, "x=%d y=%d w=%d h=%d\n", x, y, w, h)); + ENTER(); + DEBUG("x=%d y=%d w=%d h=%d\n", x, y, w, h); if (pScrn->bitsPerPixel == 24) { x *= 3; @@ -384,7 +380,7 @@ SMI_SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h) WRITE_DPR(pSmi, 0x08, (w << 16) | (h & 0xFFFF)); WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd); - LEAVE_PROC("SMI_SubsequentSolidFillRect"); + LEAVE(); } /******************************************************************************/ @@ -398,8 +394,8 @@ SMI_SubsequentSolidHorVertLine(ScrnInfoPtr pScrn, int x, int y, int len, SMIPtr pSmi = SMIPTR(pScrn); int w, h; - ENTER_PROC("SMI_SubsequentSolidHorVertLine"); - DEBUG((VERBLEV, "x=%d y=%d len=%d dir=%d\n", x, y, len, dir)); + ENTER(); + DEBUG("x=%d y=%d len=%d dir=%d\n", x, y, len, dir); if (dir == DEGREES_0) { w = len; @@ -424,7 +420,7 @@ SMI_SubsequentSolidHorVertLine(ScrnInfoPtr pScrn, int x, int y, int len, WRITE_DPR(pSmi, 0x08, (w << 16) | (h & 0xFFFF)); WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd); - LEAVE_PROC("SMI_SubsequentSolidHorVertLine"); + LEAVE(); } /******************************************************************************/ @@ -437,8 +433,8 @@ SMI_SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, int bg, { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_SetupForCPUToScreenColorExpandFill"); - DEBUG((VERBLEV, "fg=%08X bg=%08X rop=%02X\n", fg, bg, rop)); + ENTER(); + DEBUG("fg=%08X bg=%08X rop=%02X\n", fg, bg, rop); #if __BYTE_ORDER == __BIG_ENDIAN if (pScrn->depth >= 24) { @@ -472,7 +468,7 @@ SMI_SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, int bg, WRITE_DPR(pSmi, 0x18, bg); } - LEAVE_PROC("SMI_SetupForCPUToScreenColorExpandFill"); + LEAVE(); } void @@ -481,8 +477,8 @@ SMI_SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, int y, int w, { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_SubsequentCPUToScreenColorExpandFill"); - DEBUG((VERBLEV, "x=%d y=%d w=%d h=%d skipleft=%d\n", x, y, w, h, skipleft)); + ENTER(); + DEBUG("x=%d y=%d w=%d h=%d skipleft=%d\n", x, y, w, h, skipleft); if (pScrn->bitsPerPixel == 24) { x *= 3; @@ -514,7 +510,7 @@ SMI_SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, int y, int w, WRITE_DPR(pSmi, 0x08, (w << 16) | (h & 0xFFFF)); WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd); - LEAVE_PROC("SMI_SubsequentCPUToScreenColorExpandFill"); + LEAVE(); } /******************************************************************************/ @@ -527,9 +523,9 @@ SMI_SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty, int fg, { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_SetupForMono8x8PatternFill"); - DEBUG((VERBLEV, "patx=%08X paty=%08X fg=%08X bg=%08X rop=%02X\n", patx, - paty, fg, bg, rop)); + ENTER(); + DEBUG("patx=%08X paty=%08X fg=%08X bg=%08X rop=%02X\n", + patx, paty, fg, bg, rop); #if __BYTE_ORDER == __BIG_ENDIAN if (pScrn->depth >= 24) { @@ -569,7 +565,7 @@ SMI_SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty, int fg, WRITE_DPR(pSmi, 0x38, paty); } - LEAVE_PROC("SMI_SetupForMono8x8PatternFill"); + LEAVE(); } static void @@ -578,8 +574,8 @@ SMI_SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int patx, int paty, { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_SubsequentMono8x8PatternFillRect"); - DEBUG((VERBLEV, "x=%d y=%d w=%d h=%d\n", x, y, w, h)); + ENTER(); + DEBUG("x=%d y=%d w=%d h=%d\n", x, y, w, h); if (pScrn->bitsPerPixel == 24) { x *= 3; @@ -595,7 +591,7 @@ SMI_SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int patx, int paty, WRITE_DPR(pSmi, 0x08, (w << 16) | (h & 0xFFFF)); WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd); - LEAVE_PROC("SMI_SubsequentMono8x8PatternFillRect"); + LEAVE(); } /******************************************************************************/ @@ -608,9 +604,9 @@ SMI_SetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty, int rop, { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_SetupForColor8x8PatternFill"); - DEBUG((VERBLEV, "patx=%d paty=%d rop=%02X trans_color=%08X\n", patx, paty, - rop, trans_color)); + ENTER(); + DEBUG("patx=%d paty=%d rop=%02X trans_color=%08X\n", + patx, paty, rop, trans_color); pSmi->AccelCmd = XAAGetPatternROP(rop) | SMI_BITBLT @@ -657,7 +653,7 @@ SMI_SetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty, int rop, pSmi->ClipTurnedOn = FALSE; } - LEAVE_PROC("SMI_SetupForColor8x8PatternFill"); + LEAVE(); } static void @@ -666,8 +662,8 @@ SMI_SubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, int patx, int paty, { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_SubsequentColor8x8PatternFillRect"); - DEBUG((VERBLEV, "x=%d y=%d w=%d h=%d\n", x, y, w, h)); + ENTER(); + DEBUG("x=%d y=%d w=%d h=%d\n", x, y, w, h); if (pScrn->bitsPerPixel == 24) { x *= 3; @@ -684,7 +680,7 @@ SMI_SubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, int patx, int paty, WRITE_DPR(pSmi, 0x08, (w << 16) | (h & 0xFFFF)); /* PDR#950 */ WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd); - LEAVE_PROC("SMI_SubsequentColor8x8PatternFillRect"); + LEAVE(); } #if SMI_USE_IMAGE_WRITES @@ -698,9 +694,9 @@ SMI_SetupForImageWrite(ScrnInfoPtr pScrn, int rop, unsigned int planemask, { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_SetupForImageWrite"); - DEBUG((VERBLEV, "rop=%02X trans_color=%08X bpp=%d depth=%d\n", rop, - trans_color, bpp, depth)); + ENTER(); + DEBUG("rop=%02X trans_color=%08X bpp=%d depth=%d\n", + rop, trans_color, bpp, depth); #if __BYTE_ORDER == __BIG_ENDIAN if (pScrn->depth >= 24) @@ -721,7 +717,7 @@ SMI_SetupForImageWrite(ScrnInfoPtr pScrn, int rop, unsigned int planemask, WRITE_DPR(pSmi, 0x20, trans_color); } - LEAVE_PROC("SMI_SetupForImageWrite"); + LEAVE(); } static void @@ -730,8 +726,8 @@ SMI_SubsequentImageWriteRect(ScrnInfoPtr pScrn, int x, int y, int w, int h, { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_SubsequentImageWriteRect"); - DEBUG((VERBLEV, "x=%d y=%d w=%d h=%d skipleft=%d\n", x, y, w, h, skipleft)); + ENTER(); + DEBUG("x=%d y=%d w=%d h=%d skipleft=%d\n", x, y, w, h, skipleft); if (pScrn->bitsPerPixel == 24) { x *= 3; @@ -763,7 +759,7 @@ SMI_SubsequentImageWriteRect(ScrnInfoPtr pScrn, int x, int y, int w, int h, WRITE_DPR(pSmi, 0x08, (w << 16) | (h & 0xFFFF)); WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd); - LEAVE_PROC("SMI_SubsequentImageWriteRect"); + LEAVE(); } #endif @@ -824,7 +820,7 @@ SMI_ValidatePolylines(GCPtr pGC, unsigned long changes, DrawablePtr pDraw) XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); SMIPtr pSmi = SMIPTR(infoRec->pScrn); - ENTER_PROC("SMI_ValidatePolylines"); + ENTER(); pSmi->ValidatePolylines(pGC, changes, pDraw); if (pGC->ops->Polylines == XAAGetFallbackOps()->Polylines) { @@ -832,7 +828,7 @@ SMI_ValidatePolylines(GCPtr pGC, unsigned long changes, DrawablePtr pDraw) pGC->ops->Polylines = SMI_Polylines; } - LEAVE_PROC("SMI_ValidatePolylines"); + LEAVE(); } static void @@ -843,7 +839,7 @@ SMI_Polylines(DrawablePtr pDraw, GCPtr pGC, int mode, int npt, ScrnInfoPtr pScrn = infoRec->pScrn; SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_Polylines"); + ENTER(); /* Call the original Polylines function. */ pGC->ops->Polylines = XAAGetFallbackOps()->Polylines; @@ -916,6 +912,6 @@ SMI_Polylines(DrawablePtr pDraw, GCPtr pGC, int mode, int npt, } pSmi->polyLines = TRUE; - LEAVE_PROC("SMI_Polylines"); + LEAVE(); } |