diff options
author | anholt <anholt> | 2003-02-21 07:15:40 +0000 |
---|---|---|
committer | anholt <anholt> | 2003-02-21 07:15:40 +0000 |
commit | 7ee9f8d25e3ffe804ca112e9f75cabdc676fbe4e (patch) | |
tree | 46c16ec3bb1a11c4d3be23861a09f9711acaad1f /xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accelfuncs.c | |
parent | eb77d6f367c09f476fc06263d7653dd5b4aecf7f (diff) |
Merge from trunk to bsd-4-0-0-branch.bsd-4-0-0-20030220bsd-4-0-0-branch
Diffstat (limited to 'xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accelfuncs.c')
-rw-r--r-- | xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accelfuncs.c | 98 |
1 files changed, 61 insertions, 37 deletions
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accelfuncs.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accelfuncs.c index 76200ecee..d0b01db8e 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accelfuncs.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accelfuncs.c @@ -31,7 +31,7 @@ * Authors: * Kevin E. Martin <martin@xfree86.org> * Rickard E. Faith <faith@valinux.com> - * Alan Hourihane <ahourihane@valinux.com> + * Alan Hourihane <alanh@fairlite.demon.co.uk> * Michel Dänzer <michel@daenzer.net> * * Credits: @@ -106,11 +106,43 @@ void FUNC_NAME(RADEONWaitForIdle)(ScrnInfoPtr pScrn) { RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO = info->MMIO; int i = 0; -#ifdef ACCEL_MMIO +#ifdef ACCEL_CP - unsigned char *RADEONMMIO = info->MMIO; + int ret; + + /* Make sure the CP is idle first */ + + if (info->CPStarted) { + FLUSH_RING(); + + for (;;) { + do { + ret = drmCommandNone(info->drmFD, DRM_RADEON_CP_IDLE); + if (ret && ret != -EBUSY) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "%s: CP idle %d\n", __FUNCTION__, ret); + } + } while ((ret == -EBUSY) && (i++ < RADEON_TIMEOUT)); + + if (ret == 0) return; + + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Idle timed out, resetting engine...\n"); + RADEONEngineReset(pScrn); + RADEONEngineRestore(pScrn); + + /* Always restart the engine when doing CP 2D acceleration */ + RADEONCP_RESET(pScrn, info); + RADEONCP_START(pScrn, info); + } + } + +#endif + + /* Wait for the engine to go idle */ RADEONTRACE(("WaitForIdle (entering): %d entries, stat=0x%08x\n", INREG(RADEON_RBBM_STATUS) & RADEON_RBBM_FIFOCNT_MASK, @@ -139,35 +171,6 @@ FUNC_NAME(RADEONWaitForIdle)(ScrnInfoPtr pScrn) } #endif } - -#else /* ACCEL_CP */ - - int ret; - - FLUSH_RING(); - - for (;;) { - do { - ret = drmRadeonWaitForIdleCP(info->drmFD); - if (ret && ret != -EBUSY) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "%s: CP idle %d\n", __FUNCTION__, ret); - } - } while ((ret == -EBUSY) && (i++ < RADEON_TIMEOUT)); - - if (ret == 0) return; - - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Idle timed out, resetting engine...\n"); - RADEONEngineReset(pScrn); - RADEONEngineRestore(pScrn); - - /* Always restart the engine when doing CP 2D acceleration */ - RADEONCP_RESET(pScrn, info); - RADEONCP_START(pScrn, info); - } - -#endif } /* This callback is required for multiheader cards using XAA */ @@ -578,15 +581,25 @@ FUNC_NAME(RADEONSetupForMono8x8PatternFill)(ScrnInfoPtr pScrn, unsigned int planemask) { RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char pattern[8]; ACCEL_PREAMBLE(); + /* Take care of endianness */ + pattern[0] = (patternx & 0x000000ff); + pattern[1] = (patternx & 0x0000ff00) >> 8; + pattern[2] = (patternx & 0x00ff0000) >> 16; + pattern[3] = (patternx & 0xff000000) >> 24; + pattern[4] = (patterny & 0x000000ff); + pattern[5] = (patterny & 0x0000ff00) >> 8; + pattern[6] = (patterny & 0x00ff0000) >> 16; + pattern[7] = (patterny & 0xff000000) >> 24; + /* Save for later clipping */ info->dp_gui_master_cntl_clip = (info->dp_gui_master_cntl | (bg == -1 ? RADEON_GMC_BRUSH_8X8_MONO_FG_LA : RADEON_GMC_BRUSH_8X8_MONO_FG_BG) - | RADEON_ROP[rop].pattern - | RADEON_GMC_BYTE_MSB_TO_LSB); + | RADEON_ROP[rop].pattern); BEGIN_ACCEL((bg == -1) ? 5 : 6); @@ -595,8 +608,8 @@ FUNC_NAME(RADEONSetupForMono8x8PatternFill)(ScrnInfoPtr pScrn, OUT_ACCEL_REG(RADEON_DP_BRUSH_FRGD_CLR, fg); if (bg != -1) OUT_ACCEL_REG(RADEON_DP_BRUSH_BKGD_CLR, bg); - OUT_ACCEL_REG(RADEON_BRUSH_DATA0, patternx); - OUT_ACCEL_REG(RADEON_BRUSH_DATA1, patterny); + OUT_ACCEL_REG(RADEON_BRUSH_DATA0, *(CARD32 *)(pointer)&pattern[0]); + OUT_ACCEL_REG(RADEON_BRUSH_DATA1, *(CARD32 *)(pointer)&pattern[4]); FINISH_ACCEL(); } @@ -778,7 +791,7 @@ FUNC_NAME(RADEONSetupForScanlineCPUToScreenColorExpandFill)(ScrnInfoPtr pScrn, #else BEGIN_ACCEL(2); - OUT_ACCEL_REG(RADEON_RBBM_GUICNTL, RADEON_HOST_DATA_SWAP_NONE); + OUT_ACCEL_REG(RADEON_RBBM_GUICNTL, RADEON_HOST_DATA_SWAP_32BIT); #endif OUT_ACCEL_REG(RADEON_DP_WRITE_MASK, planemask); @@ -1216,6 +1229,10 @@ FUNC_NAME(RADEONAccelInit)(ScreenPtr pScreen, XAAInfoRecPtr a) a->SubsequentSolidHorVertLine = FUNC_NAME(RADEONSubsequentSolidHorVertLine); +#ifdef XFree86LOADER + if (info->xaaReq.minorversion >= 1) { +#endif + /* RADEON only supports 14 bits for lines and clipping and only * draws lines that are completely on-screen correctly. This will * cause display corruption problem in the cases when out-of-range @@ -1253,6 +1270,13 @@ FUNC_NAME(RADEONAccelInit)(ScreenPtr pScreen, XAAInfoRecPtr a) a->DashedLineLimits.x2 = pScrn->virtualX-1; a->DashedLineLimits.y2 = pScrn->virtualY-1; +#ifdef XFree86LOADER + } else { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "libxaa too old, can't accelerate TwoPoint lines\n"); + } +#endif + /* Clipping, note that without this, all line accelerations will * not be called */ |