libctru
v2.4.1
|
GSPGPU service. More...
Go to the source code of this file.
Data Structures | |
struct | GSPGPU_FramebufferInfo |
Framebuffer information. More... | |
struct | GSPGPU_CaptureInfoEntry |
Capture info entry. More... | |
struct | GSPGPU_CaptureInfo |
Capture info. More... | |
Macros | |
#define | GSP_SCREEN_TOP 0 |
ID of the top screen. | |
#define | GSP_SCREEN_BOTTOM 1 |
ID of the bottom screen. | |
#define | GSP_SCREEN_WIDTH 240 |
Width of the top/bottom screens. | |
#define | GSP_SCREEN_HEIGHT_TOP 400 |
Height of the top screen. | |
#define | GSP_SCREEN_HEIGHT_TOP_2X 800 |
Height of the top screen (2x). | |
#define | GSP_SCREEN_HEIGHT_BOTTOM 320 |
Height of the bottom screen. | |
#define | gspWaitForPSC0() gspWaitForEvent(GSPGPU_EVENT_PSC0, false) |
Waits for PSC0. | |
#define | gspWaitForPSC1() gspWaitForEvent(GSPGPU_EVENT_PSC1, false) |
Waits for PSC1. | |
#define | gspWaitForVBlank() gspWaitForVBlank0() |
Waits for VBlank. | |
#define | gspWaitForVBlank0() gspWaitForEvent(GSPGPU_EVENT_VBlank0, true) |
Waits for VBlank0. | |
#define | gspWaitForVBlank1() gspWaitForEvent(GSPGPU_EVENT_VBlank1, true) |
Waits for VBlank1. | |
#define | gspWaitForPPF() gspWaitForEvent(GSPGPU_EVENT_PPF, false) |
Waits for PPF. | |
#define | gspWaitForP3D() gspWaitForEvent(GSPGPU_EVENT_P3D, false) |
Waits for P3D. | |
#define | gspWaitForDMA() gspWaitForEvent(GSPGPU_EVENT_DMA, false) |
Waits for DMA. | |
Enumerations | |
enum | GSPGPU_FramebufferFormat { GSP_RGBA8_OES =0 , GSP_BGR8_OES =1 , GSP_RGB565_OES =2 , GSP_RGB5_A1_OES =3 , GSP_RGBA4_OES =4 } |
Framebuffer format. More... | |
enum | GSPGPU_Event { GSPGPU_EVENT_PSC0 = 0 , GSPGPU_EVENT_PSC1 , GSPGPU_EVENT_VBlank0 , GSPGPU_EVENT_VBlank1 , GSPGPU_EVENT_PPF , GSPGPU_EVENT_P3D , GSPGPU_EVENT_DMA , GSPGPU_EVENT_MAX } |
GSPGPU events. More... | |
Functions | |
static unsigned | gspGetBytesPerPixel (GSPGPU_FramebufferFormat format) |
Gets the number of bytes per pixel for the specified format. More... | |
Result | gspInit (void) |
Initializes GSPGPU. | |
void | gspExit (void) |
Exits GSPGPU. | |
Handle * | gspGetSessionHandle (void) |
Gets a pointer to the current gsp::Gpu session handle. More... | |
bool | gspHasGpuRight (void) |
Returns true if the application currently has GPU rights. | |
bool | gspPresentBuffer (unsigned screen, unsigned swap, const void *fb_a, const void *fb_b, u32 stride, u32 mode) |
Presents a buffer to the specified screen. More... | |
bool | gspIsPresentPending (unsigned screen) |
Returns true if a prior gspPresentBuffer command is still pending to be processed by GSP. More... | |
void | gspSetEventCallback (GSPGPU_Event id, ThreadFunc cb, void *data, bool oneShot) |
Configures a callback to run when a GSPGPU event occurs. More... | |
void | gspWaitForEvent (GSPGPU_Event id, bool nextEvent) |
Waits for a GSPGPU event to occur. More... | |
GSPGPU_Event | gspWaitForAnyEvent (void) |
Waits for any GSPGPU event to occur. More... | |
Result | gspSubmitGxCommand (const u32 gxCommand[0x8]) |
Submits a GX command. More... | |
Result | GSPGPU_AcquireRight (u8 flags) |
Acquires GPU rights. More... | |
Result | GSPGPU_ReleaseRight (void) |
Releases GPU rights. | |
Result | GSPGPU_ImportDisplayCaptureInfo (GSPGPU_CaptureInfo *captureinfo) |
Retrieves display capture info. More... | |
Result | GSPGPU_SaveVramSysArea (void) |
Saves the VRAM sys area. | |
Result | GSPGPU_ResetGpuCore (void) |
Resets the GPU. | |
Result | GSPGPU_RestoreVramSysArea (void) |
Restores the VRAM sys area. | |
Result | GSPGPU_SetLcdForceBlack (u8 flags) |
Sets whether to force the LCD to black. More... | |
Result | GSPGPU_SetBufferSwap (u32 screenid, const GSPGPU_FramebufferInfo *framebufinfo) |
Updates a screen's framebuffer state. More... | |
Result | GSPGPU_FlushDataCache (const void *adr, u32 size) |
Flushes memory from the data cache. More... | |
Result | GSPGPU_InvalidateDataCache (const void *adr, u32 size) |
Invalidates memory in the data cache. More... | |
Result | GSPGPU_WriteHWRegs (u32 regAddr, const u32 *data, u8 size) |
Writes to GPU hardware registers. More... | |
Result | GSPGPU_WriteHWRegsWithMask (u32 regAddr, const u32 *data, u8 datasize, const u32 *maskdata, u8 masksize) |
Writes to GPU hardware registers with a mask. More... | |
Result | GSPGPU_ReadHWRegs (u32 regAddr, u32 *data, u8 size) |
Reads from GPU hardware registers. More... | |
Result | GSPGPU_RegisterInterruptRelayQueue (Handle eventHandle, u32 flags, Handle *outMemHandle, u8 *threadID) |
Registers the interrupt relay queue. More... | |
Result | GSPGPU_UnregisterInterruptRelayQueue (void) |
Unregisters the interrupt relay queue. | |
Result | GSPGPU_TriggerCmdReqQueue (void) |
Triggers a handling of commands written to shared memory. | |
Result | GSPGPU_SetLedForceOff (bool disable) |
Sets 3D_LEDSTATE to the input state value. More... | |
GSPGPU service.
enum GSPGPU_Event |
GSPGPU events.
|
inlinestatic |
Gets the number of bytes per pixel for the specified format.
format | See GSPGPU_FramebufferFormat. |
Handle* gspGetSessionHandle | ( | void | ) |
Gets a pointer to the current gsp::Gpu session handle.
Flushes memory from the data cache.
adr | Address to flush. |
size | Size of the memory to flush. |
Result GSPGPU_ImportDisplayCaptureInfo | ( | GSPGPU_CaptureInfo * | captureinfo | ) |
Retrieves display capture info.
captureinfo | Pointer to output capture info to. |
Invalidates memory in the data cache.
adr | Address to invalidate. |
size | Size of the memory to invalidate. |
Reads from GPU hardware registers.
regAddr | Register address to read from. |
data | Buffer to read data to. |
size | Size of the buffer. |
Result GSPGPU_RegisterInterruptRelayQueue | ( | Handle | eventHandle, |
u32 | flags, | ||
Handle * | outMemHandle, | ||
u8 * | threadID | ||
) |
Registers the interrupt relay queue.
eventHandle | Handle of the GX command event. |
flags | Flags to register with. |
outMemHandle | Pointer to output the shared memory handle to. |
threadID | Pointer to output the GSP thread ID to. |
Result GSPGPU_SetBufferSwap | ( | u32 | screenid, |
const GSPGPU_FramebufferInfo * | framebufinfo | ||
) |
Updates a screen's framebuffer state.
screenid | ID of the screen to update. |
framebufinfo | Framebuffer information to update with. |
Sets whether to force the LCD to black.
flags | Whether to force the LCD to black. (0 = no, non-zero = yes) |
Result GSPGPU_SetLedForceOff | ( | bool | disable | ) |
Sets 3D_LEDSTATE to the input state value.
disable | False = 3D LED enable, true = 3D LED disable. |
Writes to GPU hardware registers.
regAddr | Register address to write to. |
data | Data to write. |
size | Size of the data to write. |
Result GSPGPU_WriteHWRegsWithMask | ( | u32 | regAddr, |
const u32 * | data, | ||
u8 | datasize, | ||
const u32 * | maskdata, | ||
u8 | masksize | ||
) |
Writes to GPU hardware registers with a mask.
regAddr | Register address to write to. |
data | Data to write. |
datasize | Size of the data to write. |
maskdata | Data of the mask. |
masksize | Size of the mask. |
bool gspIsPresentPending | ( | unsigned | screen | ) |
Returns true if a prior gspPresentBuffer command is still pending to be processed by GSP.
screen | Screen ID (see GSP_SCREEN_TOP and GSP_SCREEN_BOTTOM) |
bool gspPresentBuffer | ( | unsigned | screen, |
unsigned | swap, | ||
const void * | fb_a, | ||
const void * | fb_b, | ||
u32 | stride, | ||
u32 | mode | ||
) |
Presents a buffer to the specified screen.
screen | Screen ID (see GSP_SCREEN_TOP and GSP_SCREEN_BOTTOM) |
swap | Specifies which set of framebuffer registers to configure and activate (0 or 1) |
fb_a | Pointer to the framebuffer (in stereo mode: left eye) |
fb_b | Pointer to the secondary framebuffer (only used in stereo mode for the right eye, otherwise pass the same as fb_a) |
stride | Stride in bytes between scanlines |
mode | Mode configuration to be written to LCD register |
void gspSetEventCallback | ( | GSPGPU_Event | id, |
ThreadFunc | cb, | ||
void * | data, | ||
bool | oneShot | ||
) |
Configures a callback to run when a GSPGPU event occurs.
id | ID of the event. |
cb | Callback to run. |
data | Data to be passed to the callback. |
oneShot | When true, the callback is only executed once. When false, the callback is executed every time the event occurs. |
Submits a GX command.
gxCommand | GX command to execute. |
GSPGPU_Event gspWaitForAnyEvent | ( | void | ) |
Waits for any GSPGPU event to occur.
The function returns immediately if there are unprocessed events at the time of call.
void gspWaitForEvent | ( | GSPGPU_Event | id, |
bool | nextEvent | ||
) |
Waits for a GSPGPU event to occur.
id | ID of the event. |
nextEvent | Whether to discard the current event and wait for the next event. |