mirror of
https://github.com/libretro/RetroArch
synced 2025-03-22 16:20:58 +00:00
(RGL PS3) Optimize FIFO out of space callback
This commit is contained in:
parent
ea916d95d5
commit
2e3d77e8f2
@ -2,7 +2,6 @@ void rglGcmFifoFinish (void *data);
|
||||
GLboolean rglGcmFifoReferenceInUse (void *data, GLuint reference);
|
||||
GLuint rglGcmFifoPutReference (void *data);
|
||||
void rglGcmFifoFlush (void *data);
|
||||
uint32_t *rglGcmFifoWaitForFreeSpace (void *data, GLuint spaceInWords);
|
||||
void rglGcmGetTileRegionInfo (void *data, GLuint *address, GLuint *size);
|
||||
GLboolean rglGcmTryResizeTileRegion( GLuint address, GLuint size, void *data);
|
||||
|
||||
|
@ -1500,19 +1500,6 @@ GLboolean rglGcmFifoReferenceInUse (void *data, GLuint reference)
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
// Wait until the requested space is available.
|
||||
// If not currently available, will call the out of space callback
|
||||
|
||||
uint32_t * rglGcmFifoWaitForFreeSpace (void *data, GLuint spaceInWords)
|
||||
{
|
||||
rglGcmFifo *fifo = (rglGcmFifo*)data;
|
||||
|
||||
if ( fifo->current + spaceInWords + 1024 > fifo->end )
|
||||
rglOutOfSpaceCallback( fifo, spaceInWords );
|
||||
|
||||
return rglGcmState_i.fifo.current;
|
||||
}
|
||||
|
||||
void rglGcmFifoInit (void *data, void *dmaControl, unsigned long dmaPushBufferOffset, uint32_t*dmaPushBuffer,
|
||||
GLuint dmaPushBufferSize )
|
||||
{
|
||||
@ -2065,15 +2052,10 @@ int32_t rglOutOfSpaceCallback (void *data, uint32_t spaceInWords)
|
||||
// If the current end isn't the same as the full fifo end we
|
||||
// aren't at the end. Just go ahead and set the next begin and end
|
||||
if(fifo->end != fifo->dmaPushBufferEnd)
|
||||
{
|
||||
nextbegin = (uint32_t *)fifo->end + 1;
|
||||
nextend = nextbegin + fifo->fifoBlockSize/sizeof(uint32_t) - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
nextbegin = (uint32_t *)fifo->dmaPushBufferBegin;
|
||||
nextend = nextbegin + (fifo->fifoBlockSize)/sizeof(uint32_t) - 1;
|
||||
}
|
||||
nextend = nextbegin + (fifo->fifoBlockSize)/sizeof(uint32_t) - 1;
|
||||
|
||||
cellGcmAddressToOffset(nextbegin, &nextbeginoffset);
|
||||
cellGcmAddressToOffset(nextend, &nextendoffset);
|
||||
@ -2087,8 +2069,6 @@ int32_t rglOutOfSpaceCallback (void *data, uint32_t spaceInWords)
|
||||
fifo->current = nextbegin;
|
||||
fifo->end = nextend;
|
||||
|
||||
const GLuint nopsAtBegin = 8;
|
||||
|
||||
//if Gpu busy with the new area, stall and flush
|
||||
uint32_t get = fifo->dmaControl->Get;
|
||||
|
||||
@ -2106,17 +2086,15 @@ int32_t rglOutOfSpaceCallback (void *data, uint32_t spaceInWords)
|
||||
while(((get >= nextbeginoffset) && (get <= nextendoffset))
|
||||
|| ((0 <= get) && (get < 0x10000)))
|
||||
{
|
||||
// Don't be a ppu hog ;)
|
||||
sys_timer_usleep(30);
|
||||
get = fifo->dmaControl->Get;
|
||||
cellGcmIoOffsetToAddress( get, &getEA );
|
||||
}
|
||||
|
||||
// need to add some nops here at the beginning for a issue with the get and the put being at the
|
||||
// same position when the fifo is in GPU memory.
|
||||
for ( GLuint i = 0; i < nopsAtBegin; i++ )
|
||||
for ( GLuint i = 0; i < 8; i++ )
|
||||
{
|
||||
fifo->current[0] = RGLGCM_NOP();
|
||||
fifo->current[0] = 0;
|
||||
fifo->current++;
|
||||
}
|
||||
|
||||
|
@ -1766,7 +1766,14 @@ static inline void rglValidateStates (GLuint mask)
|
||||
conf.registerCount = program->header.vertexProgram.registerCount;
|
||||
conf.attributeInputMask = program->header.attributeInputMask;
|
||||
|
||||
rglGcmFifoWaitForFreeSpace( &rglGcmState_i.fifo, 7 + 5 * conf.instructionCount );
|
||||
rglGcmFifo *fifo = (rglGcmFifo*)&rglGcmState_i.fifo;
|
||||
GLuint spaceInWords = 7 + 5 * conf.instructionCount;
|
||||
|
||||
// Push a CG program onto the current command buffer
|
||||
|
||||
// make sure there is space for the pushbuffer + any nops we need to add for alignment
|
||||
if ( fifo->current + spaceInWords + 1024 > fifo->end )
|
||||
rglOutOfSpaceCallback( fifo, spaceInWords );
|
||||
|
||||
GCM_FUNC( cellGcmSetVertexProgramLoad, &conf, program->ucode );
|
||||
GCM_FUNC( cellGcmSetUserClipPlaneControl, 0, 0, 0, 0, 0, 0 );
|
||||
@ -1896,11 +1903,14 @@ static inline void rglValidateStates (GLuint mask)
|
||||
if (RGL_LIKELY(needValidate & RGL_VALIDATE_VERTEX_CONSTANTS) || validate_vertex_consts)
|
||||
{
|
||||
_CGprogram *cgprog = LContext->BoundVertexProgram;
|
||||
rglGcmFifo *fifo = (rglGcmFifo*)&rglGcmState_i.fifo;
|
||||
GLuint spaceInWords = cgprog->constantPushBufferWordSize + 4 + 32;
|
||||
|
||||
// Push a CG program onto the current command buffer
|
||||
|
||||
// make sure there is space for the pushbuffer + any nops we need to add for alignment
|
||||
rglGcmFifoWaitForFreeSpace( &rglGcmState_i.fifo, cgprog->constantPushBufferWordSize + 4 + 32);
|
||||
if ( fifo->current + spaceInWords + 1024 > fifo->end )
|
||||
rglOutOfSpaceCallback( fifo, spaceInWords );
|
||||
|
||||
// first add nops to get us the next alligned position in the fifo
|
||||
// [YLIN] Use VMX register to copy
|
||||
|
Loading…
x
Reference in New Issue
Block a user