diff options
author | Gabriel Mansi <gabriel.mansi@gmail.com> | 2007-05-15 16:47:00 +0000 |
---|---|---|
committer | Gabriel Mansi <gabriel.mansi@gmail.com> | 2007-05-15 16:47:00 +0000 |
commit | 49df7cf1cb7b49ae1664b369eedbff36e3831f3a (patch) | |
tree | a21a16ea01dbe00f827ec09748362b235a89fd6d | |
parent | 0a964bfd43c1efe5d83d35b69df431581dd0d4f8 (diff) |
Xv code cleanup
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | unichrome/via.h | 5 | ||||
-rw-r--r-- | unichrome/via_driver.c | 9 | ||||
-rw-r--r-- | unichrome/via_driver.h | 1 | ||||
-rw-r--r-- | unichrome/via_swov.c | 28 | ||||
-rw-r--r-- | unichrome/via_video.c | 13 |
6 files changed, 35 insertions, 32 deletions
@@ -1,3 +1,14 @@ +2007-05-15 Gabriel Mansi <gabriel-dot-mansi-at-gmail-dot-com> + + * unichrome/via.h: + * unichrome/via_driver.c: (VIASetupDefaultOptions): + * unichrome/via_driver.h: + * unichrome/via_swov.c: (viaWaitHQVFlip), (SetColorKey), + (SetChromaKey), (Upd_Video): + * unichrome/via_video.c: (Flip), (viaDmaBlitImage), (viaPutImage): + + Xv code cleanup. + 2007-05-10 Jon Nettleton <jon-dot-nettleton-at-gmail-dot-com> * unichrome/via_driver.c: diff --git a/unichrome/via.h b/unichrome/via.h index 6a20a68..fb6bfc5 100644 --- a/unichrome/via.h +++ b/unichrome/via.h @@ -39,6 +39,11 @@ #include "xf86_ansic.h" #endif +/* Video Engines */ +#define VIDEO_ENGINE_UNK 0 /* Unknown video engine */ +#define VIDEO_ENGINE_CLE 1 /* CLE First generaion video engine */ +#define VIDEO_ENGINE_CME 2 /* CME Second generation video engine */ + /* Video status flag */ #define VIDEO_HIDE 0x00000000 /*Video off*/ diff --git a/unichrome/via_driver.c b/unichrome/via_driver.c index e33df31..8505dc0 100644 --- a/unichrome/via_driver.c +++ b/unichrome/via_driver.c @@ -710,6 +710,7 @@ static Bool VIASetupDefaultOptions(ScrnInfoPtr pScrn) pVia->maxDriSize = 0; pVia->agpMem = AGP_SIZE / 1024; pVia->ActiveDevice = 0x00; + pVia->VideoEngine = VIDEO_ENGINE_CLE; #ifdef HAVE_DEBUG pVia->PrintVGARegs = FALSE; #endif @@ -723,11 +724,15 @@ static Bool VIASetupDefaultOptions(ScrnInfoPtr pScrn) pVia->DRIIrqEnable = FALSE; break; case VIA_K8M890: - pVia->agpEnable = FALSE; - break; case VIA_P4M900: + pVia->VideoEngine = VIDEO_ENGINE_CME; pVia->agpEnable = FALSE; break; + case VIA_PM800: + case VIA_CX700: + case VIA_P4M890: + pVia->VideoEngine = VIDEO_ENGINE_CME; + break; } return TRUE; diff --git a/unichrome/via_driver.h b/unichrome/via_driver.h index 9a04f1f..c8acd45 100644 --- a/unichrome/via_driver.h +++ b/unichrome/via_driver.h @@ -346,6 +346,7 @@ typedef struct _VIA { CARD32 CursorMC; /* Video */ + int VideoEngine; swovRec swov; CARD32 VideoStatus; VIAHWDiff HWDiff; diff --git a/unichrome/via_swov.c b/unichrome/via_swov.c index 1dbbc16..74c0ade 100644 --- a/unichrome/via_swov.c +++ b/unichrome/via_swov.c @@ -94,9 +94,7 @@ viaWaitHQVFlip(VIAPtr pVia) pdwState = (CARD32 volatile *)(pVia->VidMapBase + (HQV_CONTROL + proReg)); - if (pVia->ChipId == PCI_CHIP_VT3259 || pVia->ChipId == PCI_CHIP_VT3336 || - pVia->ChipId == PCI_CHIP_VT3157 || pVia->ChipId == PCI_CHIP_VT3327 || - pVia->ChipId == PCI_CHIP_VT3364) { + if (pVia->VideoEngine == VIDEO_ENGINE_CME) { while (*pdwState & (HQV_SUBPIC_FLIP | HQV_SW_FLIP)) ; } else { while (!(*pdwState & HQV_FLIP_STATUS)) ; @@ -1448,9 +1446,7 @@ SetColorKey(VIAPtr pVia, unsigned long videoFlag, CARD32 keyLow, CARD32 keyHigh, CARD32 compose) { keyLow &= 0x00FFFFFF; - if (pVia->ChipId == PCI_CHIP_VT3259 || pVia->ChipId == PCI_CHIP_VT3327 || - pVia->ChipId == PCI_CHIP_VT3336 || pVia->ChipId == PCI_CHIP_VT3157 || - pVia->ChipId == PCI_CHIP_VT3364) + if (pVia->VideoEngine == VIDEO_ENGINE_CME) keyLow |= 0x40000000; /*SaveVideoRegister(pVia, V_COLOR_KEY, keyLow); */ @@ -1482,9 +1478,7 @@ SetChromaKey(VIAPtr pVia, unsigned long videoFlag, chromaLow |= (VIDInD(V_CHROMAKEY_LOW) & ~CHROMA_KEY_LOW); chromaHigh |= (VIDInD(V_CHROMAKEY_HIGH) & ~CHROMA_KEY_HIGH); - if (pVia->ChipId == PCI_CHIP_VT3259 || pVia->ChipId == PCI_CHIP_VT3327 || - pVia->ChipId == PCI_CHIP_VT3336 || pVia->ChipId == PCI_CHIP_VT3157 || - pVia->ChipId == PCI_CHIP_VT3364) + if (pVia->VideoEngine == VIDEO_ENGINE_CME) chromaLow |= 0x40000000; SaveVideoRegister(pVia, V_CHROMAKEY_HIGH, chromaHigh); @@ -1756,9 +1750,7 @@ Upd_Video(ScrnInfoPtr pScrn, unsigned long videoFlag, pVia->swov.overlayRecordV1.dwOffset, pVia->swov.overlayRecordV1.dwUVoffset, srcPitch, oriSrcHeight); - if (pVia->ChipId == PCI_CHIP_VT3259 || pVia->ChipId == PCI_CHIP_VT3327 || - pVia->ChipId == PCI_CHIP_VT3336 || pVia->ChipId == PCI_CHIP_VT3157 || - pVia->ChipId == PCI_CHIP_VT3364) { + if (pVia->VideoEngine == VIDEO_ENGINE_CME) { SaveVideoRegister(pVia, HQV_SRC_STARTADDR_Y + proReg, YCbCr.dwY); SaveVideoRegister(pVia, HQV_SRC_STARTADDR_U + proReg, @@ -1796,9 +1788,7 @@ Upd_Video(ScrnInfoPtr pScrn, unsigned long videoFlag, pVia->swov.overlayRecordV1.dwHQVAddr[1] + hqvOffset, pVia->swov.overlayRecordV1.dwHQVAddr[2] + hqvOffset); - if (pVia->ChipId == PCI_CHIP_VT3259 || pVia->ChipId == PCI_CHIP_VT3327 || - pVia->ChipId == PCI_CHIP_VT3336 || pVia->ChipId == PCI_CHIP_VT3157 || - pVia->ChipId == PCI_CHIP_VT3364) + if (pVia->VideoEngine == VIDEO_ENGINE_CME) SaveVideoRegister(pVia, 0x1cc + proReg, dwOffset); SaveVideoRegister(pVia, HQV_SRC_STARTADDR_Y + proReg, startAddr); } else { @@ -2002,9 +1992,7 @@ Upd_Video(ScrnInfoPtr pScrn, unsigned long videoFlag, usleep(1); } - if (pVia->ChipId == PCI_CHIP_VT3259 || pVia->ChipId == PCI_CHIP_VT3327 || - pVia->ChipId == PCI_CHIP_VT3336 || pVia->ChipId == PCI_CHIP_VT3157 || - pVia->ChipId == PCI_CHIP_VT3364) + if (pVia->VideoEngine == VIDEO_ENGINE_CME) hqvCtl |= HQV_GEN_IRQ; VIDOutD(HQV_CONTROL + proReg, hqvCtl & ~HQV_SW_FLIP); @@ -2013,9 +2001,7 @@ Upd_Video(ScrnInfoPtr pScrn, unsigned long videoFlag, DBG_DD(ErrorF("HQV control wf5 - %08lx\n", *HQVCtrl)); DBG_DD(ErrorF(" Wait flips5")); - if (pVia->ChipId != PCI_CHIP_VT3259 && pVia->ChipId != PCI_CHIP_VT3327 && - pVia->ChipId != PCI_CHIP_VT3336 && pVia->ChipId != PCI_CHIP_VT3157 && - pVia->ChipId != PCI_CHIP_VT3364) { + if (pVia->VideoEngine != VIDEO_ENGINE_CME) { for (i = 0; (i < 50) && !(*HQVCtrl & HQV_FLIP_STATUS); i++) { DBG_DD(ErrorF(" HQV wait %d %08lx\n", i, *HQVCtrl)); diff --git a/unichrome/via_video.c b/unichrome/via_video.c index beb4d03..588acc5 100644 --- a/unichrome/via_video.c +++ b/unichrome/via_video.c @@ -1088,9 +1088,7 @@ Flip(VIAPtr pVia, viaPortPrivPtr pPriv, int fourcc, while ((VIDInD(HQV_CONTROL + proReg) & HQV_SW_FLIP)) ; VIDOutD(HQV_SRC_STARTADDR_Y + proReg, pVia->swov.SWDevice.dwSWPhysicalAddr[DisplayBufferIndex]); - if (pVia->ChipId == PCI_CHIP_VT3259 || pVia->ChipId == PCI_CHIP_VT3327 || - pVia->ChipId == PCI_CHIP_VT3336 || pVia->ChipId == PCI_CHIP_VT3157 || - pVia->ChipId == PCI_CHIP_VT3364) { + if (pVia->VideoEngine == VIDEO_ENGINE_CME) { VIDOutD(HQV_SRC_STARTADDR_U + proReg, pVia->swov.SWDevice.dwSWCrPhysicalAddr[DisplayBufferIndex]); } else { @@ -1144,9 +1142,8 @@ viaDmaBlitImage(VIAPtr pVia, Bool nv12Conversion; bounceBuffer = ((unsigned long)src & 15); - nv12Conversion = ((pVia->ChipId == PCI_CHIP_VT3259 || pVia->ChipId == PCI_CHIP_VT3327 || - pVia->ChipId == PCI_CHIP_VT3336 || pVia->ChipId == PCI_CHIP_VT3157 || - pVia->ChipId == PCI_CHIP_VT3364) && (id == FOURCC_YV12)); + nv12Conversion = (pVia->VideoEngine == VIDEO_ENGINE_CME && + id == FOURCC_YV12); switch (id) { case FOURCC_YUY2: @@ -1338,9 +1335,7 @@ viaPutImage(ScrnInfoPtr pScrn, } else { switch (id) { case FOURCC_YV12: - if (pVia->ChipId == PCI_CHIP_VT3259 || pVia->ChipId == PCI_CHIP_VT3327 || - pVia->ChipId == PCI_CHIP_VT3336 || pVia->ChipId == PCI_CHIP_VT3157 || - pVia->ChipId == PCI_CHIP_VT3364) { + if (pVia->VideoEngine == VIDEO_ENGINE_CME) { nv12cp(pVia->swov.SWDevice. lpSWOverlaySurface[pVia->dwFrameNum & 1], buf, dstPitch, width, height, 0); |