added kernel libraries bindings and cleaned up todos

This commit is contained in:
2024-05-12 16:16:15 +02:00
parent e9824cbd95
commit 8a5e2870f6
68 changed files with 3278 additions and 92 deletions
+219
View File
@@ -4,6 +4,7 @@ import "core:c"
import sce "../common"
foreign import _display "system:SceDisplay_stub"
foreign import displaykern "system:SceDisplayForDriver_stub"
@(link_prefix = "sceDisplay")
foreign _display {
@@ -131,3 +132,221 @@ foreign _display {
*/
UnregisterVblankStartCallback :: proc(uid: sce.UID) -> c.int ---
}
foreign displaykern {
/**
* Set/Update framebuffer parameters
*
* @param[in] pParam - Pointer to a ::SceDisplayFrameBuf structure.
* @param[in] sync - One of ::DisplaySetBufSync
*
* @return 0 on success, < 0 on error.
* @note - If NULL is provided as pParam pointer, output is blacked out.
*/
ksceDisplaySetFrameBuf :: proc(#by_ptr pParam: SceDisplayFrameBuf, sync: c.int) -> c.int ---
/**
* Set/Update framebuffer parameters for display
*
* @param[in] head - Use 0 for OLED/LCD and 1 for HDMI
* @param[in] index - Can be 0 or 1
* @param[in] pParam - Pointer to a ::SceDisplayFrameBuf structure.
* @param[in] sync - One of ::DisplaySetBufSync
*
* @return 0 on success, < 0 on error.
* @note - If NULL is provided as pParam pointer, output is blacked out.
*/
ksceDisplaySetFrameBufInternal :: proc(head: c.int, index: c.int, #by_ptr pParam: SceDisplayFrameBuf, sync: c.int) -> c.int ---
/**
* Get current framebuffer parameters
*
* @param[out] pParam - Pointer to a ::SceDisplayFrameBuf structure
* which will receive framebuffer parameters.
*
* @param[in] sync - One of ::DisplaySetBufSync
*
* @return 0 on success, < 0 on error.
*/
ksceDisplayGetFrameBuf :: proc(pParam: ^SceDisplayFrameBuf, sync: c.int) -> c.int ---
/**
* Get the configured framebuffer information of a head and its framebuffer index for a PID
*
* @param[in] pid - PID of the process to get the framebuffer information from.
* It can either be a vallid PID, -1 to use the current configured
* framebuffer for the head and index, or 0 to use the PID of the caller.
* @param[in] head - Use 0 for OLED/LCD and 1 for HDMI
* @param[in] index - Can be 0 or 1
* @param[out] info - Pointer to a ::SceDisplayFrameBufInfo structure
* which will receive the framebuffer information.
*
* @return 0 on success, < 0 on error.
*/
ksceDisplayGetProcFrameBufInternal :: proc(pid: sce.UID, head: c.int, index: c.int, info: ^SceDisplayFrameBufInfo) -> c.int ---
/**
* Get maximum framebuffer resolution
*
* @param[out] width - Maximum width
* @param[out] height - Maximum height
*
* @return 0 on success, < 0 on error.
*/
ksceDisplayGetMaximumFrameBufResolution :: proc(width: ^c.int, height: ^c.int) -> c.int ---
/**
* Primary display index
*/
ksceDisplayGetPrimaryHead :: proc() -> c.int ---
/**
* Number of vertical blank pulses up to now for a display
*
* @param[in] display - Display index
*/
ksceDisplayGetVcountInternal :: proc(display: c.int) -> c.int ---
/**
* Wait for vertical blank start
*/
ksceDisplayWaitVblankStart :: proc() -> c.int ---
/**
* Wait for vertical blank start for display
*
* @param[in] display - Display index
*/
ksceDisplayWaitVblankStartInternal :: proc(display: c.int) -> c.int ---
/**
* Wait for vertical blank start with callback
*/
ksceDisplayWaitVblankStartCB :: proc() -> c.int ---
/**
* Wait for vertical blank start with callback for display
*
* @param[in] display - Display index
*/
ksceDisplayWaitVblankStartCBInternal :: proc(display: c.int) -> c.int ---
/**
* Wait for vertical blank start after specified number of vertical periods
*
* @param[in] vcount - Number of vertical periods before waiting for vertical blank start
*/
ksceDisplayWaitVblankStartMulti :: proc(vcount: c.uint) -> c.int ---
/**
* Wait for vertical blank start after specified number of vertical periods for display
*
* @param[in] display - Display index
* @param[in] vcount - Number of vertical periods before waiting for vertical blank start
*/
ksceDisplayWaitVblankStartMultiInternal :: proc(display: c.int, vcount: c.uint) -> c.int ---
/**
* Wait for vertical blank start with callback after specified number of vertical periods
*
* @param[in] vcount - Number of vertical periods before waiting for vertical blank start
*/
ksceDisplayWaitVblankStartMultiCB :: proc(vcount: c.uint) -> c.int ---
/**
* Wait for vertical blank start with callback after specified number of vertical periods for display
*
* @param[in] display - Display index
* @param[in] vcount - Number of vertical periods before waiting for vertical blank start
*/
ksceDisplayWaitVblankStartMultiCBInternal :: proc(display: c.int, vcount: c.uint) -> c.int ---
/**
* Wait for vertical blank start since last update of framebuffer
*/
ksceDisplayWaitSetFrameBuf :: proc() -> c.int ---
/**
* Wait for vertical blank start with callback since last update of framebuffer
*/
ksceDisplayWaitSetFrameBufCB :: proc() -> c.int ---
/**
* Wait for vertical blank start after specified number of vertical periods
* since last update of framebuffer.
*
* @param[in] vcount - Number of vertical periods before waiting for vertical blank start
*/
ksceDisplayWaitSetFrameBufMulti :: proc(vcount: c.uint) -> c.int ---
/**
* Wait for vertical blank start with callback after specified number of vertical periods
* since last update of framebuffer.
*
* @param[in] vcount - Number of vertical periods before waiting for vertical blank start
*/
ksceDisplayWaitSetFrameBufMultiCB :: proc(vcount: c.uint) -> c.int ---
/**
* Register callback to be used at each vertical blank start
*
* @param[in] uid - Callback UID
*/
ksceDisplayRegisterVblankStartCallback :: proc(uid: sce.UID) -> c.int ---
/**
* Register callback to be used at each vertical blank start for a display
*
* @param[in] display - Display index
* @param[in] uid - Callback UID
*/
ksceDisplayRegisterVblankStartCallbackInternal :: proc(display: c.int, uid: sce.UID) -> c.int ---
/**
* Unregister callback used at each vertical blank start
*
* @param[in] uid - Callback UID
*/
ksceDisplayUnregisterVblankStartCallback :: proc(uid: sce.UID) -> c.int ---
/**
* Unregister callback used at each vertical blank start for a display
*
* @param[in] display - Display index
* @param[in] uid - Callback UID
*/
ksceDisplayUnregisterVblankStartCallbackInternal :: proc(display: c.int, uid: sce.UID) -> c.int ---
/**
* Register callback to be used when the framebuffer changes
*
* @param[in] uid - Callback UID
*/
ksceDisplayRegisterFrameBufCallback :: proc(uid: sce.UID) -> c.int ---
/**
* Register callback to be used when the framebuffer changes for a display
*
* @param[in] display - Display index
* @param[in] uid - Callback UID
*/
ksceDisplayRegisterFrameBufCallbackInternal :: proc(display: c.int, uid: sce.UID) -> c.int ---
/**
* Enable/disable color inversion for a display.
*
* @param[in] display - Display index
* @param[in] enable - Enable/disable color inversion
*/
ksceDisplaySetInvertColors :: proc(display: c.int, enable: c.int) -> c.int ---
/**
* Set display plane owner
*
* @param[in] head - Use 0 for OLED/LCD and 1 for HDMI
* @param[in] index - Can be 0 or 1
* @param[in] pid - PID of the new owner
*
* @return 0 on success, < 0 on error.
*/
}
+12 -1
View File
@@ -3,7 +3,6 @@ package display
import "core:c"
import sce "../common"
// TODO: should be c.int
SceDisplayErrorCode :: enum c.uint {
OK = 0,
INVALID_HEAD = 0x80290000,
@@ -54,3 +53,15 @@ when size_of(rawptr) == 4 {
#assert(size_of(SceDisplayFrameBuf) == 0x18)
}
/**
* Extended framebuffer information
*/
SceDisplayFrameBufInfo :: struct {
size: sce.Size, //!< sizeof(SceDisplayFrameBufInfo)
pid: sce.UID, //!< PID of the process owning this framebuffer
vblankcount: c.uint, //!< Amount of VBlanks this framebuffer has been displayed
paddr: c.uintptr_t, //!< Physical address
framebuf: SceDisplayFrameBuf, //!< SceDisplayFrameBuf information
resolution: c.uint, //!< Resolution
}