From 5c571823304d356813c4da1d5b157254c103931d Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 3 Jan 2013 03:38:44 +0100 Subject: [PATCH] (RGL PS3) Misc. cleanups --- console/rgl/src/ps3/include/GmmAlloc.h | 14 ++-- console/rgl/src/ps3/rgl_ps3.cpp | 111 ++++++++++--------------- 2 files changed, 51 insertions(+), 74 deletions(-) diff --git a/console/rgl/src/ps3/include/GmmAlloc.h b/console/rgl/src/ps3/include/GmmAlloc.h index 97eaf37d70..84dc4f5c06 100644 --- a/console/rgl/src/ps3/include/GmmAlloc.h +++ b/console/rgl/src/ps3/include/GmmAlloc.h @@ -149,7 +149,7 @@ void gmmUpdateFreeList( ); uint32_t gmmAlloc( - CellGcmContextData *thisContext, + void *data, const uint8_t location, const uint8_t isTile, const uint32_t size @@ -171,17 +171,13 @@ void gmmSetTileAttrib( void *pData ); -void *gmmGetTileData( - const uint32_t id - ); +void *gmmGetTileData(const uint32_t id); -void gmmPinAllocations(); +void gmmPinAllocations(void); -void gmmUnpinAllocations(); +void gmmUnpinAllocations(void); -static inline uint8_t gmmIdIsMain( - const uint32_t id - ) +static inline uint8_t gmmIdIsMain(const uint32_t id) { return false; } diff --git a/console/rgl/src/ps3/rgl_ps3.cpp b/console/rgl/src/ps3/rgl_ps3.cpp index 5de55e3de9..c8cd7a238c 100644 --- a/console/rgl/src/ps3/rgl_ps3.cpp +++ b/console/rgl/src/ps3/rgl_ps3.cpp @@ -745,8 +745,9 @@ static void gmmFreeBlock(GmmBlock *pBlock) gmmFreeFixedBlock(pBlock); } -static void gmmAddPendingFree(GmmBlock *pBlock) +static void gmmAddPendingFree(void *data) { + GmmBlock *pBlock = (GmmBlock*)data; GmmAllocator *pAllocator; pAllocator = pGmmLocalAllocator; @@ -776,9 +777,7 @@ static void gmmAddPendingFree(GmmBlock *pBlock) pBlock->fence = nvFenceCounter; } -static uint8_t gmmSizeToFreeIndex( - uint32_t size - ) +static uint8_t gmmSizeToFreeIndex(uint32_t size) { if (size >= GMM_FREE_BIN_0 && size < GMM_FREE_BIN_1) return 0; @@ -929,13 +928,10 @@ uint32_t gmmFree(const uint32_t freeId) return CELL_OK; } -static inline void gmmLocalMemcpy( - CellGcmContextData *thisContext, - const uint32_t dstOffset, - const uint32_t srcOffset, - const uint32_t moveSize - ) +static inline void gmmLocalMemcpy(void *data, const uint32_t dstOffset, + const uint32_t srcOffset, const uint32_t moveSize) { + CellGcmContextData *thisContext = (CellGcmContextData*)data; int32_t offset = 0; int32_t sizeLeft = moveSize; int32_t dimension = 4096; @@ -986,43 +982,37 @@ static inline void gmmLocalMemcpy( } } -static inline void gmmMemcpy( - CellGcmContextData *thisContext, - const uint8_t mode, - const uint32_t dstOffset, - const uint32_t srcOffset, - const uint32_t moveSize - ) +static inline void gmmMemcpy(void *data, const uint8_t mode, + const uint32_t dstOffset, const uint32_t srcOffset, + const uint32_t moveSize) { + CellGcmContextData *thisContext = (CellGcmContextData*)data; + + if (dstOffset + moveSize <= srcOffset) { - if (dstOffset + moveSize <= srcOffset) + gmmLocalMemcpy(thisContext, + dstOffset, + srcOffset, + moveSize); + } + else + { + uint32_t moveBlockSize = srcOffset-dstOffset; + uint32_t iterations = (moveSize+moveBlockSize-1)/moveBlockSize; + + for (uint32_t i=0; iucode); __dcbt(((uint8_t*)vs->ucode)+128); @@ -1772,10 +1755,7 @@ void rglGcmSetOpenGLState( rglGcmState *rglGcmSt ) rglGcmFifoGlDisable( RGLGCM_PSHADER_SRGB_REMAPPING ); for ( i = 0; i < RGLGCM_ATTRIB_COUNT; i++ ) - { rglGcmFifoGlVertexAttribPointer( i, 0, RGLGCM_FLOAT, RGLGCM_FALSE, 0, 0, 0, 0 ); - } - rglGcmFifoGlEnable( RGLGCM_DITHER ); @@ -1827,7 +1807,7 @@ GLboolean rglGcmInitFromRM( rglGcmResource *rmResource ) } -void rglGcmDestroy( void ) +void rglGcmDestroy(void) { rglGcmState *rglGcmSt = &rglGcmState_i; memset( rglGcmSt, 0, sizeof( *rglGcmSt ) ); @@ -1840,12 +1820,12 @@ void rglGcmDestroy( void ) static GLuint MemoryClock = 0; static GLuint GraphicsClock = 0; -GLuint rglGcmGetMemoryClock() +GLuint rglGcmGetMemoryClock(void) { return MemoryClock; } -GLuint rglGcmGetGraphicsClock() +GLuint rglGcmGetGraphicsClock(void) { return GraphicsClock; } @@ -1959,7 +1939,8 @@ void rglGcmMemcpy( const GLuint dstId, unsigned dstOffset, unsigned int pitch, c } } -void rglGcmSend( unsigned int dstId, unsigned dstOffset, unsigned int pitch, const char *src, unsigned int size ) +void rglGcmSend( unsigned int dstId, unsigned dstOffset, unsigned int pitch, + const char *src, unsigned int size ) { // try allocating the whole block in the bounce buffer GLuint id = gmmAlloc((CellGcmContextData*)&rglGcmState_i.fifo, @@ -1996,7 +1977,7 @@ void rglPlatformInit( RGLinitOptions* options ) } -void rglPlatformExit() +void rglPlatformExit(void) { } @@ -2008,7 +1989,7 @@ void rglInitConsole( GLuint enable ) { } -void rglExitConsole() +void rglExitConsole(void) { } @@ -2078,7 +2059,7 @@ void rglPsglPlatformInit( RGLinitOptions* options ) rglInitCompleted = 1; } -void rglPsglPlatformExit() +void rglPsglPlatformExit(void) { RGLcontext* LContext = _CurrentContext; if ( LContext )