diff --git a/src/i830.h b/src/i830.h index 3abc800..2c1ac86 100644 --- a/src/i830.h +++ b/src/i830.h @@ -664,7 +664,7 @@ i830_crtc_hide_cursor (xf86CrtcPtr crtc); void i830_crtc_set_cursor_colors (xf86CrtcPtr crtc, int bg, int fg); -extern void I830RefreshRing(ScrnInfoPtr pScrn); +extern void i830_refresh_ring(ScrnInfoPtr pScrn); extern void I830EmitFlush(ScrnInfoPtr pScrn); #ifdef I830_XV diff --git a/src/i830_accel.c b/src/i830_accel.c index 4d9ea79..7501c2b 100644 --- a/src/i830_accel.c +++ b/src/i830_accel.c @@ -249,25 +249,6 @@ I830SelectBuffer(ScrnInfoPtr pScrn, int buffer) buffer, pI830->bufferOffset); } -void -I830RefreshRing(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - - /* If we're reaching RefreshRing as a result of grabbing the DRI lock - * before we've set up the ringbuffer, don't bother. - */ - if (pI830->LpRing->mem == NULL) - return; - - pI830->LpRing->head = INREG(LP_RING + RING_HEAD) & I830_HEAD_MASK; - pI830->LpRing->tail = INREG(LP_RING + RING_TAIL); - pI830->LpRing->space = pI830->LpRing->head - (pI830->LpRing->tail + 8); - if (pI830->LpRing->space < 0) - pI830->LpRing->space += pI830->LpRing->mem->size; - i830MarkSync(pScrn); -} - /* The following function sets up the supported acceleration. Call it * from the FbInit() function in the SVGA driver, or before ScreenInit * in a monolithic server. diff --git a/src/i830_dri.c b/src/i830_dri.c index 4928808..b223b02 100644 --- a/src/i830_dri.c +++ b/src/i830_dri.c @@ -1093,7 +1093,7 @@ I830DRISwapContext(ScreenPtr pScreen, DRISyncType syncType, if (!pScrn->vtSema) return; pI830->LockHeld = 1; - I830RefreshRing(pScrn); + i830_refresh_ring(pScrn); I830EmitFlush(pScrn); @@ -1777,7 +1777,7 @@ I830DRILock(ScrnInfoPtr pScrn) if (pI830->directRenderingEnabled && !pI830->LockHeld) { DRILock(screenInfo.screens[pScrn->scrnIndex], 0); pI830->LockHeld = 1; - I830RefreshRing(pScrn); + i830_refresh_ring(pScrn); return TRUE; } else diff --git a/src/i830_driver.c b/src/i830_driver.c index e000d92..c2d4aa3 100644 --- a/src/i830_driver.c +++ b/src/i830_driver.c @@ -1730,7 +1730,7 @@ I830PreInit(ScrnInfoPtr pScrn, int flags) * whoever gets control next should do. */ static void -ResetState(ScrnInfoPtr pScrn, Bool flush) +i830_stop_ring(ScrnInfoPtr pScrn, Bool flush) { I830Ptr pI830 = I830PTR(pScrn); unsigned long temp; @@ -1747,7 +1747,7 @@ ResetState(ScrnInfoPtr pScrn, Bool flush) #define flush_ring() do { \ temp = INREG(LP_RING + RING_LEN); \ if (temp & RING_VALID) { \ - I830RefreshRing(pScrn); \ + i830_refresh_ring(pScrn); \ I830Sync(pScrn); \ DO_RING_IDLE(); \ } \ @@ -1765,12 +1765,10 @@ ResetState(ScrnInfoPtr pScrn, Bool flush) OUTREG(LP_RING + RING_HEAD, 0); OUTREG(LP_RING + RING_TAIL, 0); OUTREG(LP_RING + RING_START, 0); - - xf86_hide_cursors (pScrn); } static void -SetRingRegs(ScrnInfoPtr pScrn) +i830_start_ring(ScrnInfoPtr pScrn) { I830Ptr pI830 = I830PTR(pScrn); unsigned int itemp; @@ -1807,7 +1805,26 @@ SetRingRegs(ScrnInfoPtr pScrn) itemp = (pI830->LpRing->mem->size - 4096) & I830_RING_NR_PAGES; itemp |= (RING_NO_REPORT | RING_VALID); OUTREG(LP_RING + RING_LEN, itemp); - I830RefreshRing(pScrn); + i830_refresh_ring(pScrn); +} + +void +i830_refresh_ring(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + + /* If we're reaching RefreshRing as a result of grabbing the DRI lock + * before we've set up the ringbuffer, don't bother. + */ + if (pI830->LpRing->mem == NULL) + return; + + pI830->LpRing->head = INREG(LP_RING + RING_HEAD) & I830_HEAD_MASK; + pI830->LpRing->tail = INREG(LP_RING + RING_TAIL); + pI830->LpRing->space = pI830->LpRing->head - (pI830->LpRing->tail + 8); + if (pI830->LpRing->space < 0) + pI830->LpRing->space += pI830->LpRing->mem->size; + i830MarkSync(pScrn); } /* @@ -1835,7 +1852,7 @@ SetHWOperatingState(ScrnInfoPtr pScrn) } if (!pI830->noAccel) - SetRingRegs(pScrn); + i830_start_ring(pScrn); if (!pI830->SWCursor) I830InitHWCursor(pScrn); } @@ -3002,10 +3019,10 @@ I830LeaveVT(int scrnIndex, int flags) xf86_hide_cursors (pScrn); - ResetState(pScrn, TRUE); - RestoreHWState(pScrn); + i830_stop_ring(pScrn, TRUE); + if (pI830->debug_modes) { i830CompareRegsToSnapshot(pScrn, "After LeaveVT"); i830DumpRegs (pScrn); @@ -3078,7 +3095,7 @@ I830EnterVT(int scrnIndex, int flags) "Existing errors found in hardware state.\n"); } - ResetState(pScrn, FALSE); + i830_stop_ring(pScrn, FALSE); SetHWOperatingState(pScrn); /* Clear the framebuffer */ @@ -3099,7 +3116,7 @@ I830EnterVT(int scrnIndex, int flags) } i830DescribeOutputConfiguration(pScrn); - ResetState(pScrn, TRUE); + i830_stop_ring(pScrn, TRUE); SetHWOperatingState(pScrn); #ifdef XF86DRI @@ -3119,7 +3136,7 @@ I830EnterVT(int scrnIndex, int flags) I830DRIResume(screenInfo.screens[scrnIndex]); - I830RefreshRing(pScrn); + i830_refresh_ring(pScrn); I830Sync(pScrn); DO_RING_IDLE();