SceDisplay

From Vita Development Wiki
Revision as of 23:33, 9 April 2020 by CelesteBlue (talk | contribs)
Jump to navigation Jump to search

This module handles management of the framebuffers. It uses various display drivers (OLED, HDMI, LCD) as well as drivers to control DMA and other low level details. Embedded in this module is also the boot logo (the PS Logo seen on boot) which is gzipped. On module_start, after setting up the drivers, it gunzips the logo into the SceCamera SRAM (which is unused at this time since camera is not enabled yet). Then it sets the framebuffer to the camera SRAM and turns the brightness up in incremental levels.

Module

Known NIDs

Version Name World Privilege NID
1.69 SceDisplay Non-secure Kernel 0xA7D4F77A
3.60 SceDisplay Non-secure Kernel 0x3F05296F

Libraries

Known NIDs

Version Name World Visibility NID
1.69-3.60 SceDisplayForDriver Non-secure Kernel 0x9FED47AC
1.69-3.60 SceDisplay Non-secure User 0x5ED8F994

Types

typedef enum SceDisplayHead {
	SCE_DISPLAY_HEAD_MAIN_LCD_OLED = 0,
	SCE_DISPLAY_HEAD_HDMI          = 1,
	SCE_DISPLAY_HEAD_SUB_LCD       = 2
} SceDisplayHead;

typedef enum SceDisplayPixelFormat {
	SCE_DISPLAY_PIXELFORMAT_A8B8G8R8 = 0x00000000,
	SCE_DISPLAY_PIXELFORMAT_UNK0     = 0x00008000,
	SCE_DISPLAY_PIXELFORMAT_UNK1     = 0x00100000,
	SCE_DISPLAY_PIXELFORMAT_UNK2     = 0x00800000,
	SCE_DISPLAY_PIXELFORMAT_UNK3     = 0x60000000
} SceDisplayPixelFormat;

/* Update frame buffer base address and pixel format */
#define SCE_DISPLAY_UPDATETIMING_NEXTHSYNC	0
#define SCE_DISPLAY_UPDATETIMING_NEXTVSYNC	1

typedef struct SceDisplayFrameBuf {
    SceSize size;
    void *base;
    SceUInt32 pitch;
    SceDisplayPixelFormat pixelformat;
    SceUInt32 width;
    SceUInt32 height;
} SceDisplayFrameBuf;

typedef enum SceDisplayScreenModeFlag {
	SCE_DISPLAY_SCREENMODE_FLAG_60_HTZ = 0x0000,
	SCE_DISPLAY_SCREENMODE_FLAG_UNK_10 = 0x0010,
	SCE_DISPLAY_SCREENMODE_FLAG_24_HTZ = 0x0020,
	SCE_DISPLAY_SCREENMODE_FLAG_UNK_40 = 0x0040,
	SCE_DISPLAY_SCREENMODE_FLAG_50_HTZ = 0x0080,
	SCE_DISPLAY_SCREENMODE_FLAG_480P = 0x0300,
	SCE_DISPLAY_SCREENMODE_FLAG_576P = 0x0400,
	SCE_DISPLAY_SCREENMODE_FLAG_1080I = 0x0500,
	SCE_DISPLAY_SCREENMODE_FLAG_720P = 0x0600,
	SCE_DISPLAY_SCREENMODE_FLAG_1080P = 0x0700,
	SCE_DISPLAY_SCREENMODE_FLAG_UNK_8000 = 0x8000 // Maybe standard mode. Custom PSVita oled sizes don't have this flag.
} SceDisplayScreenModeFlag;

typedef SceUInt32 SceDisplayScreenMode;

typedef enum SceDisplayScanMode {
	SCE_DISPLAY_SCANMODE_PROGRESSIVE = 0,
	SCE_DISPLAY_SCANMODE_INTERLACED = 1
} SceDisplayScanMode;

typedef struct SceDisplayResolutionInfo {
    SceSize size;
    SceDisplayScreenMode screenMode;
    SceUInt32 width;
    SceUInt32 height;
    SceDisplayPixelFormat pixelformat;
    SceDisplayScanMode scanMode;
    float fps;
} SceDisplayResolutionInfo;

SceDisplayForDriver

NIDs in this library are calculated as SHA1 so they can be bruteforced.

sceDisplayCaptureFrameBufDMACForDriver

Version NID
3.60 0xF116D0B4

sceDisplayCaptureFrameBufIFTUForDriver

Version NID
3.60 0xB0CED8BC

sceDisplayDisableHeadForDriver

Version NID
0.940-3.60 0x43347565
int sceDisplayDisableHeadForDriver(SceDisplayHead head);

sceDisplayEnableHeadForDriver

Version NID
0.940-3.60 0x496032D6
int sceDisplayEnableHeadForDriver(SceDisplayHead head);

sceDisplayGetActualViewportConfForDriver

Version NID
3.60 0x40ACFE51

sceDisplayGetDeviceTypeForDriver

Version NID
3.60 0x8D9A1CCE

sceDisplayGetFrameBufForDriver

Version NID
3.60 0xEEDA2E54
/**
 * Get current framebuffer parameters
 *
 * @param[inout] pFrameBuf - Start address of frame buffer (if NULL, output black)
 *
 * @param[in] iUpdateTimingMode - Specification of frame buffer start address update timing
 *
 * @return 0 on success, < 0 on error.
*/
int sceDisplayGetFrameBufForDriver(SceDisplayFrameBuf *pFrameBuf, SceInt32 iUpdateTimingMode);

sceDisplayGetProcFrameBufInternalForDriver

Version NID
3.60 0x3BC165EF

Wrong name was sceDisplayGetFrameBufInfoForPidForDriver.

/**
 * 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 fb_idx, or 0 to use the PID of the caller.
 * @param[in] head - One of SceDisplayHead values
 * @param[in] fb_idx - Can be 0 or 1
 * @param[out] pProcFrameBuf - Pointer to a ::SceDisplayProcFrameBuf structure
 * which will receive the framebuffer information.
 *
 * @return 0 on success, < 0 on error.
*/
int sceDisplayGetProcFrameBufInternalForDriver(SceUID pid, SceDisplayHead head, int fb_idx, SceDisplayProcFrameBuf *pProcFrameBuf);

sceDisplayGetFrameBufInternalForDriver

Version NID
3.60 0x19F94C63
int sceDisplayGetFrameBufInternalForDriver(SceDisplayFrameBuf *pFrameBuf, SceInt32 iUpdateTimingMode);

sceDisplayGetMaximumFrameBufResolutionForDriver

Version NID
3.60 0x5AFE6CD3
int sceDisplayGetMaximumFrameBufResolutionForDriver(SceUInt32 *width, SceUInt32 *height);

sceDisplayGetPrimaryHeadForDriver

Version NID
0.940 not present
3.60 0xC8E554C5
SceDisplayHead sceDisplayGetPrimaryHeadForDriver(void);

sceDisplayGetRefreshRateInternalForDriver

Version NID
3.60 0x7911958E
/*
Get number of frames per second and scanMode.
This function obtains the theoretical number of frames per second in the current screen mode.
The number of frames per second on the screen (touchscreen) is NTSC-compatible 59.94005994... Hz.
Note that sceDisplayGetRefreshRateInternalForDriver() function returns a theoretical value, and that some error
may be present relative to the actual time.
head The target head
pFps Pointer of type float * to obtain the number of frames per second
scanMode Pointer of type SceDisplayScanMode * to obtain the scan mode
If an error occurs, a negative value is returned.
*/
SceInt32 sceDisplayGetRefreshRateInternalForDriver(SceDisplayHead head, float *pFps, SceDisplayScanMode *scanMode);

sceDisplayGetResolutionInfoInternalForDriver

Version NID
3.60 0xB3C6D647
int sceDisplayGetResolutionInfoInternalForDriver(SceDisplayHead head, SceDisplayResolutionInfo *pInfo);

sceDisplayGetVcountInternalForDriver

Version NID
3.60 0x8B5DA27B
/*
Get number of VSYNCs for a head.
This function returns the value in which each VSYNC during free running is counted.
It increases by 1 at every frame. A wrap-around occurs at 16 bits.
*/
SceUInt32 sceDisplayGetVcountInternalForDriver(SceDisplayHead head);

sceDisplayRegisterFrameBufCallbackForDriver

Version NID
3.60 0x6E22990E

sceDisplayRegisterFrameBufCallbackInternalForDriver

Version NID
3.60 0xFA7CE579

sceDisplayRegisterVblankStartCallbackForDriver

Version NID
3.60 0x7FB0BD28

sceDisplayRegisterVblankStartCallbackInternalForDriver

Version NID
3.60 0x4AE2A2B1

sceDisplaySetBrightnessForDriver

Version NID
3.60 0x9E3C6DC6

sceDisplaySetColorSpaceModeForDriver

Version NID
3.60 0x8D79D187

sceDisplaySetFrameBufForDriver

Version NID
3.60 0x289D82FE
int sceDisplaySetFrameBufForDriver(const SceDisplayFrameBuf *pParam, SceInt32 iUpdateTimingMode);

sceDisplaySetFrameBufInternalForDriver

Version NID
3.60 0x16466675
int sceDisplaySetFrameBufInternalForDriver(SceDisplayHead head, SceUInt32 fb_idx, const SceDisplayFrameBuf *pFrameBuf, SceInt32 iUpdateTimingMode);

sceDisplaySetInvertColorsForDriver

Version NID
3.60 0x19140ACD

sceDisplaySetMergeConfForDriver

Version NID
3.60 0x6B198052

sceDisplayGetOutputModeForDriver

Version NID
0.940-3.60 0xD2CED235
int sceDisplayGetOutputModeForDriver(SceDisplayHead head, SceDisplayScreenMode *screenMode, SceDisplayPixelFormat *pixelformat);

sceDisplaySetOutputModeForDriver

Version NID
0.940-3.60 0xAF5EE5BE
int sceDisplaySetOutputModeForDriver(SceDisplayHead head, SceDisplayScreenMode screenMode, SceDisplayPixelFormat pixelformat);

sceDisplaySetScaleConfForDriver

Version NID
3.60 0xEB390A76
// scale must be between 0.80000001 and 1.20000005
int sceDisplaySetScaleConfForDriver(float scale, SceDisplayHead head, SceUInt32 fb_idx, int a4);

sceDisplaySetViewportConfForDriver

Version NID
3.60 0xEE5EB52D

sceDisplayUnregisterVblankStartCallbackForDriver

Version NID
3.60 0x4B27191F

sceDisplayUnregisterVblankStartCallbackInternalForDriver

Version NID
3.60 0xB027433E

sceDisplayWaitSetFrameBufCBForDriver

Version NID
3.60 0x9D7F203C

sceDisplayWaitSetFrameBufCBInternalForDriver

Version NID
3.60 0x35466D63

sceDisplayWaitSetFrameBufForDriver

Version NID
3.60 0x1C0C9C4A

sceDisplayWaitSetFrameBufInternalForDriver

Version NID
0.940-3.60 0x12A77662

sceDisplayWaitSetFrameBufMultiCBForDriver

Version NID
3.60 0x863EACBE

sceDisplayWaitSetFrameBufMultiCBInternalForDriver

Version NID
3.60 0x6DC8F0F5

sceDisplayWaitSetFrameBufMultiForDriver

Version NID
3.60 0xE6D27E0A

sceDisplayWaitSetFrameBufMultiInternalForDriver

Version NID
3.60 0xF83C95B1

sceDisplayWaitVblankStartCBForDriver

Version NID
3.60 0x46F186C3

sceDisplayWaitVblankStartCBInternalForDriver

Version NID
3.60 0x8F3C0E19

sceDisplayWaitVblankStartForDriver

Version NID
3.60 0x984C27E7

sceDisplayWaitVblankStartInternalForDriver

Version NID
3.60 0xB80CA224

sceDisplayWaitVblankStartMultiCBForDriver

Version NID
3.60 0x77ED8B3A

sceDisplayWaitVblankStartMultiCBInternalForDriver

Version NID
3.60 0x61421AAF

sceDisplayWaitVblankStartMultiForDriver

Version NID
3.60 0x40F1469C

sceDisplayWaitVblankStartMultiInternalForDriver

Version NID
3.60 0x32287576

SceDisplayForDriver_unk_086DEFB6

Version NID
3.60 0x086DEFB6

used in SceGpuEs4

SceDisplayForDriver_unk_332C5410

Version NID
3.60 0x332C5410

used in SceCompat in SceCompatLcdc interrupt handler

SceDisplayForDriver_unk_3D95D478

Version NID
3.60 0x3D95D478

sceDisplayCaptureFrameBufDMACInternalForDriver

Version NID
3.60 0x707EEE2E

used in SceAppMgr

used in sceAppMgrCaptureFrameBufDMACByAppId together with sceDisplayGetPrimaryHeadForDriver

sceDisplaySetOwnerForDriver

Version NID
3.60 0xB54962A1

used in SceAppMgr

SceDisplayForDriver_unk_BC76296A

Version NID
3.60 0xBC76296A

used in SceAppMgr

sceDisplayCaptureFrameBufIFTUInternalForDriver

Version NID
3.60 0xD4C812E5

used in SceAppMgr

used in sceAppMgrCaptureFrameBufIFTUByAppId together with sceDisplayGetPrimaryHeadForDriver

SceDisplayForDriver_311BF561

Version NID
0.940 0x311BF561
3.60 not present

Wrapper for SceIftuForDriver_0FCBF457.

SceDisplay

_sceDisplayGetFrameBufInternal

Version NID
1.69-3.60 0x86A8E436

_sceDisplayGetFrameBuf

Version NID
1.69-3.60 0xA753B0CA
int _sceDisplayGetFrameBuf(SceDisplayFrameBuf *pParam, SceInt32 iUpdateTimingMode, SceSize *size);

_sceDisplayGetMaximumFrameBufResolution

Version NID
3.60 0x2EBFC7CB
int _sceDisplayGetMaximumFrameBufResolution(SceUInt32 *width, SceUInt32 *height);

_sceDisplayGetResolutionInfoInternal

Version NID
3.60 0xFEFEB240
int _sceDisplayGetResolutionInfoInternal(SceDisplayHead head, SceDisplayResolutionInfo *pInfo, SceSize infoSize);

_sceDisplaySetFrameBufForCompat

Version NID
3.60 0x45BCB941

_sceDisplaySetFrameBufInternal

Version NID
1.69-3.60 0x7A8CB78E
// fb_idx: 0 for game/apps and 1 for LiveArea (including HOME and PS overlays)
int _sceDisplaySetFrameBufInternal(SceDisplayHead head, unsigned int fb_idx, const SceDisplayFrameBuf *pFrameBuf, SceInt32 iUpdateTimingMode);

_sceDisplaySetFrameBuf

Version NID
1.69-3.60 0xF51523CB
int _sceDisplaySetFrameBuf(const SceDisplayFrameBuf *pParam, SceInt32 iUpdateTimingMode, SceSize *size);

sceDisplayGetPrimaryHead

Version NID
3.60 0x7178FADA
SceDisplayHead sceDisplayGetPrimaryHead(void);

sceDisplayGetRefreshRate

Version NID
0.940-3.60 0xA08CA60D

Old SDK name was sceDisplayGetFramePerSec.

/*
Get number of frames per second.
This function obtains the theoretical number of frames per second in the current screen mode.
The number of frames per second on the screen (touchscreen) is NTSC-compatible 59.94005994... Hz.
Note that sceDisplayGetRefreshRate() function returns a theoretical value, and that some error
may be present relative to the actual time.
pFps Pointer of type float * to obtain the number of frames per second
If an error occurs, a negative value is returned.
*/
SceInt32 sceDisplayGetRefreshRate(float *pFps);

sceDisplayGetVcountInternal

Version NID
1.69-3.60 0x9686859E
/*
Get number of VSYNCs for a head.
This function returns the value in which each VSYNC during free running is counted.
It increases by 1 at every frame. A wrap-around occurs at 16 bits.
*/
SceUInt32 sceDisplayGetVcountInternal(SceDisplayHead head);

sceDisplayGetVcount

Version NID
1.69-3.60 0xB6FDE0BA
/*
Get number of VSYNCs.
This function returns the value in which each VSYNC during free running is counted.
It increases by 1 at every frame. A wrap-around occurs at 16 bits.
*/
SceUInt32 sceDisplayGetVcount(void);

sceDisplayRegisterVblankStartCallback

Version NID
1.69-3.60 0x6BDF4C4D

sceDisplayUnregisterVblankStartCallback

Version NID
1.69-3.60 0x98436A80

sceDisplayWaitSetFrameBufCB

Version NID
1.69-3.60 0x814C90AF

sceDisplayWaitSetFrameBufMultiCB

Version NID
1.69-3.60 0x3E796EF5

sceDisplayWaitSetFrameBufMulti

Version NID
1.69-3.60 0x7D9864A8

sceDisplayWaitSetFrameBuf

Version NID
1.69-3.60 0x9423560C

sceDisplayWaitVblankStartMulti

Version NID
1.69-3.60 0xDD0A13B8
/*
Wait for start of multiple VBLANK intervals for each thread.
This function places the thread in WAIT state until the start of the next VBLANK, after the specified number of VSYNCs has elapsed since the last time a VBLANK wait function was called.
The sceDisplayWaitVblankStartMulti() and sceDisplayWaitVblankStartMultiCB() functions make the respective thread wait until the next VBLANK after the specified number of VSYNCs have elapsed as determined from the VSYNC count that was returned from the last VBLANK wait state, that was recorded for each thread.
For example, if the sceDisplayWaitVblankStartMulti() function is called with 2 specified for uiVcount, and no VSYNCs have elapsed since the last call, the thread will wait until the start of the second VBLANK. If one VSYNC has elapsed since the last call, the thread will wait until the start of the next VBLANK. If two or more VSYNCs have elapsed since the last call, the thread will start at the next VBLANK. This enables the system to run at a fixed FPS as long as no processing drop occurs. If the function is called with 1 specified for uiVcount, the same operations as sceDisplayWaitVblankStart() and sceDisplayWaitVblankStartCB() will be performed.
The sceDisplayWaitVblankStartMulti() function does not execute a thread manager callback during a WAIT state. If you also want to perform callback processing during the WAIT state, use the sceDisplayWaitVblankStartMultiCB() function.
Use of the sceDisplayWaitVblankStartMulti() or sceDisplayWaitVblankStartMultiCB() function is not recommended while a callback function is executing.
uiVcount Number of VSYNC cycles to wait for (1 to 65535)
*/
SceInt32 sceDisplayWaitVblankStartMulti(SceUInt32 uiVcount);

sceDisplayWaitVblankStartMultiCB

Version NID
1.69-3.60 0x05F27764
/*
Wait for start of multiple VBLANK intervals for each thread.
This function places the thread in WAIT state until the start of the next VBLANK, after the specified number of VSYNCs has elapsed since the last time a VBLANK wait function was called.
The sceDisplayWaitVblankStartMulti() and sceDisplayWaitVblankStartMultiCB() functions make the respective thread wait until the next VBLANK after the specified number of VSYNCs have elapsed as determined from the VSYNC count that was returned from the last VBLANK wait state, that was recorded for each thread.
For example, if the sceDisplayWaitVblankStartMulti() function is called with 2 specified for uiVcount, and no VSYNCs have elapsed since the last call, the thread will wait until the start of the second VBLANK. If one VSYNC has elapsed since the last call, the thread will wait until the start of the next VBLANK. If two or more VSYNCs have elapsed since the last call, the thread will start at the next VBLANK. This enables the system to run at a fixed FPS as long as no processing drop occurs. If the function is called with 1 specified for uiVcount, the same operations as sceDisplayWaitVblankStart() and sceDisplayWaitVblankStartCB() will be performed.
The sceDisplayWaitVblankStartMulti() function does not execute a thread manager callback during a WAIT state. If you also want to perform callback processing during the WAIT state, use the sceDisplayWaitVblankStartMultiCB() function.
Use of the sceDisplayWaitVblankStartMulti() or sceDisplayWaitVblankStartMultiCB() function is not recommended while a callback function is executing.
uiVcount Number of VSYNC cycles to wait for (1 to 65535)
*/
SceInt32 sceDisplayWaitVblankStartMultiCB(SceUInt32 uiVcount);

sceDisplayWaitVblankStart

Version NID
1.69-3.60 0x5795E898
/*
Thread wait for start of VBLANK interval.
This function places the thread in WAIT state until the start of the next VBLANK interval.
Regardless of whether a VBLANK interval was in progress when the sceDisplayWaitVblankStart() or sceDisplayWaitVblankStartCB() function was called, the thread enters WAIT state until the start of the next VBLANK interval.
The sceDisplayWaitVblankStart() function does not execute a thread manager callback during a WAIT state. If you also want to perform callback processing during the WAIT state, use the sceDisplayWaitVblankStartCB() function.
*/
SceInt32 sceDisplayWaitVblankStart(void);

sceDisplayWaitVblankStartCB

Version NID
1.69-3.60 0x78B41B92
/*
Thread wait for start of VBLANK interval.
This function places the thread in WAIT state until the start of the next VBLANK interval.
Regardless of whether a VBLANK interval was in progress when the sceDisplayWaitVblankStart() or sceDisplayWaitVblankStartCB() function was called, the thread enters WAIT state until the start of the next VBLANK interval.
The sceDisplayWaitVblankStart() function does not execute a thread manager callback during a WAIT state. If you also want to perform callback processing during the WAIT state, use the sceDisplayWaitVblankStartCB() function.
*/
SceInt32 sceDisplayWaitVblankStartCB(void);