1 /*
2    (c) Copyright 2001-2011  The world wide DirectFB Open Source Community (directfb.org)
3    (c) Copyright 2000-2004  Convergence (integrated media) GmbH
4 
5    All rights reserved.
6 
7    Written by Denis Oliver Kropp <dok@directfb.org>,
8               Andreas Hundt <andi@fischlustig.de>,
9               Sven Neumann <neo@directfb.org>,
10               Ville Syrjälä <syrjala@sci.fi> and
11               Claudio Ciccani <klan@users.sf.net>.
12 
13    This library is free software; you can redistribute it and/or
14    modify it under the terms of the GNU Lesser General Public
15    License as published by the Free Software Foundation; either
16    version 2 of the License, or (at your option) any later version.
17 
18    This library is distributed in the hope that it will be useful,
19    but WITHOUT ANY WARRANTY; without even the implied warranty of
20    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21    Lesser General Public License for more details.
22 
23    You should have received a copy of the GNU Lesser General Public
24    License along with this library; if not, write to the
25    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
26    Boston, MA 02111-1307, USA.
27 */
28 
29 #ifndef ___CoreSurface__H___
30 #define ___CoreSurface__H___
31 
32 #include <core/CoreSurface_includes.h>
33 
34 /**********************************************************************************************************************
35  * CoreSurface
36  */
37 
38 #ifdef __cplusplus
39 #include <core/Interface.h>
40 
41 extern "C" {
42 #endif
43 
44 
45 DFBResult CoreSurface_SetConfig(
46                     CoreSurface                               *obj,
47                     const CoreSurfaceConfig                   *config);
48 
49 DFBResult CoreSurface_Flip(
50                     CoreSurface                               *obj,
51                     bool                                       swap);
52 
53 DFBResult CoreSurface_GetPalette(
54                     CoreSurface                               *obj,
55                     CorePalette                              **ret_palette);
56 
57 DFBResult CoreSurface_SetPalette(
58                     CoreSurface                               *obj,
59                     CorePalette                               *palette);
60 
61 DFBResult CoreSurface_SetAlphaRamp(
62                     CoreSurface                               *obj,
63                     u8                                         a0,
64                     u8                                         a1,
65                     u8                                         a2,
66                     u8                                         a3);
67 
68 DFBResult CoreSurface_SetField(
69                     CoreSurface                               *obj,
70                     s32                                        field);
71 
72 DFBResult CoreSurface_PreLockBuffer(
73                     CoreSurface                               *obj,
74                     CoreSurfaceBuffer                         *buffer,
75                     CoreSurfaceAccessorID                      accessor,
76                     CoreSurfaceAccessFlags                     access,
77                     CoreSurfaceAllocation                    **ret_allocation);
78 
79 DFBResult CoreSurface_PreLockBuffer2(
80                     CoreSurface                               *obj,
81                     CoreSurfaceBufferRole                      role,
82                     CoreSurfaceAccessorID                      accessor,
83                     CoreSurfaceAccessFlags                     access,
84                     bool                                       lock,
85                     CoreSurfaceAllocation                    **ret_allocation);
86 
87 DFBResult CoreSurface_PreReadBuffer(
88                     CoreSurface                               *obj,
89                     CoreSurfaceBuffer                         *buffer,
90                     const DFBRectangle                        *rect,
91                     CoreSurfaceAllocation                    **ret_allocation);
92 
93 DFBResult CoreSurface_PreWriteBuffer(
94                     CoreSurface                               *obj,
95                     CoreSurfaceBuffer                         *buffer,
96                     const DFBRectangle                        *rect,
97                     CoreSurfaceAllocation                    **ret_allocation);
98 
99 
100 void CoreSurface_Init_Dispatch(
101                     CoreDFB              *core,
102                     CoreSurface          *obj,
103                     FusionCall           *call
104 );
105 
106 void  CoreSurface_Deinit_Dispatch(
107                     FusionCall           *call
108 );
109 
110 
111 #ifdef __cplusplus
112 }
113 #endif
114 
115 
116 
117 
118 /*
119  * CoreSurface Calls
120  */
121 typedef enum {
122     _CoreSurface_SetConfig = 1,
123     _CoreSurface_Flip = 2,
124     _CoreSurface_GetPalette = 3,
125     _CoreSurface_SetPalette = 4,
126     _CoreSurface_SetAlphaRamp = 5,
127     _CoreSurface_SetField = 6,
128     _CoreSurface_PreLockBuffer = 7,
129     _CoreSurface_PreLockBuffer2 = 8,
130     _CoreSurface_PreReadBuffer = 9,
131     _CoreSurface_PreWriteBuffer = 10,
132 } CoreSurfaceCall;
133 
134 /*
135  * CoreSurface_SetConfig
136  */
137 typedef struct {
138     CoreSurfaceConfig                          config;
139 } CoreSurfaceSetConfig;
140 
141 typedef struct {
142     DFBResult                                  result;
143 } CoreSurfaceSetConfigReturn;
144 
145 
146 /*
147  * CoreSurface_Flip
148  */
149 typedef struct {
150     bool                                       swap;
151 } CoreSurfaceFlip;
152 
153 typedef struct {
154     DFBResult                                  result;
155 } CoreSurfaceFlipReturn;
156 
157 
158 /*
159  * CoreSurface_GetPalette
160  */
161 typedef struct {
162 } CoreSurfaceGetPalette;
163 
164 typedef struct {
165     DFBResult                                  result;
166     u32                                        palette_id;
167 } CoreSurfaceGetPaletteReturn;
168 
169 
170 /*
171  * CoreSurface_SetPalette
172  */
173 typedef struct {
174     u32                                        palette_id;
175 } CoreSurfaceSetPalette;
176 
177 typedef struct {
178     DFBResult                                  result;
179 } CoreSurfaceSetPaletteReturn;
180 
181 
182 /*
183  * CoreSurface_SetAlphaRamp
184  */
185 typedef struct {
186     u8                                         a0;
187     u8                                         a1;
188     u8                                         a2;
189     u8                                         a3;
190 } CoreSurfaceSetAlphaRamp;
191 
192 typedef struct {
193     DFBResult                                  result;
194 } CoreSurfaceSetAlphaRampReturn;
195 
196 
197 /*
198  * CoreSurface_SetField
199  */
200 typedef struct {
201     s32                                        field;
202 } CoreSurfaceSetField;
203 
204 typedef struct {
205     DFBResult                                  result;
206 } CoreSurfaceSetFieldReturn;
207 
208 
209 /*
210  * CoreSurface_PreLockBuffer
211  */
212 typedef struct {
213     u32                                        buffer_id;
214     CoreSurfaceAccessorID                      accessor;
215     CoreSurfaceAccessFlags                     access;
216 } CoreSurfacePreLockBuffer;
217 
218 typedef struct {
219     DFBResult                                  result;
220     u32                                        allocation_id;
221 } CoreSurfacePreLockBufferReturn;
222 
223 
224 /*
225  * CoreSurface_PreLockBuffer2
226  */
227 typedef struct {
228     CoreSurfaceBufferRole                      role;
229     CoreSurfaceAccessorID                      accessor;
230     CoreSurfaceAccessFlags                     access;
231     bool                                       lock;
232 } CoreSurfacePreLockBuffer2;
233 
234 typedef struct {
235     DFBResult                                  result;
236     u32                                        allocation_id;
237 } CoreSurfacePreLockBuffer2Return;
238 
239 
240 /*
241  * CoreSurface_PreReadBuffer
242  */
243 typedef struct {
244     u32                                        buffer_id;
245     DFBRectangle                               rect;
246 } CoreSurfacePreReadBuffer;
247 
248 typedef struct {
249     DFBResult                                  result;
250     u32                                        allocation_id;
251 } CoreSurfacePreReadBufferReturn;
252 
253 
254 /*
255  * CoreSurface_PreWriteBuffer
256  */
257 typedef struct {
258     u32                                        buffer_id;
259     DFBRectangle                               rect;
260 } CoreSurfacePreWriteBuffer;
261 
262 typedef struct {
263     DFBResult                                  result;
264     u32                                        allocation_id;
265 } CoreSurfacePreWriteBufferReturn;
266 
267 
268 DFBResult ISurface_Real__SetConfig( CoreSurface *obj,
269                     const CoreSurfaceConfig                   *config );
270 
271 DFBResult ISurface_Real__Flip( CoreSurface *obj,
272                     bool                                       swap );
273 
274 DFBResult ISurface_Real__GetPalette( CoreSurface *obj,
275                     CorePalette                              **ret_palette );
276 
277 DFBResult ISurface_Real__SetPalette( CoreSurface *obj,
278                     CorePalette                               *palette );
279 
280 DFBResult ISurface_Real__SetAlphaRamp( CoreSurface *obj,
281                     u8                                         a0,
282                     u8                                         a1,
283                     u8                                         a2,
284                     u8                                         a3 );
285 
286 DFBResult ISurface_Real__SetField( CoreSurface *obj,
287                     s32                                        field );
288 
289 DFBResult ISurface_Real__PreLockBuffer( CoreSurface *obj,
290                     CoreSurfaceBuffer                         *buffer,
291                     CoreSurfaceAccessorID                      accessor,
292                     CoreSurfaceAccessFlags                     access,
293                     CoreSurfaceAllocation                    **ret_allocation );
294 
295 DFBResult ISurface_Real__PreLockBuffer2( CoreSurface *obj,
296                     CoreSurfaceBufferRole                      role,
297                     CoreSurfaceAccessorID                      accessor,
298                     CoreSurfaceAccessFlags                     access,
299                     bool                                       lock,
300                     CoreSurfaceAllocation                    **ret_allocation );
301 
302 DFBResult ISurface_Real__PreReadBuffer( CoreSurface *obj,
303                     CoreSurfaceBuffer                         *buffer,
304                     const DFBRectangle                        *rect,
305                     CoreSurfaceAllocation                    **ret_allocation );
306 
307 DFBResult ISurface_Real__PreWriteBuffer( CoreSurface *obj,
308                     CoreSurfaceBuffer                         *buffer,
309                     const DFBRectangle                        *rect,
310                     CoreSurfaceAllocation                    **ret_allocation );
311 
312 DFBResult ISurface_Requestor__SetConfig( CoreSurface *obj,
313                     const CoreSurfaceConfig                   *config );
314 
315 DFBResult ISurface_Requestor__Flip( CoreSurface *obj,
316                     bool                                       swap );
317 
318 DFBResult ISurface_Requestor__GetPalette( CoreSurface *obj,
319                     CorePalette                              **ret_palette );
320 
321 DFBResult ISurface_Requestor__SetPalette( CoreSurface *obj,
322                     CorePalette                               *palette );
323 
324 DFBResult ISurface_Requestor__SetAlphaRamp( CoreSurface *obj,
325                     u8                                         a0,
326                     u8                                         a1,
327                     u8                                         a2,
328                     u8                                         a3 );
329 
330 DFBResult ISurface_Requestor__SetField( CoreSurface *obj,
331                     s32                                        field );
332 
333 DFBResult ISurface_Requestor__PreLockBuffer( CoreSurface *obj,
334                     CoreSurfaceBuffer                         *buffer,
335                     CoreSurfaceAccessorID                      accessor,
336                     CoreSurfaceAccessFlags                     access,
337                     CoreSurfaceAllocation                    **ret_allocation );
338 
339 DFBResult ISurface_Requestor__PreLockBuffer2( CoreSurface *obj,
340                     CoreSurfaceBufferRole                      role,
341                     CoreSurfaceAccessorID                      accessor,
342                     CoreSurfaceAccessFlags                     access,
343                     bool                                       lock,
344                     CoreSurfaceAllocation                    **ret_allocation );
345 
346 DFBResult ISurface_Requestor__PreReadBuffer( CoreSurface *obj,
347                     CoreSurfaceBuffer                         *buffer,
348                     const DFBRectangle                        *rect,
349                     CoreSurfaceAllocation                    **ret_allocation );
350 
351 DFBResult ISurface_Requestor__PreWriteBuffer( CoreSurface *obj,
352                     CoreSurfaceBuffer                         *buffer,
353                     const DFBRectangle                        *rect,
354                     CoreSurfaceAllocation                    **ret_allocation );
355 
356 
357 DFBResult CoreSurfaceDispatch__Dispatch( CoreSurface *obj,
358                     FusionID      caller,
359                     int           method,
360                     void         *ptr,
361                     unsigned int  length,
362                     void         *ret_ptr,
363                     unsigned int  ret_size,
364                     unsigned int *ret_length );
365 
366 
367 #endif
368