Added GSPGPU code for SetBufferSwap and InvalidateDataCache.

This commit is contained in:
yellows8 2014-04-22 20:18:21 -04:00
parent c5250ab567
commit c69bc04dff
2 changed files with 47 additions and 0 deletions

View File

@ -3,13 +3,26 @@
#define GSP_REBASE_REG(r) ((r)-0x1EB00000)
typedef struct
{
u32 active_framebuf;//"0=first, 1=second"
u32 *framebuf0_vaddr;//"Framebuffer virtual address, for the main screen this is the 3D left framebuffer"
u32 *framebuf1_vaddr;//"For the main screen: 3D right framebuffer address"
u32 framebuf_widthbytesize;//"Value for 0x1EF00X90, controls framebuffer width"
u32 format;//"Framebuffer format, this u16 is written to the low u16 for LCD register 0x1EF00X70."
u32 framebuf_dispselect;//"Value for 0x1EF00X78, controls which framebuffer is displayed"
u32 unk;//"?"
} GSP_FramebufferInfo;
Result gspInit();
void gspExit();
Result GSPGPU_AcquireRight(Handle *handle, u8 flags);
Result GSPGPU_ReleaseRight(Handle *handle);
Result GSPGPU_SetLcdForceBlack(Handle *handle, u8 flags);
Result GSPGPU_SetBufferSwap(Handle* handle, u32 screenid, GSP_FramebufferInfo *framebufinfo);
Result GSPGPU_FlushDataCache(Handle *handle, u8* adr, u32 size);
Result GSPGPU_InvalidateDataCache(Handle* handle, u8 *adr, u32 size);
Result GSPGPU_WriteHWRegs(Handle *handle, u32 regAddr, u32* data, u8 size);
Result GSPGPU_WriteHWRegsWithMask(Handle* handle, u32 regAddr, u32* data, u8 datasize, u32* maskdata, u8 masksize);
Result GSPGPU_ReadHWRegs(Handle *handle, u32 regAddr, u32* data, u8 size);

View File

@ -61,6 +61,22 @@ Result GSPGPU_SetLcdForceBlack(Handle* handle, u8 flags)
return cmdbuf[1];
}
Result GSPGPU_SetBufferSwap(Handle* handle, u32 screenid, GSP_FramebufferInfo *framebufinfo)
{
Result ret=0;
u32 *cmdbuf = getThreadCommandBuffer();
if(!handle)handle=&gspGpuHandle;
cmdbuf[0] = 0x00050200;
cmdbuf[1] = screenid;
memcpy(&cmdbuf[2], framebufinfo, sizeof(GSP_FramebufferInfo));
if((ret=svc_sendSyncRequest(*handle)))return ret;
return cmdbuf[1];
}
Result GSPGPU_FlushDataCache(Handle* handle, u8* adr, u32 size)
{
if(!handle)handle=&gspGpuHandle;
@ -78,6 +94,24 @@ Result GSPGPU_FlushDataCache(Handle* handle, u8* adr, u32 size)
return cmdbuf[1];
}
Result GSPGPU_InvalidateDataCache(Handle* handle, u8 *adr, u32 size)
{
Result ret=0;
u32 *cmdbuf = getThreadCommandBuffer();
if(!handle)handle=&gspGpuHandle;
cmdbuf[0] = 0x00090082;
cmdbuf[1] = (u32)adr;
cmdbuf[2] = size;
cmdbuf[3] = 0;
cmdbuf[4] = 0xFFFF8001;
if((ret=svc_sendSyncRequest(*handle)))return ret;
return cmdbuf[1];
}
Result GSPGPU_WriteHWRegs(Handle* handle, u32 regAddr, u32* data, u8 size)
{
if(!handle)handle=&gspGpuHandle;