diff options
Diffstat (limited to 'xc/lib/GL/mesa/src/drv/r128/r128_cce.c')
-rw-r--r-- | xc/lib/GL/mesa/src/drv/r128/r128_cce.c | 53 |
1 files changed, 30 insertions, 23 deletions
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_cce.c b/xc/lib/GL/mesa/src/drv/r128/r128_cce.c index 9f9fec81c..63742fe78 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_cce.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_cce.c @@ -38,6 +38,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r128_reg.h" #include "r128_cce.h" +/* FIXME: Requires access to secure registers */ static int INPLL(r128ScreenPtr pScrn, int addr) { unsigned char *R128MMIO = pScrn->mmio; @@ -46,6 +47,7 @@ static int INPLL(r128ScreenPtr pScrn, int addr) return INREG(R128_CLOCK_CNTL_DATA); } +/* FIXME: Requires access to secure registers */ void R128EngineFlush(r128ScreenPtr pScrn) { unsigned char *R128MMIO = pScrn->mmio; @@ -57,6 +59,7 @@ void R128EngineFlush(r128ScreenPtr pScrn) } } +/* FIXME: Requires access to secure registers */ void R128EngineReset(r128ScreenPtr pScrn) { unsigned char *R128MMIO = pScrn->mmio; @@ -83,6 +86,8 @@ void R128EngineReset(r128ScreenPtr pScrn) OUTREG(R128_GEN_RESET_CNTL, gen_reset_cntl); } +/* The FIFO has 64 slots. This routines waits until at least `entries' + of these slots are empty. */ void R128WaitForFifoFunction(r128ScreenPtr pScrn, int entries) { unsigned char *R128MMIO = pScrn->mmio; @@ -100,6 +105,9 @@ void R128WaitForFifoFunction(r128ScreenPtr pScrn, int entries) } } +/* Wait for the graphics engine to be completely idle: the FIFO has + drained, the Pixel Cache is flushed, and the engine is idle. This is + a standard "sync" function that will make the hardware quiescent. */ void R128WaitForIdle(r128ScreenPtr pScrn) { unsigned char *R128MMIO = pScrn->mmio; @@ -120,6 +128,8 @@ void R128WaitForIdle(r128ScreenPtr pScrn) } } +/* Wait for at least `entries' slots are free. The actual number of + slots available is stored in info->CCEFifoSize. */ void R128CCEWaitForFifoFunction(r128ScreenPtr pScrn, int entries) { unsigned char *R128MMIO = pScrn->mmio; @@ -136,6 +146,8 @@ void R128CCEWaitForFifoFunction(r128ScreenPtr pScrn, int entries) } } +/* Wait until the CCE is completely idle: the FIFO has drained and the + CCE is idle. */ void R128CCEWaitForIdle(r128ScreenPtr pScrn) { unsigned char *R128MMIO = pScrn->mmio; @@ -157,28 +169,23 @@ void R128CCEWaitForIdle(r128ScreenPtr pScrn) } } -/* NOTE: This function must be called before using the CCE */ -void R128CCEStart(r128ScreenPtr pScrn) +/* Flush the CPU's write-combining cache */ +void R128FlushWCMemory(void) { - unsigned char *R128MMIO = pScrn->mmio; - - R128WaitForIdle(pScrn); - OUTREG(R128_PM4_BUFFER_CNTL, pScrn->CCEMode); - (void)INREG(R128_PM4_BUFFER_ADDR); /* as per the sample code */ - OUTREG(R128_PM4_MICRO_CNTL, R128_PM4_MICRO_FREERUN); -} - -/* NOTE: This function must be called before using the standard MMIO - mode for the X server. Also, this function is not (currently) called - by the client-side DRI driver; rather, it is only called in the X - server when the X server's context is swapped in. */ -void R128CCEEnd(r128ScreenPtr pScrn) -{ - unsigned char *R128MMIO = pScrn->mmio; - - R128CCEWaitForIdle(pScrn); - OUTREGP(R128_PM4_BUFFER_DL_WPTR, - R128_PM4_BUFFER_DL_DONE, ~R128_PM4_BUFFER_DL_DONE); - OUTREG(R128_PM4_MICRO_CNTL, 0); - OUTREG(R128_PM4_BUFFER_CNTL, R128_PM4_NONPM4); + int xchangeDummy; + + /* FIXME: This should be in standard XFree86 assembly format */ + __asm__ volatile("push %%eax ;" + "xchg %%eax, %0 ;" + "pop %%eax" : : "m" (xchangeDummy)); + __asm__ volatile("push %%eax ;" + "push %%ebx ;" + "push %%ecx ;" + "push %%edx ;" + "movl $0,%%eax ;" + "cpuid ;" + "pop %%edx ;" + "pop %%ecx ;" + "pop %%ebx ;" + "pop %%eax" : /* no outputs */ : /* no inputs */); } |