1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
|
#ifndef _PSP2_KERNEL_DISPLAY_H_
#define _PSP2_KERNEL_DISPLAY_H_
#include <psp2kern/types.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum SceDisplayErrorCode {
SCE_DISPLAY_ERROR_OK = 0,
SCE_DISPLAY_ERROR_INVALID_HEAD = (int)0x80290000,
SCE_DISPLAY_ERROR_INVALID_VALUE = (int)0x80290001,
SCE_DISPLAY_ERROR_INVALID_ADDR = (int)0x80290002,
SCE_DISPLAY_ERROR_INVALID_PIXELFORMAT = (int)0x80290003,
SCE_DISPLAY_ERROR_INVALID_PITCH = (int)0x80290004,
SCE_DISPLAY_ERROR_INVALID_RESOLUTION = (int)0x80290005,
SCE_DISPLAY_ERROR_INVALID_UPDATETIMING = (int)0x80290006,
SCE_DISPLAY_ERROR_NO_FRAME_BUFFER = (int)0x80290007,
SCE_DISPLAY_ERROR_NO_PIXEL_DATA = (int)0x80290008
} SceDisplayErrorCode;
typedef enum SceDisplayPixelFormat {
SCE_DISPLAY_PIXELFORMAT_A8B8G8R8 = 0x00000000U
} SceDisplayPixelFormat;
typedef enum SceDisplaySetBufSync {
/** Buffer change effective immediately */
SCE_DISPLAY_SETBUF_IMMEDIATE = 0,
/** Buffer change effective next frame */
SCE_DISPLAY_SETBUF_NEXTFRAME = 1
} SceDisplaySetBufSync;
/**
* Structure used with ::sceDisplaySetFrameBuf to set/update framebuffer.
* Original screen resolution is 960x544, but the following resolutions
* can also be supplied as width and height :
* 480x272, 640x368, 720x408
*
* @note - This structure is returned by ::sceDisplayGetFrameBuf
*/
typedef struct SceDisplayFrameBuf {
SceSize size; //!< sizeof(SceDisplayFrameBuf)
void *base; //!< Pointer to framebuffer
unsigned int pitch; //!< pitch pixels
unsigned int pixelformat; //!< pixel format (one of ::SceDisplayPixelFormat)
unsigned int width; //!< framebuffer width
unsigned int height; //!< framebuffer height
} SceDisplayFrameBuf;
/**
* Extended framebuffer information
*/
typedef struct SceDisplayFrameBufInfo {
SceSize size; //!< sizeof(SceDisplayFrameBufInfo)
SceUID pid; //!< PID of the process owning this framebuffer
unsigned int vblankcount; //!< Amount of VBlanks this framebuffer has been displayed
uintptr_t paddr; //!< Physical address
SceDisplayFrameBuf framebuf; //!< SceDisplayFrameBuf information
unsigned int resolution; //!< Resolution
} SceDisplayFrameBufInfo;
/**
* 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.
*/
int sceDisplaySetFrameBuf(const SceDisplayFrameBuf *pParam, int sync);
/**
* 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.
*/
int sceDisplaySetFrameBufInternal(int head, int index, const SceDisplayFrameBuf *pParam, int sync);
/**
* 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.
*/
int sceDisplayGetFrameBuf(SceDisplayFrameBuf *pParam, int sync);
/**
* 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.
*/
int sceDisplayGetProcFrameBufInternal(SceUID pid, int head, int index, SceDisplayFrameBufInfo *info);
/**
* Get maximum framebuffer resolution
*
* @param[out] width - Maximum width
* @param[out] height - Maximum height
*
* @return 0 on success, < 0 on error.
*/
int sceDisplayGetMaximumFrameBufResolution(int *width, int *height);
/**
* Primary display index
*/
int sceDisplayGetPrimaryHead(void);
/**
* Number of vertical blank pulses up to now for a display
*
* @param[in] display - Display index
*/
int sceDisplayGetVcountInternal(int display);
/**
* Wait for vertical blank start
*/
int sceDisplayWaitVblankStart(void);
/**
* Wait for vertical blank start for display
*
* @param[in] display - Display index
*/
int sceDisplayWaitVblankStartInternal(int display);
/**
* Wait for vertical blank start with callback
*/
int sceDisplayWaitVblankStartCB(void);
/**
* Wait for vertical blank start with callback for display
*
* @param[in] display - Display index
*/
int sceDisplayWaitVblankStartCBInternal(int display);
/**
* Wait for vertical blank start after specified number of vertical periods
*
* @param[in] vcount - Number of vertical periods before waiting for vertical blank start
*/
int sceDisplayWaitVblankStartMulti(unsigned int vcount);
/**
* 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
*/
int sceDisplayWaitVblankStartMultiInternal(int display, unsigned int vcount);
/**
* 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
*/
int sceDisplayWaitVblankStartMultiCB(unsigned int vcount);
/**
* 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
*/
int sceDisplayWaitVblankStartMultiCBInternal(int display, unsigned int vcount);
/**
* Wait for vertical blank start since last update of framebuffer
*/
int sceDisplayWaitSetFrameBuf(void);
/**
* Wait for vertical blank start with callback since last update of framebuffer
*/
int sceDisplayWaitSetFrameBufCB(void);
/**
* 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
*/
int sceDisplayWaitSetFrameBufMulti(unsigned int vcount);
/**
* 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
*/
int sceDisplayWaitSetFrameBufMultiCB(unsigned int vcount);
/**
* Register callback to be used at each vertical blank start
*
* @param[in] uid - Callback UID
*/
int sceDisplayRegisterVblankStartCallback(SceUID uid);
/**
* Register callback to be used at each vertical blank start for a display
*
* @param[in] display - Display index
* @param[in] uid - Callback UID
*/
int sceDisplayRegisterVblankStartCallbackInternal(int display, SceUID uid);
/**
* Unregister callback used at each vertical blank start
*
* @param[in] uid - Callback UID
*/
int sceDisplayUnregisterVblankStartCallback(SceUID uid);
/**
* Unregister callback used at each vertical blank start for a display
*
* @param[in] display - Display index
* @param[in] uid - Callback UID
*/
int sceDisplayUnregisterVblankStartCallbackInternal(int display, SceUID uid);
/**
* Register callback to be used when the framebuffer changes
*
* @param[in] uid - Callback UID
*/
int sceDisplayRegisterFrameBufCallback(SceUID uid);
/**
* Register callback to be used when the framebuffer changes for a display
*
* @param[in] display - Display index
* @param[in] uid - Callback UID
*/
int sceDisplayRegisterFrameBufCallbackInternal(int display, SceUID uid);
/**
* Enable/disable color inversion for a display.
*
* @param[in] display - Display index
* @param[in] enable - Enable/disable color inversion
*/
int sceDisplaySetInvertColors(int display, int enable);
/**
* 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.
*/
int sceDisplaySetOwner(int head, int index, SceUID pid);
/**
* Set display scaling configuration
*
* @param[in] scale - Scaling factor between 0.80000001 and 1.20000005
* @param[in] head - Use 0 for OLED/LCD and 1 for HDMI
* @param[in] index - Can be 0 or 1
* @param[in] flags - Returns error if ((flags & 1) && (flags & 0xC0))
*
* @return 0 on success, < 0 on error.
*/
int sceDisplaySetScaleConf(float scale, int head, int index, int flags);
#ifdef __cplusplus
}
#endif
#endif /* _PSP2_KERNEL_DISPLAY_H_ */
|