WebRadioApp  0.1
ewgfxdefs.h
Go to the documentation of this file.
1 /*******************************************************************************
2  *
3  * E M B E D D E D W I Z A R D P R O J E C T
4  *
5  * Copyright (c) TARA Systems
6  *GmbH written by Paul Banach and Manfred Schweyer
7  *
8  ********************************************************************************
9  *
10  * This software and related documentation ("Software") are intellectual
11  * property owned by TARA Systems and are copyright of TARA Systems.
12  * Any modification, copying, reproduction or redistribution of the Software in
13  * whole or in part by any means not in accordance with the End-User License
14  * Agreement for Embedded Wizard is expressly prohibited. The removal of this
15  * preamble is expressly prohibited.
16  *
17  ********************************************************************************
18  *
19  * DESCRIPTION:
20  * This header file contains the default configuration and its validation
21  *rules for the Embedded Wizard Graphics Engine (EWGFX).
22  *
23  * Generally, the Graphics Engine is configured by macro definitions within
24  * your make file or by the platform specific header file 'ewextgfx.h'. The
25  * default configuration values serve only as a kind of fallback if no other
26  * definitions are defined.
27  *
28  * On the other hand, the rules implemented here validate the platform
29  *specific configuration parameters and report errors if invalid values are
30  *specified.
31  *
32  * This file is NOT intended for the editing nor for any custom adaptations!
33  * The adaptations should always occur in:
34  *
35  * 1. your make file, if you are the customer who wants to adapt some values.
36  * In this case simply define the desired macro in the make file. Your
37  * definitions will override the default values.
38  *
39  * or in
40  *
41  * 2. the platform specific header file 'ewextgfx.h', if you are integrating
42  * the graphics engine within your specific graphics subsystem. In this
43  * case you are responsable for the platform specific header and the code
44  * file.
45  *
46  *******************************************************************************/
47 
48 #ifndef EWGFXDEFS_H
49 #define EWGFXDEFS_H
50 
51 /* If not explicitly specified, assume following default values for the maximum
52  surface size */
53 #ifndef EW_MAX_SURFACE_WIDTH
54 #define EW_MAX_SURFACE_WIDTH 2048
55 #endif
56 
57 #ifndef EW_MAX_SURFACE_HEIGHT
58 #define EW_MAX_SURFACE_HEIGHT 2048
59 #endif
60 
61 /* Validate the maximum surface size */
62 #if ((EW_MAX_SURFACE_WIDTH < 128) || (EW_MAX_SURFACE_WIDTH > 4096))
63 #error "The maximum surface width out of range 128 .. 4096."
64 #endif
65 
66 #if ((EW_MAX_SURFACE_HEIGHT < 128) || (EW_MAX_SURFACE_HEIGHT > 4096))
67 #error "The maximum surface height out of range 128 .. 4096."
68 #endif
69 
70 /* The following mode determines how images are stored within the surface pixel
71  memory. This setting should always reflect the orientation of the display in
72  your device in relation to the orientation of the framebuffer itself. If not
73  explicitly specified, assume that all surfaces store the images in their
74  natural, not rotated orientation. The mode is expressed in degree. */
75 #ifndef EW_SURFACE_ROTATION
76 #define EW_SURFACE_ROTATION 0
77 #endif
78 
79 /* Validate the surface rotation mode. ONly the discrete values 0, 90, 180 and
80  270 degree are allowed. */
81 #if (EW_SURFACE_ROTATION != 0) && (EW_SURFACE_ROTATION != 90) && \
82  (EW_SURFACE_ROTATION != 180) && (EW_SURFACE_ROTATION != 270)
83 #error "The surface rotation can be either 0, 90, 180 or 270 degree."
84 #endif
85 
86 /* If not explicitly specified, assume following default value for the maximum
87  surface cache size (in bytes) */
88 #ifndef EW_MAX_SURFACE_CACHE_SIZE
89 #define EW_MAX_SURFACE_CACHE_SIZE 0x00800000
90 #endif
91 
92 /* Validate the maximum surface cache size */
93 #if ((EW_MAX_SURFACE_CACHE_SIZE < 0x00000000) || \
94  (EW_MAX_SURFACE_CACHE_SIZE > 0x20000000))
95 #error "The maximum surface cache size out of range."
96 #endif
97 
98 /* If not explicitly specified, assume following default modes:
99 
100  EW_CACHE_OFFSCREEN_SURFACES == 1 forces the Graphics Engine to maintain
101  all dynamically created surfaces in the surface cache. This is useful,
102  when the creation/destruction of surfaces is an expensive task for the
103  underlying graphics subsystem. With this mode activated these surfaces are
104  handled like any other bitmap resource. They are discarded when the surface
105  cache overflows. If this mode is disabled == 0, the off-screen surfaces
106  are discarded immediately when they are not used anymore. */
107 #ifndef EW_CACHE_OFFSCREEN_SURFACES
108 #define EW_CACHE_OFFSCREEN_SURFACES 1
109 #endif
110 
111 #if EW_CACHE_OFFSCREEN_SURFACES == 0
112 #undef EW_CACHE_OFFSCREEN_SURFACES
113 #endif
114 
115 /* If not explicitly specified, assume following default mode:
116 
117  EW_LAZY_LOAD_BITMAPS = 1 determines that surfaces are created only when
118  they are accessed for the first time. This defers the creation and loading
119  of the respective bitmaps. This corresponds to the default behavior of
120  Embedded Wizard >= 9.30.
121 
122  If EW_LAZY_LOAD_BITMAPS = 0, the surfaces are created immediately just in
123  the moment when the superior bitmap is created or loaded as resource. This
124  corresponds to the default behavior of Embedded Wizard <= 9.20.
125 
126  EW_LAZY_LOAD_BITMAPS_IF_ANIMATED_ONLY : Configuring this macro with the value
127  1 limits the lazy map operation to surfaces belonging to multi-frame animated
128  bitmaps. Other surfaces are loaded immediately memory similarly to version
129  <= 9.20. Using this macro implies that EW_DISCARD_BITMAPS_IF_ANIMATED_ONLY
130  is also defined with the value 1. */
131 #ifndef EW_LAZY_LOAD_BITMAPS
132 #define EW_LAZY_LOAD_BITMAPS 1
133 #endif
134 
135 #ifndef EW_LAZY_LOAD_BITMAPS_IF_ANIMATED_ONLY
136 #define EW_LAZY_LOAD_BITMAPS_IF_ANIMATED_ONLY 0
137 #endif
138 
139 /* If not explicitly specified, assume following default mode:
140 
141  EW_DISCARD_BITMAPS = 1 determines, that the system can discard surfaces if
142  the surface cache overflows, the surfaces are not involved in any drawing
143  operation and the content of the affected surface can be restored again.
144  This corresponds to the default behavior of Embedded Wizard >= 9.30.
145 
146  If EW_DISCARD_BITMAPS = 0, the surfaces remain in memory as long as they
147  are owned by a bitmap. This corresponds to the default behavior of Embedded
148  Wizard <= 9.20.
149 
150  If the Graphics Engine is configured to automatically discard surfaces (the
151  macro EW_DISCARD_BITMAPS == 1), following macros can additionally be used
152  to configure the expected discard behavior more precisely:
153 
154  EW_DISCARD_BITMAPS_IF_ANIMATED_ONLY : Configuring this macro with the value
155  1 limits the discard operation to surfaces belonging to multi-frame animated
156  bitmaps. Other surfaces are retained in memory similarly to version <= 9.20.
157 
158  EW_DISCARD_BITMAPS_IF_NOT_USED_IN_CURRENT_UPDATE : Configuring this macro
159  with the value 1 limits the discard operation to surfaces which have NOT been
160  used in the actual screen update cycle.
161 
162  EW_DISCARD_BITMAPS_IF_NOT_USED_IN_RECENT_UPDATES : Configuring this macro
163  with the value 1 limits the discard operation to surfaces which have NOT been
164  used in the actual and in the preceding screen update cycles. */
165 #ifndef EW_DISCARD_BITMAPS
166 #define EW_DISCARD_BITMAPS 1
167 #endif
168 
169 #ifndef EW_DISCARD_BITMAPS_IF_ANIMATED_ONLY
170 #define EW_DISCARD_BITMAPS_IF_ANIMATED_ONLY 0
171 #endif
172 
173 #ifndef EW_DISCARD_BITMAPS_IF_NOT_USED_IN_CURRENT_UPDATE
174 #define EW_DISCARD_BITMAPS_IF_NOT_USED_IN_CURRENT_UPDATE 0
175 #endif
176 
177 #ifndef EW_DISCARD_BITMAPS_IF_NOT_USED_IN_RECENT_UPDATES
178 #define EW_DISCARD_BITMAPS_IF_NOT_USED_IN_RECENT_UPDATES 0
179 #endif
180 
181 /* If not explicitly specified, assume following default values for the maximum
182  glyph surface size (in pixel). Glyph surface is an alpha8 surface, where all
183  rasterized glyphs are stored. It is a kind of cache. */
184 #ifndef EW_MAX_GLYPH_SURFACE_WIDTH
185 #define EW_MAX_GLYPH_SURFACE_WIDTH 512
186 #endif
187 
188 #ifndef EW_MAX_GLYPH_SURFACE_HEIGHT
189 #define EW_MAX_GLYPH_SURFACE_HEIGHT 512
190 #endif
191 
192 /* Validate the maximum glyph surface size */
193 #if (EW_MAX_GLYPH_SURFACE_WIDTH < 64)
194 #error "The glyph surface width is less than 64."
195 #endif
196 
197 #if (EW_MAX_GLYPH_SURFACE_WIDTH > EW_MAX_SURFACE_WIDTH)
198 #error "The glyph surface size exceeds the maximum surface size."
199 #endif
200 
201 #if (EW_MAX_GLYPH_SURFACE_HEIGHT < 64)
202 #error "The glyph surface height is less than 64."
203 #endif
204 
205 #if (EW_MAX_GLYPH_SURFACE_HEIGHT > EW_MAX_SURFACE_HEIGHT)
206 #error "The glyph surface size exceeds the maximum surface size."
207 #endif
208 
209 /* If not explicitly specified, assume following default modes:
210 
211  EW_BORDER_AROUND_GLYPHS == 1 forces the Graphics Engine to reserve
212  additional one pixel wide border around each glyph within the glyph
213  cache. This is useful, when glyphs are scaled by the GPU HW. */
214 #ifndef EW_BORDER_AROUND_GLYPHS
215 #define EW_BORDER_AROUND_GLYPHS 0
216 #endif
217 
218 #if EW_BORDER_AROUND_GLYPHS == 0
219 #undef EW_BORDER_AROUND_GLYPHS
220 #endif
221 
222 /* If not explicitly specified, assume following default number of tasks,
223  which can wait for execution in a so-called 'issue'. Large number of
224  tasks can promote the automatic elimination of drawing tasks. */
225 #ifndef EW_MAX_ISSUE_TASKS
226 #define EW_MAX_ISSUE_TASKS 100
227 #endif
228 
229 #if ((EW_MAX_ISSUE_TASKS < 1) || (EW_MAX_ISSUE_TASKS > 8196))
230 #error "The maximum number of issue tasks out of range 1 .. 8192."
231 #endif
232 
233 /* If not explicitly specified, assume following default optimization modes.
234 
235  EW_ELIMINATE_TASKS == 1 forces the Graphics Engine to detect and eliminate
236  superfluous drawing operations if these are covered by opaque areas. If
237  necessary, drawing operations will be clipped or even divided in several
238  smaller operations. */
239 #ifndef EW_ELIMINATE_TASKS
240 #define EW_ELIMINATE_TASKS 1
241 #endif
242 
243 /* EW_REORDER_TASKS == 1 forces the Graphics Engine to change the order of
244  drawing operations in order to put together the operations executed by the
245  graphics hardware GPU. This should reduce the synchronization overhead when
246  drawing operations are executed alternately by the CPU and GPU. */
247 #ifndef EW_REORDER_TASKS
248 #define EW_REORDER_TASKS 1
249 #endif
250 
251 /* Minimum opaque area edge length to perform the elimination of the underlying
252  tasks. An opaque drawing operation can force the elimination of underlying
253  drawing operations if its edges have at least the given length. Smaller
254  opaque areas are ignored by the elimination algorithm. This should reduce
255  the elimination overhead. */
256 #ifndef EW_ELIMINATE_MIN_EDGE
257 #define EW_ELIMINATE_MIN_EDGE 16
258 #endif
259 
260 #if (EW_ELIMINATE_MIN_EDGE < 8)
261 #error "The minimum opaque area edge length less than 8."
262 #endif
263 
264 #if EW_ELIMINATE_TASKS == 0
265 #undef EW_ELIMINATE_TASKS
266 #endif
267 
268 #if EW_REORDER_TASKS == 0
269 #undef EW_REORDER_TASKS
270 #endif
271 
272 /* If not explicitly specified, assume following color premultiplication mode.
273  The selected mode should match with the native pixel format of the underlying
274  graphics subsystem. If your target calculates with pre-multiplied colors, set
275  this macro to 1 in your make file. */
276 #ifndef EW_PREMULTIPLY_COLOR_CHANNELS
277 #define EW_PREMULTIPLY_COLOR_CHANNELS 1
278 #endif
279 
280 #if EW_PREMULTIPLY_COLOR_CHANNELS == 0
281 #undef EW_PREMULTIPLY_COLOR_CHANNELS
282 #endif
283 
284 /* If not explicitly specified, assume following screen update modes to be used
285  the Mosaic framework.
286 
287  EW_PERFORM_FULLSCREEN_UPDATE == 1 means that the underlying graphics
288  subsystem expects the entire screen to be redrawn each time screen update is
289  performed. Tipically this is the case of sofisticated 3D hardware accelerated
290  systems or if the framebuffer content is not guaranting to be preserved
291  between. In the case the macro is 0, only dirty screen areas are redrawn.
292 
293  EW_PRESERVE_FRAMEBUFFER_CONTENT == 1 means that the graphics subsystem
294  retains the content of the framebuffer between two consecutive screen update
295  frames.
296 
297  EW_PERFORM_FULLOFFSCREENBUFFER_UPDATE == 1 means that the underlying graphics
298  subsystem expects every off-screen buffer being cleared when drawing in it.
299  The effect is similar to the above described EW_PERFORM_FULLSCREEN_UPDATE
300  with the difference, that it applies to off-screen buffers only and not to
301  the framebuffer itself. */
302 #ifndef EW_PERFORM_FULLSCREEN_UPDATE
303 #define EW_PERFORM_FULLSCREEN_UPDATE 0
304 #endif
305 
306 #if (EW_PERFORM_FULLSCREEN_UPDATE != 0)
307 #undef EW_PERFORM_FULLSCREEN_UPDATE
308 #define EW_PERFORM_FULLSCREEN_UPDATE 1
309 #endif
310 
311 #if EW_PERFORM_FULLSCREEN_UPDATE && (defined EW_PRESERVE_FRAMEBUFFER_CONTENT)
312 #undef EW_PRESERVE_FRAMEBUFFER_CONTENT
313 #endif
314 
315 #ifndef EW_PRESERVE_FRAMEBUFFER_CONTENT
316 #if EW_PERFORM_FULLSCREEN_UPDATE
317 #define EW_PRESERVE_FRAMEBUFFER_CONTENT 0
318 #else
319 #define EW_PRESERVE_FRAMEBUFFER_CONTENT 1
320 #endif
321 #endif
322 
323 #if (EW_PRESERVE_FRAMEBUFFER_CONTENT != 0)
324 #undef EW_PRESERVE_FRAMEBUFFER_CONTENT
325 #define EW_PRESERVE_FRAMEBUFFER_CONTENT 1
326 #endif
327 
328 #ifndef EW_PERFORM_FULLOFFSCREENBUFFER_UPDATE
329 #define EW_PERFORM_FULLOFFSCREENBUFFER_UPDATE 0
330 #endif
331 
332 #if (EW_PERFORM_FULLOFFSCREENBUFFER_UPDATE != 0)
333 #undef EW_PERFORM_FULLOFFSCREENBUFFER_UPDATE
334 #define EW_PERFORM_FULLOFFSCREENBUFFER_UPDATE 1
335 #endif
336 
337 #endif /* EWGFXDEFS_H */
338 
339 /* pba */