psl1ght
A free SDK for Sony's PS3 console
resc.h
Go to the documentation of this file.
1 
5 #ifndef __RESC_H__
6 #define __RESC_H__
7 
8 #include <ppu-types.h>
9 
10 #include <rsx/gcm_sys.h>
11 #include <sysutil/sysutil.h>
12 
13 
14 /*
15  * constants
16  */
17 
18 /* Errors */
19 #define RESC_ERROR_NOT_INITIALIZED (0x80210301)
20 #define RESC_ERROR_REINITIALIZED (0x80210302)
21 #define RESC_ERROR_BAD_ALIGNMENT (0x80210303)
22 #define RESC_ERROR_BAD_ARGUMENT (0x80210304)
23 #define RESC_ERROR_LESS_MEMORY (0x80210305)
24 #define RESC_ERROR_GCM_FLIP_QUE_FULL (0x80210306)
25 #define RESC_ERROR_BAD_COMBINATION (0x80210307)
26 
27 /* resource policies */
28 #define RESC_CONSTANT_VRAM 0
29 #define RESC_MINIMUM_VRAM 1
30 #define RESC_CONSTANT_GPU_LOAD 0 /* do not use */
31 #define RESC_MINIMUM_GPU_LOAD 2
32 
33 /* dst formats */
34 #define RESC_SURFACE_A8R8G8B8 GCM_TF_COLOR_A8R8G8B8 /* 8 */
35 #define RESC_SURFACE_F_W16Z16Y16X16 GCM_TF_COLOR_F_W16Z16Y16X16 /* 11 */
36 
37 /* buffer modes */
38 #define RESC_UNDEFINED 0
39 #define RESC_720x480 1
40 #define RESC_720x576 2
41 #define RESC_1280x720 4
42 #define RESC_1920x1080 8
43 
44 /* ratio convert modes */
45 #define RESC_FULLSCREEN 0
46 #define RESC_LETTERBOX 1
47 #define RESC_PANSCAN 2
48 
49 /* PAL temporal mode */
50 #define RESC_PAL_50 0
51 #define RESC_PAL_60_DROP 1
52 #define RESC_PAL_60_INTERPOLATE 2
53 #define RESC_PAL_60_INTERPOLATE_30_DROP 3
54 #define RESC_PAL_60_INTERPOLATE_DROP_FLEXIBLE 4
55 #define RESC_PAL_60_FOR_HSYNC 5
56 
57 /* convolution filter mode */
58 #define RESC_NORMAL_BILINEAR 0
59 #define RESC_INTERLACE_FILTER 1
60 #define RESC_3X3_GAUSSIAN 2
61 #define RESC_2X3_QUINCUNX 3
62 #define RESC_2X3_QUINCUNX_ALT 4
63 
64 /* table element */
65 #define RESC_ELEMENT_HALF 0
66 #define RESC_ELEMENT_FLOAT 1
67 
68 /* flip mode */
69 #define RESC_DISPLAY_VSYNC 0
70 #define RESC_DISPLAY_HSYNC 1
71 
72 
73 #ifdef __cplusplus
74 extern "C" {
75 #endif
76 
77 
78 /*
79  * enumerations
80  */
81 
82 /*
83 typedef enum resc_resource_policy
84 {
85  RESC_CONSTANT_VRAM = 0,
86  RESC_MINIMUM_VRAM = 1,
87  RESC_CONSTANT_GPU_LOAD = 0,
88  RESC_MINIMUM_GPU_LOAD = 2,
89 } rescResourcePolicy;
90 
91 typedef enum resc_display_buffer_mode
92 {
93  RESC_UNDEFINED = 0,
94  RESC_720x480 = 1,
95  RESC_720x576 = 2,
96  RESC_1280x720 = 4,
97  RESC_1920x1080 = 8
98 } rescDisplayBufferMode;
99 
100 typedef enum resc_ratio_convert_mode
101 {
102  RESC_FULLSCREEN = 0,
103  RESC_LETTERBOX = 1,
104  RESC_PANSCAN = 2
105 } rescRatioConvertMode;
106 
107 typedef enum resc_pal_temporal_mode
108 {
109  RESC_PAL_50 = 0,
110  RESC_PAL_60_DROP = 1,
111  RESC_PAL_60_INTERPOLATE = 2,
112  RESC_PAL_60_INTERPOLATE_30_DROP = 3,
113  RESC_PAL_60_INTERPOLATE_DROP_FLEXIBLE = 4,
114  RESC_PAL_60_FOR_HSYNC = 5
115 } rescPalTemporalMode;
116 
117 typedef enum resc_convolution_filter_mode
118 {
119  RESC_NORMAL_BILINEAR = 0,
120  RESC_INTERLACE_FILTER = 1,
121  RESC_3X3_GAUSSIAN = 2,
122  RESC_2X3_QUINCUNX = 3,
123  RESC_2X3_QUINCUNX_ALT = 4
124 
125 } rescConvolutionFilterMode;
126 
127 typedef enum resc_flip_mode
128 {
129  RESC_DISPLAY_VSYNC = 0,
130  RESC_DISPLAY_HSYNC = 1
131 } rescFlipMode;
132 */
133 
134 
135 /*
136  * structures
137  */
138 
139 typedef struct _resc_init_config
140 {
141  u32 size;
142  u32 resourcePolicy;
143  u32 supportModes;
144  u32 ratioMode;
145  u32 palTemporalMode;
146  u32 interlaceMode;
147  u32 flipMode;
149 
150 typedef struct _resc_src
151 {
152  u32 format;
153  u32 pitch;
154  u16 width;
155  u16 height;
156  u32 offset;
157 } rescSrc;
158 
159 typedef struct _resc_dsts
160 {
161  u32 format;
162  u32 pitch;
163  u32 heightAlign;
164 } rescDsts;
165 
166 
167 /*
168  * functions
169  */
170 
171 /* equivalent functions
172  *
173  * rescSetSrc() gcmSetDisplayBuffer()
174  * rescSetConvertAndFlip() gcmSetFlip()
175  * rescSetWaitFlip() gcmSetWaitFlip()
176  * rescSetFlipHandler() gcmSetFlipHandler()
177  * rescSetVBlankHandler() gcmSetVBlankHandler()
178  * rescGetFlipStatus() gcmGetFlipStatus()
179  * rescGetLasFlipTime() gcmGetLastFlipTime()
180  * rescResetFlipStatus() gcmResetFlipStatus()
181  */
182 
183 s32 rescInit(const rescInitConfig* const initConfig);
184 void rescExit();
185 s32 rescSetDsts(u32 dstsMode, rescDsts *dsts);
186 s32 rescSetDisplayMode(u32 bufferMode);
187 s32 rescGetNumColorBuffers(u32 dstsMode, u32 palTemporalMode, u32 reserved);
188 s32 rescGetBufferSize(int *colorBuffers, int *vertexArray, int *fragmentShader);
189 s32 rescSetBufferAddress(void *colorBuffers, void *vertexArray, void *fragmentShader);
190 s32 rescSetSrc(s32 idx, rescSrc *src);
191 s32 rescSetConvertAndFlip(gcmContextData *context, s32 idx);
192 void rescSetWaitFlip(gcmContextData *context);
193 s64 rescGetLastFlipTime();
194 void rescResetFlipStatus();
195 u32 rescGetFlipStatus();
196 s32 rescGetRegisterCount();
197 void rescSetRegisterCount(s32 count);
198 s32 rescSetPalInterpolateDropFlexRatio(float ratio);
199 s32 rescCreateInterlaceTable(void *ea, float srcH, s32 depth, int length);
200 s32 rescAdjustAspectRatio(float horizontal, float vertical);
201 
202 /* Register event handler */
203 void rescSetVBlankHandler(void (*handler)(u32 head));
204 void rescSetFlipHandler(void (*handler)(u32 head));
205 
206 /* Utility functions */
207 s32 rescGcmSurface2RescSrc(gcmSurface *surface, rescSrc *src);
208 s32 rescVideoResolution2RescBufferMode(u32 resolutionId, u32 *bufferMode);
209 
210 #ifdef __cplusplus
211  }
212 #endif
213 
214 #endif
215 
Definition: resc.h:159
Definition: resc.h:150
RSX target surface data structure.
Definition: gcm_sys.h:449
Miscellaneous system utility functions.
Definition: resc.h:139
RSX Context data structure.
Definition: gcm_sys.h:412
RSX low level management.