diff options
author | Luc Verhaegen <libv@skynet.be> | 2008-09-22 19:11:41 +0200 |
---|---|---|
committer | Luc Verhaegen <libv@skynet.be> | 2008-09-22 19:11:41 +0200 |
commit | d6d4832a557abd575f0df78992bd34d9301b43d4 (patch) | |
tree | 0867880c0a042021f75b966521ed02b85749c4ac | |
parent | e9469d1e238db40a970b16e1302fca0284f39255 (diff) |
CS: Copy over changes to shared files from master again.CS
-rw-r--r-- | src/radeon_3d.c | 95 | ||||
-rw-r--r-- | src/radeon_exa_render.c | 20 | ||||
-rw-r--r-- | src/radeon_textured_videofuncs.c | 14 |
3 files changed, 117 insertions, 12 deletions
diff --git a/src/radeon_3d.c b/src/radeon_3d.c index dda6010..6f6dce5 100644 --- a/src/radeon_3d.c +++ b/src/radeon_3d.c @@ -28,9 +28,90 @@ * DEALINGS IN THE SOFTWARE. */ -#ifndef IS_RADEON_DRIVER +#ifdef IS_QUICK_AND_DIRTY /* make this IS_RADEON_DRIVER */ /* - * RadeonHD specifics. + * Radeon driver specifics. + */ +#if defined(ACCEL_MMIO) && defined(ACCEL_CP) +#error Cannot define both MMIO and CP acceleration! +#endif + +#if !defined(UNIXCPP) || defined(ANSICPP) +#define FUNC_NAME_CAT(prefix,suffix) prefix##suffix +#else +#define FUNC_NAME_CAT(prefix,suffix) prefix/**/suffix +#endif + +#ifdef ACCEL_MMIO +#define FUNC_NAME(prefix) FUNC_NAME_CAT(prefix,MMIO) +#else +#ifdef ACCEL_CP +#define FUNC_NAME(prefix) FUNC_NAME_CAT(prefix,CP) +#else +#error No accel type defined! +#endif +#endif + +#ifdef ACCEL_MMIO +#define ONLY_ONCE +#else +#undef ONLY_ONCE +#endif + +#ifdef ONLY_ONCE + +# define VAR_PREAMBLE() RHDPtr info = RHDPTR(pScrn) +# define THREEDSTATE_PREAMBLE() struct rhdAccel *accel_state = info->accel_state + +# define HAS_TCL info->has_tcl + +# define R5XXPowerPipes(p) {} + +/* Map the number of GB Pipes the hardware has. */ +static int +R5xxGBPipesCount(ScrnInfoPtr pScrn) +{ + return ((RHDRegRead(pScrn, R400_GB_PIPE_SELECT) >> 12) & 0x03) + 1; +} +#define NUM_GB_PIPES R5xxGBPipesCount(pScrn) + +/* Map the number of FPUs the VPS has. */ +static int +R5xxPVSFPUCount(ScrnInfoPtr pScrn) +{ + switch (RHDPTR(pScrn)->ChipSet) { + case RHD_RV515: + case RHD_RV516: + case RHD_RV550: + case RHD_M52: + case RHD_M54: + case RHD_M62: + case RHD_M64: + return 2; + case RHD_RV530: + case RHD_RV560: + case RHD_RV570: + case RHD_M56: + case RHD_M58: + case RHD_M66: + return 5; + case RHD_R520: + case RHD_R580: + case RHD_M68: + return 8; + default: + return 4; + } +} +#define NUM_PVS_FPUS R5xxPVSFPUCount(pScrn) + +# define END_ACCEL() + +#endif /* ONLY_ONCE */ + +#else /* IS_RADEON_DRIVER */ +/* + * RadeonHD driver specifics. */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -136,12 +217,12 @@ R5XXPowerPipes(ScrnInfoPtr pScrn) #endif /* IS_RADEON_DRIVER */ -#ifndef IS_RADEON_DRIVER -void -R5xx3DSetup(int scrnIndex) -#else +#if defined(IS_RADEON_DRIVER) || defined(IS_QUICK_AND_DIRTY) static void FUNC_NAME(RADEONInit3DEngine)(int scrnIndex) +#else +void +R5xx3DSetup(int scrnIndex) #endif { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; @@ -762,3 +843,5 @@ FUNC_NAME(RADEONInit3DEngine)(int scrnIndex) accel_state->XHas3DEngineState = TRUE; } + +#undef FUNC_NAME diff --git a/src/radeon_exa_render.c b/src/radeon_exa_render.c index 1c02de7..6d25446 100644 --- a/src/radeon_exa_render.c +++ b/src/radeon_exa_render.c @@ -29,7 +29,7 @@ * Alex Deucher <alexander.deucher@amd.com> * */ -#ifdef IS_RADEON_DRIVER +#if defined(IS_RADEON_DRIVER) || defined(IS_QUICK_AND_DIRTY) #if defined(ACCEL_MMIO) && defined(ACCEL_CP) #error Cannot define both MMIO and CP acceleration! #endif @@ -52,6 +52,14 @@ #ifndef ACCEL_CP #define ONLY_ONCE + +#define VAR_PREAMBLE(pScreen) \ + ScrnInfoPtr pScrn = xf86Screens[(pScreen)->myNum]; \ + RHDPtr info = RHDPTR(pScrn) +#define THREEDSTATE_PREAMBLE() struct rhdAccel *accel_state = info->accel_state +#define HAS_TCL IS_R500_3D +#define FB_OFFSET (info->FbIntAddress + info->FbScanoutStart) + #endif #else /* IS_RADEON_DRIVER */ @@ -933,7 +941,7 @@ static Bool FUNC_NAME(R200PrepareComposite)(int op, PicturePtr pSrcPicture, TRACE; if (!accel_state->XHas3DEngineState) - RADEONInit3DEngine(info->scrnIndex); + RADEONInit3DEngine(pScrn); if (!RADEONGetDestFormat(pDstPicture, &dst_format)) return FALSE; @@ -1296,7 +1304,7 @@ static Bool FUNC_NAME(R300PrepareComposite)(int op, PicturePtr pSrcPicture, TRACE; if (!accel_state->XHas3DEngineState) - RADEONInit3DEngine(info->scrnIndex); + RADEONInit3DEngine(pScrn); if (!R300GetDestFormat(pDstPicture, &dst_format)) return FALSE; @@ -2111,6 +2119,8 @@ static void FUNC_NAME(RadeonCompositeTile)(PixmapPtr pDst, # ifdef IS_RADEON_DRIVER if (info->ChipFamily < CHIP_FAMILY_R200) OUT_ACCEL_REG(RADEON_SE_VF_CNTL, (RADEON_VF_PRIM_TYPE_RECANGLE_LIST | + RADEON_VF_PRIM_WALK_DATA | + RADEON_VF_RADEON_MODE | (3 << RADEON_VF_NUM_VERTICES_SHIFT))); else # endif /* IS_RADEON_DRIVER */ @@ -2243,14 +2253,14 @@ static void FUNC_NAME(RadeonDoneComposite)(PixmapPtr pDst) OUT_ACCEL_REG(RADEON_WAIT_UNTIL, RADEON_WAIT_3D_IDLECLEAN); FINISH_ACCEL(); -#if defined(ACCEL_CP) && !defined(IS_RADEON_DRIVER) +#if defined(ACCEL_CP) && !defined(IS_RADEON_DRIVER) && !defined(IS_QUICK_AND_DIRTY) ADVANCE_RING(); #endif LEAVE_DRAW(0); } -#ifndef IS_RADEON_DRIVER +#if !defined(IS_RADEON_DRIVER) && !defined(IS_QUICK_AND_DIRTY) void R5xxExaCompositeFuncs(int scrnIndex, struct _ExaDriver *Exa) { diff --git a/src/radeon_textured_videofuncs.c b/src/radeon_textured_videofuncs.c index 82e9bdf..369fec3 100644 --- a/src/radeon_textured_videofuncs.c +++ b/src/radeon_textured_videofuncs.c @@ -24,7 +24,7 @@ * Based on radeon_exa_render.c and kdrive ati_video.c by Eric Anholt, et al. * */ -#ifdef IS_RADEON_DRIVER +#if defined(IS_RADEON_DRIVER) || defined(IS_QUICK_AND_DIRTY) #if defined(ACCEL_MMIO) && defined(ACCEL_CP) #error Cannot define both MMIO and CP acceleration! #endif @@ -67,6 +67,18 @@ do { \ OUT_VIDEO_REG_F(RADEON_SE_PORT_DATA0, _srcY); \ } while (0) +# define VAR_PSCRN_PREAMBLE(pScrn) RHDPtr info = RHDPTR(pScrn) +# define THREEDSTATE_PREAMBLE() struct rhdAccel *accel_state = info->accel_state + +# define FB_OFFSET(x) (((char *)(x) - (char *)info->FbBase) + info->FbIntAddress) + +# ifdef USE_EXA +# define EXA_ENABLED (info->AccelMethod == RHD_ACCEL_EXA) +# define EXA_FB_OFFSET (info->FbIntAddress + info->FbScanoutStart) +# endif + +# define HAS_TCL IS_R500_3D + #endif /* !ACCEL_CP */ #else /* IS_RADEON_DRIVER */ |