summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/xgi.h5
-rw-r--r--src/xgi_accel.c76
-rw-r--r--src/xgi_accel.h7
-rw-r--r--src/xgi_driver.c9
4 files changed, 38 insertions, 59 deletions
diff --git a/src/xgi.h b/src/xgi.h
index 1fd0359..1f2550c 100644
--- a/src/xgi.h
+++ b/src/xgi.h
@@ -754,6 +754,11 @@ typedef struct {
XGI_DSReg SRList[ExtRegSize] ;
XGI_DSReg CRList[ExtRegSize] ;
+ /**
+ * Total number of iterations to wait in \c Volari_Idle.
+ */
+ unsigned int idle_wait_count;
+
//:::: for capture
Bool v4l_videoin;
int v4l_devnum; /* v4l device number, 0,1,2....*/
diff --git a/src/xgi_accel.c b/src/xgi_accel.c
index bfeb484..330ed5d 100644
--- a/src/xgi_accel.c
+++ b/src/xgi_accel.c
@@ -129,63 +129,47 @@ static void dump_cq_read_pointer(unsigned int cqrp)
#endif /* DEBUG */
+void Volari_SetDefaultIdleWait(XGIPtr pXGI, unsigned HDisplay,
+ unsigned depth)
+{
+ static const unsigned wait_table[5][4] = {
+ { 1, 1, 1, 1 },
+ { 65535, 1, 1000, 3000 },
+ { 65535, 160, 1200, 4000 },
+ { 65535, 200, 1600, 6000 },
+ { 65535, 500, 2000, 8000 }
+ };
+
+ if (pXGI->Chipset == PCI_CHIP_XGIXG20) {
+ unsigned i;
+
+ switch (HDisplay) {
+ case 640: i = 1; break;
+ case 800: i = 2; break;
+ case 1024: i = 3; break;
+ case 1280: i = 4; break;
+ default: i = 0; break;
+ }
+
+ pXGI->idle_wait_count = wait_table[i][3 & (depth / 8)];
+ }
+ else {
+ pXGI->idle_wait_count = 65535;
+ }
+}
+
void Volari_Idle(XGIPtr pXGI)
{
int i;
- unsigned int WaitCount = 65535;
#ifdef DEBUG
unsigned int last_cqrp = 0;
#endif /* DEBUG */
- if (pXGI->Chipset == PCI_CHIP_XGIXG20) {
- WaitCount = 1;
- switch (CurrentHDisplay) {
- case 640:
- if(CurrentColorDepth == 8)
- WaitCount=1;
- else if(CurrentColorDepth == 16)
- WaitCount=1000;
- else if(CurrentColorDepth == 24)
- WaitCount=3000;
- break;
-
- case 800:
- if(CurrentColorDepth == 8)
- WaitCount=160;
- else if(CurrentColorDepth == 16)
- WaitCount=1200;
- else if(CurrentColorDepth == 24)
- WaitCount=4000;
- break;
-
- case 1024:
- if(CurrentColorDepth == 8)
- WaitCount=200;
- else if(CurrentColorDepth == 16)
- WaitCount=1600;
- else if(CurrentColorDepth == 24)
- WaitCount=6000;
- break;
-
- case 1280:
- if(CurrentColorDepth == 8)
- WaitCount=500;
- else if(CurrentColorDepth == 16)
- WaitCount=2000;
- else if(CurrentColorDepth == 24)
- WaitCount=8000;
- break;
-
- default:
- break;
- }
- }
-
do {
int bIdle = 0;
unsigned int cqrp;
- for (i = 0; i < WaitCount; i++) {
+ for (i = 0; i < pXGI->idle_wait_count; i++) {
cqrp = MMIO_IN32(pXGI->IOBase, 0x85CC);
if (cqrp & IDLE_ALL) {
bIdle = 1;
diff --git a/src/xgi_accel.h b/src/xgi_accel.h
index 0ecfa16..8f5d005 100644
--- a/src/xgi_accel.h
+++ b/src/xgi_accel.h
@@ -124,11 +124,8 @@ int G2CmdQueLen;
int Alignment ;
/* int GBCount = 0 ; */
-/* Jong Lin 08-26-2005 */
-extern unsigned int CurrentHDisplay;
-extern unsigned int CurrentVDisplay;
-extern unsigned int CurrentColorDepth;
-
+extern void Volari_SetDefaultIdleWait(XGIPtr pXGI, unsigned HDisplay,
+ unsigned depth);
extern void Volari_Idle(XGIPtr pXGI);
#define Volari_GetSwWP() (unsigned long)(*(pXGI->pCQ_shareWritePort))
diff --git a/src/xgi_driver.c b/src/xgi_driver.c
index bf1e2b8..0033956 100644
--- a/src/xgi_driver.c
+++ b/src/xgi_driver.c
@@ -106,11 +106,6 @@ void Volari_EnableAccelerator(ScrnInfoPtr pScrn);
static int XGIEntityIndex = -1;
#endif
-/* Jong Lin 08-26-2005; keep current mode info */
-unsigned int CurrentHDisplay;
-unsigned int CurrentVDisplay;
-unsigned int CurrentColorDepth;
-
/*
* This is intentionally screen-independent. It indicates the binding
* choice made in the first PreInit.
@@ -3803,9 +3798,7 @@ XGIModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
PDEBUG(ErrorF("XGIModeInit Color Depth (%d) \n", pScrn->depth));
/* Jong Lin 08-26-2005; save current mode */
- CurrentHDisplay = mode->HDisplay;
- CurrentVDisplay = mode->VDisplay;
- CurrentColorDepth = pScrn->depth;
+ Volari_SetDefaultIdleWait(pXGI, mode->HDisplay, pScrn->depth);
andXGIIDXREG(XGICR, 0x11, 0x7f); /* Unlock CRTC registers */