(RGL PS3) Make macro wrapper around cellGcmFlush

This commit is contained in:
twinaphex 2013-11-17 22:12:45 +01:00
parent bad7671159
commit 014c1fff44
2 changed files with 16 additions and 9 deletions

View File

@ -76,6 +76,10 @@ static inline void rglGcmSetVertexProgramParameterBlock(struct CellGcmContextDat
memcpy(&thisContext->current[1], v, sizeof(float)*4); \
thisContext->current += 5;
#define rglGcmSetJumpCommand(thisContext, offset) \
thisContext->current[0] = ((offset) | (0x20000000)); \
thisContext->current += 1
#define rglGcmSetVertexDataArray(thisContext, index, frequency, stride, size, type, location, offset) \
(thisContext->current)[0] = (((1) << (18)) | (CELL_GCM_NV4097_SET_VERTEX_DATA_ARRAY_FORMAT + ((index)) * 4)); \
(thisContext->current)[1] = ((((frequency)) << 16) | (((stride)) << 8) | (((size)) << 4) | ((type))); \
@ -314,11 +318,13 @@ static inline void rglGcmSetVertexProgramParameterBlock(struct CellGcmContextDat
#define rglGcmFifoFlush(fifo, offsetInBytes) \
cellGcmAddressToOffset( fifo->ctx.current, ( uint32_t * )&offsetInBytes ); \
cellGcmFlush(); \
rglGcmFlush(gCellGcmCurrentContext); \
fifo->dmaControl->Put = offsetInBytes; \
fifo->lastPutWritten = fifo->ctx.current; \
fifo->lastSWReferenceFlushed = fifo->lastSWReferenceWritten;
#define rglGcmFlush(thisContext) cellGcmFlushUnsafe(thisContext)
#define rglGcmSetSurface(thisContext, surface, origin, pixelCenter, log2Width, log2Height) \
(thisContext->current)[0] = (((1) << (18)) | CELL_GCM_NV4097_SET_CONTEXT_DMA_COLOR_A); \
(thisContext->current)[1] = (CELL_GCM_CONTEXT_DMA_MEMORY_FRAME_BUFFER + surface->colorLocation[0]); \
@ -836,7 +842,7 @@ static inline void rglGcmUtilWaitForIdle (void)
// make sure the entire pipe in clear not just the front end
// Utility function that does GPU 'finish'.
rglGcmSetWriteBackEndLabel(thisContext, RGLGCM_UTIL_LABEL_INDEX, rglGcmState_i.labelValue );
cellGcmFlush();
rglGcmFlush(gCellGcmCurrentContext);
while( *(cellGcmGetLabelAddress( RGLGCM_UTIL_LABEL_INDEX)) != rglGcmState_i.labelValue);

View File

@ -1313,7 +1313,7 @@ static void gmmAllocSweep(void *data)
cachedLockValue = 1;
rglGcmSetWriteBackEndLabel(thisContext, GMM_PPU_WAIT_INDEX, 0);
cellGcmFlush(thisContext);
rglGcmFlush(thisContext);
}
}
@ -1877,14 +1877,13 @@ int32_t rglOutOfSpaceCallback (void *data, uint32_t spaceInWords)
struct CellGcmContextData *fifoContext = (struct CellGcmContextData*)data;
rglGcmFifo * fifo = &rglGcmState_i.fifo;
// make sure that the space requested will actually fit in to
// a single fifo block!
// auto flush
cellGcmFlushUnsafeInline((CellGcmContextData*)fifo);
rglGcmFlush((CellGcmContextData*)fifo);
uint32_t *nextbegin, *nextend, nextbeginoffset, nextendoffset;
// make sure that the space requested will actually fit in to
// a single fifo block!
fifoUpdateGetLastRead(fifo);
// If the current end isn't the same as the full fifo end we
@ -1898,8 +1897,10 @@ int32_t rglOutOfSpaceCallback (void *data, uint32_t spaceInWords)
cellGcmAddressToOffset(nextbegin, &nextbeginoffset);
cellGcmAddressToOffset(nextend, &nextendoffset);
struct CellGcmContextData *thisContext = (CellGcmContextData*)fifo;
//use this version so as not to trigger another callback
cellGcmSetJumpCommandUnsafeInline((CellGcmContextData*)fifo, nextbeginoffset);
rglGcmSetJumpCommand(thisContext, nextbeginoffset);
//set up new context
fifo->ctx.begin = nextbegin;