diff options
author | Michel Daenzer <michel@daenzer.net> | 2004-12-06 06:27:53 +0000 |
---|---|---|
committer | Michel Daenzer <michel@daenzer.net> | 2004-12-06 06:27:53 +0000 |
commit | 2b8ab42b05b32710fa4f71a25e2f84192e637fbd (patch) | |
tree | 9ca947b192ecd009d6e7a08ccde60d95b931bce8 /src/radeon_render.c | |
parent | 960d15ae3a44efe7c02a3d6d0acbabe63e07be74 (diff) |
When direct rendering is enabled, use hostdata blits to transfer data from
system memory to video RAM, which should reduce CPU usage especially
with larger videos. Can be disabled via Option "DMAForXv" if there
should be any stability issues, but it's been stable for me during a
week of testing. Based on a patch by Nikolaus Meine
<meine@tnt.uni-hannover.de>. Probably fix endianness issues in some
newer XVideo code, untested.
Also use hostdata blits to transfer RENDER image data to video RAM to avoid
idling the accelerator engine. Increases RENDER performance
significantly for me.
These changes were only tested on an M9 in a Titanium PowerBook but should
work with all Radeons where direct rendering is supported.
Diffstat (limited to 'src/radeon_render.c')
-rw-r--r-- | src/radeon_render.c | 66 |
1 files changed, 60 insertions, 6 deletions
diff --git a/src/radeon_render.c b/src/radeon_render.c index 7c85ca78..29ef966e 100644 --- a/src/radeon_render.c +++ b/src/radeon_render.c @@ -422,6 +422,10 @@ static Bool FUNC_NAME(R100SetupTexture)( CARD8 *dst; CARD32 tex_size = 0, txformat; int dst_pitch, offset, size, i, tex_bytepp; +#ifdef ACCEL_CP + CARD32 buf_pitch; + unsigned int hpass; +#endif ACCEL_PREAMBLE(); if ((width > 2048) || (height > 2048)) @@ -430,6 +434,8 @@ static Bool FUNC_NAME(R100SetupTexture)( txformat = RadeonGetTextureFormat(format); tex_bytepp = PICT_FORMAT_BPP(format) >> 3; +#ifndef ACCEL_CP + #if X_BYTE_ORDER == X_BIG_ENDIAN if (!RADEONSetupRenderByteswap(pScrn, tex_bytepp)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "%s: RADEONSetupRenderByteswap() " @@ -438,7 +444,9 @@ static Bool FUNC_NAME(R100SetupTexture)( } #endif - dst_pitch = (width * tex_bytepp + 31) & ~31; +#endif + + dst_pitch = (width * tex_bytepp + 63) & ~63; size = dst_pitch * height; if (!AllocateLinear(pScrn, size)) @@ -453,10 +461,27 @@ static Bool FUNC_NAME(R100SetupTexture)( } offset = info->RenderTex->offset * pScrn->bitsPerPixel / 8; + dst = (CARD8*)(info->FB + offset); + + /* Upload texture to card. */ + +#ifdef ACCEL_CP + + while ( height ) + { + RADEONHostDataBlitCopyPass( RADEONHostDataBlit( pScrn, tex_bytepp, width, + dst_pitch, &buf_pitch, + &dst, &height, &hpass ), + src, hpass, buf_pitch, src_pitch ); + src += hpass * src_pitch; + } + + RADEON_PURGE_CACHE(); + RADEON_WAIT_UNTIL_IDLE(); + +#else - /* Upload texture to card. Should use ImageWrite to avoid syncing. */ i = height; - dst = (CARD8*)(info->FB + offset); if (info->accel->NeedToSync) info->accel->Sync(pScrn); @@ -471,6 +496,8 @@ static Bool FUNC_NAME(R100SetupTexture)( RADEONRestoreByteswap(info); #endif +#endif /* ACCEL_CP */ + BEGIN_ACCEL(5); OUT_ACCEL_REG(RADEON_PP_TXFORMAT_0, txformat); OUT_ACCEL_REG(RADEON_PP_TEX_SIZE_0, tex_size); @@ -713,6 +740,10 @@ static Bool FUNC_NAME(R200SetupTexture)( CARD8 *dst; CARD32 tex_size = 0, txformat; int dst_pitch, offset, size, i, tex_bytepp; +#ifdef ACCEL_CP + CARD32 buf_pitch; + unsigned int hpass; +#endif ACCEL_PREAMBLE(); if ((width > 2048) || (height > 2048)) @@ -721,6 +752,8 @@ static Bool FUNC_NAME(R200SetupTexture)( txformat = RadeonGetTextureFormat(format); tex_bytepp = PICT_FORMAT_BPP(format) >> 3; +#ifndef ACCEL_CP + #if X_BYTE_ORDER == X_BIG_ENDIAN if (!RADEONSetupRenderByteswap(pScrn, tex_bytepp)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "%s: RADEONSetupRenderByteswap() " @@ -729,7 +762,9 @@ static Bool FUNC_NAME(R200SetupTexture)( } #endif - dst_pitch = (width * tex_bytepp + 31) & ~31; +#endif + + dst_pitch = (width * tex_bytepp + 63) & ~63; size = dst_pitch * height; if (!AllocateLinear(pScrn, size)) @@ -744,10 +779,27 @@ static Bool FUNC_NAME(R200SetupTexture)( } offset = info->RenderTex->offset * pScrn->bitsPerPixel / 8; + dst = (CARD8*)(info->FB + offset); + + /* Upload texture to card. */ + +#ifdef ACCEL_CP + + while ( height ) + { + RADEONHostDataBlitCopyPass( RADEONHostDataBlit( pScrn, tex_bytepp, width, + dst_pitch, &buf_pitch, + &dst, &height, &hpass ), + src, hpass, buf_pitch, src_pitch ); + src += hpass * src_pitch; + } + + RADEON_PURGE_CACHE(); + RADEON_WAIT_UNTIL_IDLE(); + +#else - /* Upload texture to card. Should use ImageWrite to avoid syncing. */ i = height; - dst = (CARD8*)(info->FB + offset); if (info->accel->NeedToSync) info->accel->Sync(pScrn); @@ -761,6 +813,8 @@ static Bool FUNC_NAME(R200SetupTexture)( RADEONRestoreByteswap(info); #endif +#endif /* ACCEL_CP */ + BEGIN_ACCEL(6); OUT_ACCEL_REG(R200_PP_TXFORMAT_0, txformat); OUT_ACCEL_REG(R200_PP_TXFORMAT_X_0, 0); |