source: svn/newcon3bcm2_21bu/magnum/portinginterface/grc/7552/bgrc.h @ 45

Last change on this file since 45 was 45, checked in by megakiss, 11 years ago
  • Property svn:executable set to *
File size: 113.7 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2003-2012, Broadcom Corporation
3 *     All Rights Reserved
4 *     Confidential Property of Broadcom Corporation
5 *
6 *  THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE
7 *  AGREEMENT  BETWEEN THE USER AND BROADCOM.  YOU HAVE NO RIGHT TO USE OR
8 *  EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT.
9 *
10 * $brcm_Workfile: bgrc.h $
11 * $brcm_Revision: Hydra_Software_Devel/67 $
12 * $brcm_Date: 2/16/12 3:40p $
13 *
14 * Module Description:
15 *
16 * Revision History:
17 *
18 * $brcm_Log: /magnum/portinginterface/grc/7405/bgrc.h $
19 *
20 * Hydra_Software_Devel/67   2/16/12 3:40p nissen
21 * SW7405-5427: Adding flags for output mirroring when blitting
22 *
23 * Hydra_Software_Devel/66   4/20/11 1:31p nissen
24 * SW7630-104: Added support for A8_Y8 format and big endian 420
25 * conversion.
26 *
27 * Hydra_Software_Devel/65   11/19/09 2:53p nissen
28 * SW7405-3429: Changed KeyMatrixScale order default to
29 * KeyThenScaleThenMatrix.
30 *
31 * Hydra_Software_Devel/64   4/17/09 4:41p nissen
32 * PR 51077: Added callbacks to wait functions.
33 *
34 * Hydra_Software_Devel/63   3/20/09 4:31p nissen
35 * PR 51077: Added functions to wait on operations, and better handling
36 * for running out of memory.
37 *
38 * Hydra_Software_Devel/62   3/17/09 3:00p nissen
39 * PR 52321: Added functions for enabling Alpha Premultiply.
40 *
41 * Hydra_Software_Devel/61   9/23/08 1:57p nissen
42 * PR 46638: Increased max operation define.
43 *
44 * Hydra_Software_Devel/60   9/8/08 9:35p nissen
45 * PR 46638: Increased packet memory size max.
46 *
47 * Hydra_Software_Devel/59   2/7/08 12:43p nissen
48 * PR 24618: Added sharper anti-flutter filter coefficient table.
49 *
50 * Hydra_Software_Devel/58   12/17/07 10:03a nissen
51 * PR 38269: Added support for inverting sources during a blit.
52 *
53 * Hydra_Software_Devel/57   11/16/07 3:14p nissen
54 * PR 36759: Added support for setting the scale factor independently of
55 * the provided rectangle sizes.
56 *
57 * Hydra_Software_Devel/56   8/20/07 2:15p nissen
58 * PR 34132: Added support for setting a linear 420 source.
59 *
60 * Hydra_Software_Devel/55   6/18/07 11:49a nissen
61 * PR 32140: Added support for setting scale, color key, and color matrix
62 * order.
63 *
64 * Hydra_Software_Devel/54   5/2/07 11:40a nissen
65 * PR 29724: Added support for 7405 A0 including new MacroBlock strip
66 * width setting.
67 *
68 * Hydra_Software_Devel/53   10/25/06 9:45a nissen
69 * PR 24648: Added formula for range remapping to comments.
70 *
71 * Hydra_Software_Devel/52   10/19/06 10:57a nissen
72 * PR 24647: Added support for preallocting all device memory when module
73 * is opened.
74 *
75 * Hydra_Software_Devel/51   10/5/06 2:01p nissen
76 * PR 24648: Added support for VC-1 macro block range remapping and
77 * expansion for 7401 C0 and 7118.
78 *
79 * Hydra_Software_Devel/50   9/29/06 10:06a nissen
80 * PR 24618: Added support for second blurryer anti-flutter filter
81 * coefficient table.
82 *
83 * Hydra_Software_Devel/49   5/30/06 10:48a nissen
84 * PR 21878: Added support for setting the operation time out interval
85 * with settings structure when opening module.
86 *
87 * Hydra_Software_Devel/48   5/8/06 1:48p nissen
88 * PR 21399: Added BGRC_OperationsComplete function that will read the
89 * M2MC registers to determine if all pending operations are complete.
90 *
91 * Hydra_Software_Devel/47   2/21/06 12:05p nissen
92 * PR 19084: Added support for second m2mc device.
93 *
94 * Hydra_Software_Devel/46   11/7/05 10:11a nissen
95 * PR 17518: Removed offset adjust and clut scale functions for 7401.
96 *
97 * Hydra_Software_Devel/45   10/26/05 1:50p nissen
98 * PR 17518: Added new entry point functions for 7401 scaling parameters.
99 * Added code to return error if not using Sharp filtering while scaling
100 * for 7401.
101 *
102 * Hydra_Software_Devel/44   9/13/05 4:33p nissen
103 * PR 16499: Added code to free memory past a default or specified
104 * threshold.
105 *
106 * Hydra_Software_Devel/43   5/12/05 4:38p nissen
107 * PR 15264: Modified support for user defined phase adjustment when
108 * filtering.
109 *
110 * Hydra_Software_Devel/42   5/12/05 2:49p nissen
111 * PR 15264: Added support for user defined phase adjustment when
112 * filtering.
113 *
114 * Hydra_Software_Devel/41   12/16/04 12:46p nissen
115 * PR 13484: Add comments about bit location of constant color value for
116 * sub-byte formats.
117 *
118 * Hydra_Software_Devel/40   12/13/04 2:16p nissen
119 * PR 13488: Added support for M2MC C0.
120 *
121 * Hydra_Software_Devel/39   9/24/04 2:29p nissen
122 * PR 12728: Removed commas at the end of enums for pedantic errors.
123 *
124 * Hydra_Software_Devel/38   9/24/04 2:20p nissen
125 * PR 12697: Fixed comment.
126 *
127 * Hydra_Software_Devel/37   9/23/04 2:19p nissen
128 * PR 12729: Added anti-flutter filter to filter coefficient enums.
129 *
130 * Hydra_Software_Devel/36   4/9/04 4:14p nissen
131 * PR 10394: Added filter coefficient enum descriptions.
132 *
133 * Hydra_Software_Devel/35   3/12/04 2:25p nissen
134 * PR 10024: Added include for error header file.
135 *
136 * Hydra_Software_Devel/34   2/17/04 4:20p nissen
137 * PR 9719: Added sharper to filter coefficient enums.
138 *
139 * Hydra_Software_Devel/33   2/17/04 3:57p jasonh
140 * PR 9726: Added documentation for real-time vs. non real time, color
141 * key, and dithering.
142 *
143 * Hydra_Software_Devel/32   2/10/04 11:15a nissen
144 * PR 9700: Added blurry to filter coefficient enums.
145 *
146 * Hydra_Software_Devel/31   1/21/04 1:54p nissen
147 * PR 9432: Updated comments.
148 *
149 * Hydra_Software_Devel/30   11/21/03 6:39p nissen
150 * Fixed problem with callback function pointer.
151 *
152 * Hydra_Software_Devel/29   11/20/03 6:59p nissen
153 * Added support for interrupts.
154 *
155 * Hydra_Software_Devel/28   9/29/03 1:26p nissen
156 * Modified Close function to return void.
157 *
158 * Hydra_Software_Devel/27   9/23/03 5:42p jasonh
159 * Fixed documentation for some arguments.
160 *
161 * Hydra_Software_Devel/26   9/10/03 9:14a jasonh
162 * Fixed documentation headers in module overview.
163 *
164 * Hydra_Software_Devel/25   9/5/03 12:52p jasonh
165 * Updated overview documentation.
166 *
167 * Hydra_Software_Devel/24   8/21/03 1:31p nissen
168 * Rearranged function definition order.
169 *
170 * Hydra_Software_Devel/23   8/19/03 10:16a nissen
171 * Removed functions that set component sizes.
172 *
173 * Hydra_Software_Devel/22   8/14/03 4:48p jasonh
174 * Changed SetPaletteBypass to ToggleFilterBypass.
175 *
176 * Hydra_Software_Devel/21   8/14/03 4:37p jasonh
177 * API review changes. Change AMNO->AC2C1C0. Added ToggleFilter. Broke out
178 * enable/disable of colorkey/matrix and state setting into different
179 * functions. Added ResetState and SetDefault functions.
180 *
181 * Hydra_Software_Devel/20   8/12/03 11:32a nissen
182 * Added more scale coeffs enums. Added dither function definition.
183 *
184 * Hydra_Software_Devel/19   8/6/03 2:32p nissen
185 * Updated test plan. Added function definitions.
186 *
187 * Hydra_Software_Devel/18   6/25/03 11:56a nissen
188 * Added exclusive parameter to color key entry points.
189 *
190 * Hydra_Software_Devel/17   6/5/03 11:48a nissen
191 * Updated test plan.
192 *
193 * Hydra_Software_Devel/16   5/29/03 10:05a nissen
194 * Update comments.
195 *
196 * Hydra_Software_Devel/15   5/28/03 6:26p nissen
197 * Updated test plan.
198 *
199 * Hydra_Software_Devel/14   5/28/03 4:55p nissen
200 * Fixing comments.
201 *
202 * Hydra_Software_Devel/13   5/22/03 10:36a nissen
203 * Adjusted test plan.
204 *
205 * Hydra_Software_Devel/12   5/21/03 2:24p nissen
206 * Added dates to test plan.
207 *
208 * Hydra_Software_Devel/11   5/21/03 2:11p nissen
209 * Added test plan comments.
210 *
211 * Hydra_Software_Devel/10   4/25/03 3:45p nissen
212 * Fixed use of surface handle.
213 *
214 * Hydra_Software_Devel/9   4/24/03 6:15p nissen
215 * Updated feature set.
216 *
217 * Hydra_Software_Devel/8   4/18/03 1:41p nissen
218 * Fixed feature set documentation.
219 *
220 * Hydra_Software_Devel/7   4/16/03 12:44p nissen
221 * Added some feature set documentation.
222 *
223 * Hydra_Software_Devel/6   4/10/03 6:04p jasonh
224 * General cleanup.
225 *
226 * Hydra_Software_Devel/5   4/10/03 6:03p jasonh
227 * Added changes from last code review. Added description of sub-apis.
228 * Fixed scaling to use rectangles and not scale factors. Removed inverse
229 * control from blending. Added state function calls. Fixed alpha/main
230 * surface description. Added chroma expansion functions. Added palette
231 * bypass functions. Removed horizontal/vertical scaler controls. Added
232 * better description for matrix, color keying, blending, and color
233 * selection. Added better description of AC2C1C0 channels. Changed ROP to
234 * blending sub-api.
235 *
236 * Hydra_Software_Devel/4   3/25/03 2:42p jasonh
237 * Pre-code review updates.
238 *
239 * Hydra_Software_Devel/3   3/3/03 4:11p jasonh
240 * Added ROP and blending documentation.
241 *
242 * Hydra_Software_Devel/2   3/3/03 4:05p jasonh
243 * Flushed out more documentation issues.
244 *
245 ***************************************************************************/
246
247#ifndef BGRC_H__
248#define BGRC_H__
249
250#include "bchp.h"
251#include "bmem.h"
252#include "bsur.h"
253#include "bint.h"
254#include "breg_mem.h"
255#include "bgrc_errors.h"
256
257#ifdef __cplusplus
258extern "C" {
259#endif
260
261/*=Module Overview: ********************************************************
262The purpose of this module is to take surfaces allocated by the surface
263module, composite the pixels together, and create new pixels for another
264surface. The resulting surface (frame buffer) can then be displayed by
265providing it to the Video Display Control module, or it can be used in
266another graphics compositor operation to create another result.
267
268Non Real-Time Client
269--------------------
270
271Each operation of the compositor may take several fields to compute
272and the same operation may take more or less time each time it is
273computed. The compositor is referred to as a "non real-time client" since
274its operations are not guaranteed to finish within a certain amount of
275time.
276
277The reasons for using this approach are:
278
279o The entire graphics operation can be computed once and stored in a frame
280  buffer. Other real-time graphics engines that do not use frame buffers
281  have to re-compute the results of graphics and contually consume bandwidth
282  in order to compute the same result.
283
284o Since we are allowed to take several frames to compute a frame buffer, the
285  complexity of the operation is no longer constrained by the available
286  bandwidth of one field. We can now implement programmable blenders,
287  high-resolution scaling in both X and Y, and anti-flutter filters for HD
288  resolution graphics without reducing the real-time capabilities of
289  the chipset.
290
291o The number of source surfaces used to create the frame buffer is not
292  limited. Typical real-time graphics engines have limits on how many
293  surfaces they support per line and how many may overlap on a given pixel.
294
295o Complex graphics operations do not effect the video display. Whatever
296  bandwidth is remaining after the other chipset operations will be used to
297  compute the graphics. In real-time graphics, if you pushed the capabilities
298  of the graphics engine, you could affect the actual display and other
299  real-time clients by reducing their available bandwidth.
300
301The disadvantages to this approach are:
302
303o User must allocate a frame buffer to store the computed frame buffer.
304  In order to prevent tearing and similar issues, the user
305  will need to implement double-buffering or a similar mechanism.
306
307o When the user changes an original source surface, the user must
308  re-compute the frame buffer which used that source surface. Graphics
309  engines that don't use frame buffers don't have this problem since
310  they are continually updating the display allowing them to automatically
311  update when a change to a source surface is made.
312
313Color Channels
314--------------
315
316The graphics compositor does not work in one specific color space, such as
317YCbCr or RGB space, but operates in a generic color space that the user
318defines. This arbitrary color space has one alpha channel, always referred
319to as A, and three color channels, referred to as C2, C1, and C0.
320
321Once the user understands the rules for converting input pixels into
322(A,C2,C1,C0) space, and understands the steps taken from input to output,
323this generic color space will allow the user to define the color space at
324many of the stages in the pipeline. Literally the user can have a color
325space for the input data, a second color space for blending, and a third
326color space for the output. They could also just use one color space for
327the entire pipeline.
328
329The rules for translation are as follows. When constant values are provided,
330such as when supplying color key ranges, matrix coefficients, and constant
331color values, they are always provided as (A,C2,C1,C0) values. These values
332are passed directly to hardare for use in the pipeline. When pixels
333are translated from input surfaces, alpha and color channels use the
334following rules that operate according to the surface's format:
335
336o If the pixels contain an alpha value, the alpha channel (A) will contain
337  the pixel value. If it doesn't, the constant alpha value will be used.
338o If the pixels contain color information, the color channels (C2,C1,C0)
339  will be assigned colors from that pixel. If using YCrCb colors then
340  C2=Y, C1=Cb, C0=Cr. If using RGB colors then C2=R, C1=G, C0=B. If the
341  pixels do not contain color information the constant color channel values
342  will be used.
343o If the surface references a palette, the above rules are applied on the
344  palette entries according to the format of the palette. If the pixels
345  also contain other values, such as an alpha in addition to a palette index,
346  then those values will replace any entries within the palette before
347  conversion. The user may override derefrencing of the palette and use
348  the index value directly. In that case, C0 will contain the palette index
349  while the other two color channels will contain zero.
350o If the surface uses a compressed format, such as BPXL_eY08_Cb8_Y18_Cr8,
351  the values will be uncompressed using user specified chroma expansion
352  rules before using the above rules t convert into (A,C2,C1,C0) values.
353o After conversion, all color channels will be internally stored as 8-bit
354  values. When used in equations, such as the blending equation, those
355  8-bit values are treated as if that range yielded values from 0 to 1
356  (inclusive).
357
358The same rules are used in reverse to store color channels in the output.
359
360In all of the above cases, when an input pixel value contains less than
3618 bits, the value will be converted to an 8-bit value by replicating the
362high order bits. For example, if you have a 5-bit binary value of 01101,
363the resulting 8-bit expanded value will be 01101011. This rule applies
364for the alpha (A) channel as well as the color channels (C2,C1,C0).
365
366Color conversion example
367------------------------
368
369BPXL_eR5_G6_B5        - Alpha (A) from constant. C2=R, C1=G, and C0=B.
370BPXL_eB5_G5_R5_A1     - Alpha (A) from pixel. C2=R, C1=G, and C0=B.
371BPXL_eA8              - Alpha (A) from pixel. C2, C1, and C0 from constant.
372BPXL_eY08_Cb8_Y18_Cr8 - Alpha (A) from constant for both pixels. C2=Y0 for
373first pixel. C2=Y1 for second pixel. C1=converted Cr and C0=converted Cb
374for both pixels.
375
376Data Flow
377---------
378
379The process and the routing of the alpha and color channels can be seen in
380the following diagram. The diagram shows the main process as well as showing
381what state each of the blocks control. The five blocks of the graphics
382compositor process are named source, destination, blend, pattern, and output.
383
384{image:graphicscompositor overview}
385
386Main Surface and Alpha Surface
387------------------------------
388
389You will notice that for both the Source and Destination blocks, two surfaces
390can be provided for each block. One of these surfaces is the main surface,
391simply referred to as "Surface". The other surface is the "Alpha Surface".
392In general, most users will only be using main surface. This surface supports
393any of the standard pixel formats. The only time where the alpha surface is
394being used is in one very specific case. The main surface must have a format
395of BPXL_R5_G6_B5 and the alpha surface must have a format of BPXL_A1 or BPXL_W1.
396These two surfaces combined will describe a 17-bit format where the color
397channel information will come from the main surface and the alpha information
398will come from the alpha surface.
399
400Color Keying
401------------
402
403In addition to the four color channel values stored for each pixel, there is
404one additional bit of information. This is the color key bit which is set in the
405color keying state in the source and destination blocks. The operation to set
406this bit is enabled with BGRC_Source_ToggleColorKey and
407BGRC_Destination_ToggleColorKey. The parameters for the color key are set
408with calls to BGRC_Source_SetColorKey and BGRC_Source_SetColorKey.
409
410The parameters that you can set allow you to define a min/max range of the color
411key, and a mask which can be used to mask out the value of the input pixel
412before the comparison is made. If the pixel passes the color key test, the
413color key bit for that pixel is marked and if any bit in the replacement mask
414is set, the corresponding bit in the replacement color is used to replace the
415input color.
416
417The additional color key bit is used later on in the output block in the
418procedure defined by the BGRC_Output_SetColorKeySelection. This section determines
419which pixel will be the final result by looking at the color key bit for
420the source and destination. Depending on those four possible combinations,
421the final pixel can come from the source block, the destination block, the
422blend block, or the pattern block.
423
424Color keying is typically used when a specific color value in the source needs
425to be replaced by the corresponding pixel in the destination. To get this
426effect, set the source color key min, max, and mask to appropriate values.
427Remember that if your mask contains zeros, you must adjust your min and max
428ranges to allow a match when those input bits are masked. In addition to the
429source color key parameters you must also tell the output
430color key selection to choose the pixel from the destination when the source
431color key is on. With this final setting you will be able to get source color
432keying working.
433
434In this typical case, there is no real need to specify a replacement color
435and replacement mask since the purpose here is to replace the pixel with one
436from the destination and not replace it with a constant color.
437
438One real tricky case with color keying is when you're combining it with
439scaling. The issue is centered around the additional color key bit. This bit
440along with the corresponding four color channels is fed into the scaler.
441The scaler must then produce four new color channel values as well as a new
442color key bit. The color key bit will be set only if all the contributors to
443that pixel have the color key bit set. The issue this causes can be seen by
444noticing that if half the pixels entering the scaler are color keyed and
445the rest are not, the result will be marked as not color keyed even though
446the color key color was used by the scaler. This will mean that the color
447used for the color key can be spread outside the color key range and those
448pixels will not be marked as color keyed.
449
450There are several ways to lessen the impact of this problem. You can use
451the replacement mask and replacement color to replace the input color key with
452a color like black that doesn't stand out when filtered with neighboring
453pixels. If you need to re-introduce this color after the scaler, like if
454you're planning to use it in a color key operation in the display, you can do
455so by providing the color key value as the destination constant color and using
456the output selection to choose the destination color when source color keying
457is enabled.
458
459Another way to lessen the impact is to choose different filter coefficients
460for the scaler with a call to BGRC_Source_SetFilterCoeffs. This can be used
461to lessen the spread of the color key value outside of the color key area.
462
463Source Block
464------------
465
466The source block is responsible for defining the one of the main inputs to
467the compositor. In a typical situation where a graphic surface is being
468composited into a frame buffer surface, the source block represents the
469graphic surface and not the frame buffer.
470
471The functions used to define the source block are the following:
472
473o Surface: BGRC_Source_SetSurface,
474  BGRC_Source_SetRectangle
475o Alpha Surface: BGRC_Source_SetRectangle,
476  BGRC_Source_SetAlphaSurface
477o Constant Color: BGRC_Source_SetColor
478o Chroma Expansion: BGRC_Source_SetChromaExpansion
479o Palette Dereference: BGRC_Source_TogglePaletteBypass
480o Per-pixel (A,C2,C1,C0) value: BGRC_Source_SetZeroPad
481o Color Keying and Color Matrix operation: BGRC_Source_SetColorKey,
482  BGRC_Source_ToggleColorMatrix, BGRC_Source_ToggleColorKey,
483  BGRC_Source_SetColorMatrix5x4,
484  BGRC_Source_SetColorMatrixRounding,
485  BGRC_Source_SetKeyMatrixOrder
486o Scaling: BGRC_Source_SetScaleAlphaAdjust,
487  BGRC_Source_SetFilterCoeffs, BGRC_Source_SetScaleRounding,
488  BGRC_Source_SetScaleEdgeCondition
489o General: BGRC_Source_SetDefault, BGRC_Source_Reset
490
491Destination Block
492-----------------
493
494The destination block is responsible for defining the one of the main
495inputs to the compositor. In a typical situation where a graphic surface
496is being composited into a frame buffer surface, the destination block
497represents the frame buffer and not the graphic surface.
498
499In general, all the capabilities of the source block are found in the
500destination block. The only exception to this is that you cannot
501scale an input specified as a destination.
502
503The functions used to define the destination block are the following:
504
505o Surface: BGRC_Destination_SetSurface,
506  BGRC_Destination_SetRectangle
507o Alpha Surface: BGRC_Destination_SetRectangle,
508  BGRC_Destination_SetAlphaSurface
509o Constant Color: BGRC_Destination_SetColor
510o Chroma Expansion: BGRC_Destination_SetChromaExpansion
511o Palette Dereference: BGRC_Destination_TogglePaletteBypass
512o Per-pixel (A,C2,C1,C0) value: BGRC_Destination_SetZeroPad
513o Color Keying and Color Matrix operation: BGRC_Destination_SetColorKey,
514  BGRC_Destination_ToggleColorMatrix, BGRC_Destination_ToggleColorKey,
515  BGRC_Destination_SetColorMatrix5x4,
516  BGRC_Destination_SetColorMatrixRounding,
517  BGRC_Destination_SetKeyMatrixOrder
518o General: BGRC_Destination_SetDefault, BGRC_Destination_Reset
519
520Blend Block
521-----------
522
523The purpose of the blend block is to blend the results from the source
524block with the results from the destination block and provide that value
525as an input the output block.
526
527The functions used to define the blend block are the following:
528
529o Constant Color: BGRC_Blend_SetColor
530o Color and Alpha Blending Operations: BGRC_Blend_SetAlphaBlend,
531  BGRC_Blend_SetColorBlend
532o General: BGRC_Blend_SetDefault, BGRC_Blend_Reset
533
534Pattern Block
535-------------
536
537The purpose of the pattern block is to provide pattern operations using
538the results from the source block and the destination block and provide
539that value as an input the output block.
540
541The functions used to define the pattern block are the following:
542
543o Pattern Operation: BGRC_Pattern_Set
544o General: BGRC_Pattern_SetDefault, BGRC_Pattern_Reset
545
546Output Block
547------------
548
549Results from the other four blocks are provided as inputs to this block.
550The purpose of this block is to choose which inputs to use as the final
551result, to convert the (A,C2,C1,C0) value into the final color space,
552and to specify where the output should be stored.
553
554The functions used to define the output block are the following:
555
556o Output Selection: BGRC_Output_SetColorKeySelection
557o Color Matrix: BGRC_Output_SetColorMatrixRounding
558o Dither: BGRC_Output_SetDither
559o Surface: BGRC_Output_SetRectangle,
560  BGRC_Output_SetSurface
561o Alpha Surface: BGRC_Output_SetAlphaSurface,
562  BGRC_Output_SetRectangle
563o General: BGRC_Output_SetDefault, BGRC_Output_Reset
564
565Usage
566-----
567
568o User creates handle using BGRC_Open.
569o User sets state using the source, destination, blend, pattern,
570  and output blocks.
571o User issues the state using BGRC_IssueState or
572  BGRC_IssueStateAndWait.
573
574It is important to note that until the operation is completed, the user should
575not modify any input pixels or input palettes. Doing so will result in an
576undefined result.
577
578Test Plan
579---------
580
581        (I) - Test implemented.
582        (F) - Test failed.
583        (P) - Test passed.
584        (?) - Questions about implementation.
585
586        * Feeders: Responsible for fetching graphics data from a specified format.
587                * Format Definition: Describes input and output pixel formats.
588                        * (P) Blit RGB formats to RGB formats.
589                        * (P) Blit YCrCb formats to YCrCb formats.
590                        * (F) Blit Alpha formats to Alpha formats.
591                        * (F) Blit Alpha formats to RGB formats.
592                        * (F) Blit Alpha formats to YCrCb formats.
593                        * (F) Blit RGB formats to Alpha formats.
594                        * (F) Blit YCrCb formats to Alpha formats.
595                * Palette: Use fetched pixel as an index into color lookup table.
596                        * (P) Blit Palette formats to same Palette formats bypassing table lookup.
597                        * (P) Blit Palette formats to RGB formats with table lookup.
598                        * (P) Blit Palette formats to YCrCb formats with table lookup.
599                * YCrCb Filtering: Expands chroma values using filtering.
600                        * (F) Blit YCrCb422 to AYCrCb444 with filtering.
601                * Blit Direction: Feeders can fetch data in any direction.
602                        * (P) Blit RGB format from top-to-bottom and left-to-right.
603                        * (P) Blit RGB format from bottom-to-top and left-to-right.
604                        * (P) Blit RGB format from top-to-bottom and right-to-left.
605                        * (P) Blit RGB format from bottom-to-top and right-to-left.
606                * Constant Pixel: Replaces fetched pixel from surface.
607                        * (P) Blit constant pixel to RGB and YCrCb formats.
608
609        * Color Key: Allows replacement of the pixels fetched by the feeder.
610                * Single or Range
611                        * (P) Blit RGB and YCrCb formats using single color key.
612                        * (P) Blit RGB and YCrCb formats using ranged color key.
613
614        * Color Matrix: Multiplies pixels fetched by the feeder with a matrix.
615                * Color Conversion: Matrix can be used to convert to a new color space.
616                        * (P) Blit RGB formats to YCrCb formats.
617                        * (P) Blit YCrCb formats to RGB formats.
618
619        * Blend: Blends pixels using formula with specified inputs.
620                * Standard Blends: Several blends commonly supported by APIs.
621                        * (P) Blit RGB and YCrCb formats using One/Zero blend.
622                        * (P) Blit RGB and YCrCb formats using Zero/One blend.
623                        * (P) Blit RGB and YCrCb formats using One/One blend.
624                        * (P) Blit RGB and YCrCb formats using SrcAlpha/InvSrcAlpha blend.
625                        * (P) Blit RGB and YCrCb formats using One/InvSrcAlpha blend.
626                        * (P) Blit RGB and YCrCb formats using DstColor/One blend.
627
628        * ROP: Logically combines input pixels.
629                * Standard ROPs: Simple ROPs using source and destination.
630                        * (P) Blit RGB and YCrCb formats using 'copy' ROP.
631                        * (P) Blit RGB and YCrCb formats using 'and' ROP.
632                        * (P) Blit RGB and YCrCb formats using 'or' ROP.
633                        * (P) Blit RGB and YCrCb formats using 'xor' ROP.
634                * Pattern ROPs: ROPs using pattern as a source.
635                        * (P) Blit RGB and YCrCb formats using several pattern ROPs.
636
637        * Scaler: Source surface can be scaled to output size.
638                * Rounding Mode: Least significant bit handling.
639                        * Blit RGB format using truncate rounding.
640                        * Blit RGB format using nearest rounding.
641                * Edge Condition: Filling of missing taps on edges.
642                        * Blit RGB format using using replicate edge condition.
643                        * Blit RGB format using using mirror edge condition.
644                * Scaler Order: Determines order of horizontal and vertical scales.
645                        * Blit RGB format using horizontal then vertical scale.
646                        * Blit RGB format using vertical then horizontal scale.
647                * Averagers and Filters: Produce filtered pixels during scale.
648                        * Blit RGB format using horizontal averagers and filters.
649                        * Blit RGB format using vertical averager.
650                        * Blit RGB format using horizontal and vertical averagers and filters.
651
652See Also:
653        BGRC_Open,
654        BSUR_Surface_Create
655****************************************************************************/
656
657/***************************************************************************
658Summary:
659        The handle for the graphics compositor module.
660
661Description:
662        This is the main handle required to do any operations within the
663        graphics compositor module.
664
665See Also:
666        BGRC_Open
667****************************************************************************/
668typedef struct BGRC_P_Handle *BGRC_Handle;
669
670/***************************************************************************
671Summary:
672        Callback used for task completion.
673
674Description:
675        When a task is issued, this callback can be used to get notification
676        when the task is completed.
677
678See Also:
679        BGRC_IssueState
680****************************************************************************/
681typedef BERR_Code (*BGRC_Callback)(BGRC_Handle hGrc, void *pData);
682
683/***************************************************************************
684Summary:
685        Used to specify how values are rounded for the final result.
686
687Description:
688
689See Also:
690        BGRC_Source_SetChromaExpansion,
691        BGRC_Destination_SetChromaExpansion
692****************************************************************************/
693typedef enum BGRC_ChromaExpansion
694{
695        BGRC_ChromaExpansion_eReplicate,  /* Cr and Cb values are replicated */
696        BGRC_ChromaExpansion_eFilter      /* Cr and Cb values are filtered */
697} BGRC_ChromaExpansion;
698
699/***************************************************************************
700Summary:
701        Used to specify how values are rounded for the final result.
702
703Description:
704
705See Also:
706        BGRC_Source_SetColorMatrixRounding,
707        BGRC_Destination_SetColorMatrixRounding,
708        BGRC_Output_SetColorMatrixRounding,
709        BGRC_Source_SetScaleRounding
710****************************************************************************/
711typedef enum BGRC_Rounding
712{
713        BGRC_Rounding_eTruncate,  /* Values are truncated */
714        BGRC_Rounding_eNearest    /* Values are rounded to nearest */
715} BGRC_Rounding;
716
717/***************************************************************************
718Summary:
719        Used to determine whether color keying comes before or after the color
720        matrix operation.
721
722Description:
723
724See Also:
725        BGRC_Source_SetKeyMatrixOrder,
726        BGRC_Destination_SetKeyMatrixOrder
727****************************************************************************/
728typedef enum BGRC_KeyMatrixOrder
729{
730        BGRC_KeyMatrixOrder_eKeyThenMatrix, /* Color keying operation
731                                               comes before color matrix. */
732        BGRC_KeyMatrixOrder_eMatrixThenKey  /* Color matrix operation
733                                               comes before color keying. */
734} BGRC_KeyMatrixOrder;
735
736/***************************************************************************
737Summary:
738        Used to determine the order of color keying, color matrix, and scaling
739        when processing pixels.
740
741Description:
742
743See Also:
744        BGRC_Source_SetKeyMatrixScaleOrder,
745****************************************************************************/
746typedef enum BGRC_KeyMatrixScaleOrder
747{
748        BGRC_KeyMatrixScaleOrder_eScaleThenKeyThenMatrix, /* Scale-Key-Matrix */
749        BGRC_KeyMatrixScaleOrder_eScaleThenMatrixThenKey, /* Scale-Matrix-Key */
750        BGRC_KeyMatrixScaleOrder_eKeyThenMatrixThenScale, /* Key-Matrix-Scale */
751        BGRC_KeyMatrixScaleOrder_eKeyThenScaleThenMatrix, /* Key-Scale-Matrix */
752        BGRC_KeyMatrixScaleOrder_eMatrixThenScaleThenKey, /* Matrix-Scale-Key */
753        BGRC_KeyMatrixScaleOrder_eMatrixThenKeyThenScale, /* Matrix-Key-Scale */
754        BGRC_KeyMatrixScaleOrder_eBypassAll               /* None */
755} BGRC_KeyMatrixScaleOrder;
756
757/***************************************************************************
758Summary:
759        Specifies what coefficients to use for scaling.
760
761        The following is a description of the filter types:
762
763        Point Sample: Single closest pixel (1 tap) is used, resulting in
764        no filtering. Generates blocky up-scales, and down-scales with missing
765        pixel information.
766
767        Bilinear: Closest pixel is filtered with its neighbor (2 taps) using
768        coefficients dervied from the pixel position. Generates slightly blurry
769        up-scales, and down-scales of less than a half will have missing pixel
770        information.
771
772        Anisotropic: Closest pixel is area filtered with its neighbors
773        (up to 8 taps). This filter is the same as bilinear when up-scaling.
774        When down-scaling, the amount of taps used depends on the scale factor.
775
776        Sharp: Closet pixel is area filtered with its neighbors using filter
777        coefficents generated with a sin wave formula (all 8 taps). Each scale
778        factor has its own table of filter coefficients up to a scale of 8 to 9.
779        Up-scales larger than 8 to 9 use a 1 to N coefficent table. (Default)
780
781        Sharper: Same as sharp, except when scaling larger than 8 to 9, a
782        sharper filter coefficent table is used.
783
784        Blurry: Closest pixel is filtered with two closet neighbors (3 tap).
785        Similar to bilinear except blurryer.
786
787See Also:
788        BGRC_Source_SetFilterCoeffs
789****************************************************************************/
790typedef enum BGRC_FilterCoeffs
791{
792        BGRC_FilterCoeffs_ePointSample,      /* Point sampled filtering */
793        BGRC_FilterCoeffs_eBilinear,         /* Bilinear filtering */
794        BGRC_FilterCoeffs_eAnisotropic,      /* Anisotropic filtering */
795        BGRC_FilterCoeffs_eSharp,            /* Tabled sin(x)/x filtering */
796        BGRC_FilterCoeffs_eSharper,          /* Sharper upscale */
797        BGRC_FilterCoeffs_eBlurry,           /* 3-point filtering */
798        BGRC_FilterCoeffs_eAntiFlutter,      /* Anti-Flutter filtering */
799        BGRC_FilterCoeffs_eAntiFlutterBlurry,/* Blurry Anti-Flutter filtering */
800        BGRC_FilterCoeffs_eAntiFlutterSharp  /* Sharp Anti-Flutter filtering */
801} BGRC_FilterCoeffs;
802
803/***************************************************************************
804Summary:
805        Specifies what to do when an edge condition is reached.
806
807Description:
808
809See Also:
810        BGRC_Source_SetScaleEdgeCondition
811****************************************************************************/
812typedef enum BGRC_EdgeCondition
813{
814        BGRC_EdgeCondition_eReplicateLast,  /* Last pixel is replicated */
815        BGRC_EdgeCondition_eMirror          /* Mirrored along edge */
816} BGRC_EdgeCondition;
817
818/***************************************************************************
819Summary:
820        Specifies what source to use for each individual piece of the
821        blending equation.
822
823Description:
824
825See Also:
826        BGRC_Blend_SetColorBlend,
827        BGRC_Blend_SetAlphaBlend
828****************************************************************************/
829typedef enum BGRC_Blend_Source
830{
831        BGRC_Blend_Source_eZero,                    /* Zero */
832        BGRC_Blend_Source_eHalf,                    /* 1/2 */
833        BGRC_Blend_Source_eOne,                     /* One */
834        BGRC_Blend_Source_eSourceColor,             /* Color from source */
835        BGRC_Blend_Source_eInverseSourceColor,      /* 1-color from source */
836        BGRC_Blend_Source_eSourceAlpha,             /* Alpha from source */
837        BGRC_Blend_Source_eInverseSourceAlpha,      /* 1-alpha from source */
838        BGRC_Blend_Source_eDestinationColor,        /* Color from destination */
839        BGRC_Blend_Source_eInverseDestinationColor, /* 1-color from destination */
840        BGRC_Blend_Source_eDestinationAlpha,        /* Alpha from destination */
841        BGRC_Blend_Source_eInverseDestinationAlpha, /* 1-alpha from destination */
842        BGRC_Blend_Source_eConstantColor,           /* Color from blend color */
843        BGRC_Blend_Source_eInverseConstantColor,    /* 1-color from blend color */
844        BGRC_Blend_Source_eConstantAlpha,           /* Alpha from blend color */
845        BGRC_Blend_Source_eInverseConstantAlpha     /* 1-alpha from blend color */
846
847} BGRC_Blend_Source;
848
849/***************************************************************************
850Summary:
851        Used to determine what value to take depending on the color keying
852        results.
853
854Description:
855
856See Also:
857        BGRC_Output_SetColorKeySelection
858****************************************************************************/
859typedef enum BGRC_Output_ColorKeySelection
860{
861        BGRC_Output_ColorKeySelection_eTakeSource,       /* Take source pixel */
862        BGRC_Output_ColorKeySelection_eTakeBlend,        /* Take blended pixel */
863        BGRC_Output_ColorKeySelection_eTakeDestination,  /* Take destination pixel */
864        BGRC_Output_ColorKeySelection_eTakePattern       /* Take pattern pixel */
865} BGRC_Output_ColorKeySelection;
866
867/***************************************************************************
868Summary:
869        Used to determine range type when using a YCbCr 420 source surface.
870
871See Also:
872        BGRC_Output_SetColorKeySelection
873****************************************************************************/
874typedef enum BGRC_MacroBlockRange
875{
876        BGRC_MacroBlockRange_None,       /* Disable */
877        BGRC_MacroBlockRange_Expansion,  /* MacroBlock range expansion */
878        BGRC_MacroBlockRange_Remapping   /* MacroBlock range remapping */
879} BGRC_MacroBlockRange;
880
881/***************************************************************************
882Summary:
883        This structure describes some initial settings when opening the
884        graphics compositor.
885
886Description:
887        This structure is used to initialize some private settings within the
888        driver. If this structure is not used when opening the driver, the
889        driver will use its own default settings.
890
891        ulPacketMemoryMax - Maximum memory threshold for register set allocations
892                           that are placed in the M2MC operation queue. The
893                                           driver will allocate past this threshold but will
894                                           deallocte to the threshold when the memory becomes
895                                           idle. Setting this to 0 will allow for unlimited
896                                           packet memory allocations. The default value is
897                                           BGRC_PACKET_MEMORY_MAX defined below.
898        ulOperationMax    - Maximum amount of operation structures allowed to be
899                           stored before deallocations begin. These structures
900                                           are used by the driver's interrupt handler to track
901                                           M2MC operations. It will allocate past this threshold
902                                           but will deallocate to the threshold when the
903                                           structures become idle. Setting this to 0 will allow
904                                           for unlimited operation structure allocations. The
905                                           default value is BGRC_OPERATION_MAX defined below.
906        ulDeviceNum      - M2MC Device number. 0 is default, and only 7400 and
907                                           7438 can set this value to 0 or 1.
908        ulWaitTimeout    - How many seconds to wait before the device times out,
909                           and the driver assumes the device is hung. The default
910                                           is 10 seconds.
911        bPreAllocMemory  - Allocate all memory specified by ulPacketMemoryMax
912                           when opening module. An error will be returned
913                       when memory is exceeded. Defaults to true.
914
915See Also:
916        BGRC_Open
917****************************************************************************/
918typedef struct BGRC_Settings
919{
920        uint32_t ulPacketMemoryMax;      /* max packet memory */
921        uint32_t ulOperationMax;         /* max operations */
922        uint32_t ulDeviceNum;            /* M2MC device number */
923        uint32_t ulWaitTimeout;          /* seconds to wait before timing out */
924        bool bPreAllocMemory;            /* allocate memory when opening module */
925} BGRC_Settings;
926
927#define BGRC_PACKET_MEMORY_MAX    131072
928#define BGRC_OPERATION_MAX          2048
929#define BGRC_WAIT_TIMEOUT             10
930
931/***************************************************************************
932Summary:
933        Gets default settings.
934
935Description:
936        This function returns that default settings which can be modified
937        when calling BGRC_Open. These settings are defined above.
938
939Returns:
940        BERR_SUCCESS - Default settings returned.
941
942See Also:
943        BGRC_Open
944****************************************************************************/
945BERR_Code BGRC_GetDefaultSettings(
946        BGRC_Settings *pDefSettings
947);
948
949/***************************************************************************
950Summary:
951        Opens the graphics compositor module.
952
953Description:
954        The module is opened and a graphics compositor module handle is
955        created and returned. This handle will be necessary to perform any
956        tasks in the graphics compositor module.
957
958        Once opened, all state for each of the sub-modules will be reset as
959        if a call to BGRC_ResetState was made.
960
961Returns:
962        BERR_SUCCESS - Module was opened and valid handle was returned.
963        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
964
965See Also:
966        BGRC_Close
967****************************************************************************/
968BERR_Code BGRC_Open( 
969        BGRC_Handle *phGrc,                /* [out] Pointer to returned GRC
970                                              handle. */
971        BCHP_Handle hChip,                 /* [in] Chip handle. */
972        BREG_Handle hRegister,             /* [in] Register access handle. */
973        BMEM_Handle hMemory,               /* [in] Memory allocation handle. */
974        BINT_Handle hInterrupt,            /* [in] Interrupt handle. */
975        const BGRC_Settings *pDefSettings  /* [in] Pointer to initial settings. */
976);
977
978/***************************************************************************
979Summary:
980        Closes the graphics compositor module.
981
982Description:
983        Once this function is called no more graphics compositor module
984        functions can be used.
985
986        Outstanding tasks may be interrupted without callbacks being
987        called.
988
989See Also:
990        BGRC_Open
991****************************************************************************/
992void BGRC_Close(
993        BGRC_Handle hGrc                   /* [in] GRC module handle to close. */
994);
995
996/***************************************************************************
997Summary:
998        Resets all state back to default values.
999
1000Description:
1001        This call does not make any changes in hardware, nor does it
1002        effect any outstanding operations.
1003
1004        This is implemented by calling reset functions for source,
1005        destination, blend, pattern, and output.
1006
1007Returns:
1008        BERR_SUCCESS - Module state was successfully reset.
1009
1010See Also:
1011        BGRC_Open,
1012        BGRC_Source_ResetState,
1013        BGRC_Destination_ResetState,
1014        BGRC_Blend_ResetState,
1015        BGRC_Pattern_ResetState,
1016        BGRC_Output_ResetState
1017****************************************************************************/
1018BERR_Code BGRC_ResetState(
1019        BGRC_Handle hGrc                   /* [in] Handle to GRC module. */
1020);
1021
1022/***************************************************************************
1023Summary:
1024        Issues state to hardware.
1025
1026Description:
1027        When this call is made, all the state specified in the source,
1028        destination, blend, pattern, and output blocks will be
1029        checked to make sure it is valid. If it is valid, it will be
1030        combined together to form one task which will then be issued
1031        to hardware.
1032
1033    Hardware will work on this task asyncronously. The user has
1034        the option of waiting for the task to complete by using the function
1035        BGRC_IssueStateAndWait, having the module call a callback function
1036        when complete using BGRC_IssueState, or not be notified when
1037        this task is complete.
1038
1039        Tasks issued to hardware will be completed in the order given.
1040        For example, you could issue five tasks without task completion
1041        notification and then wait on the sixth. When the sixth
1042        completes then all six tasks are guaranteed to have completed.
1043
1044        Callbacks will be called from an interrupt handler and must
1045        follow the calling restrictions of interrupt handlers.
1046
1047Returns:
1048        BERR_SUCCESS - Task was issued.
1049
1050See Also:
1051        BGRC_IssueStateAndWait
1052****************************************************************************/
1053BERR_Code BGRC_IssueState(
1054        BGRC_Handle   hGrc,           /* [in] Handle to GRC module. */
1055        BGRC_Callback pCallback,      /* [in] Pointer to completion callback. */
1056        void         *pData           /* [in] Pointer to callback user data. */
1057);
1058
1059/***************************************************************************
1060Summary:
1061        Issues state to hardware and wait for completion.
1062
1063Description:
1064        When this call is made, all the state specified in the source,
1065        destination, blend, pattern, and output blocks will be
1066        checked to make sure it is valid. If it is valid, it will be
1067        combined together to form one task which will then be issued
1068        to hardware.
1069
1070    Hardware will work on this task asyncronously. The user has
1071        the option of waiting for the task to complete by using the function
1072        BGRC_IssueStateAndWait, having the module call a callback function
1073        when complete using BGRC_IssueState, or not be notified when
1074        this task is complete.
1075
1076        Tasks issued to hardware will be completed in the order given.
1077        For example, you could issue five tasks without task completion
1078        notification and then wait on the sixth. When the sixth
1079        completes then all six tasks are guaranteed to have completed.
1080
1081        This specific function does not use a callback but waits for
1082        the given task to complete.
1083
1084Returns:
1085        BERR_SUCCESS - Task was issued and finished.
1086
1087See Also:
1088        BGRC_IssueState
1089****************************************************************************/
1090BERR_Code BGRC_IssueStateAndWait(
1091        BGRC_Handle    hGrc                /* [in] Handle to GRC module. */
1092);
1093
1094/***************************************************************************
1095Summary:
1096        Checks if device operations have completed.
1097
1098Description:
1099        This function will check the hardware registers to determine if all
1100        previous device operations issued through BGRC_IssueState() have
1101        completed. If pending operations are complete, then true will be
1102        returned in the pbComplete parameter, otherwise false will be returned.
1103
1104Returns:
1105        BERR_SUCCESS - Task was issued and finished.
1106
1107See Also:
1108        BGRC_IssueState
1109****************************************************************************/
1110BERR_Code BGRC_OperationsComplete(
1111        BGRC_Handle hGrc,                  /* [in] Handle to GRC module. */
1112        bool *pbComplete                   /* [out] Pointer to return value. */
1113);
1114
1115/***************************************************************************
1116Summary:
1117        Wait until operations are ready.
1118
1119Description:
1120        This function will wait until there are memory resources available to
1121        perform another blit. If a callback function is provided then this
1122        function will return immediately, and call the callback function when
1123        memory resources are available.
1124
1125Returns:
1126        BERR_SUCCESS - Task was issued and finished.
1127
1128See Also:
1129        BGRC_WaitForOperationsComplete
1130****************************************************************************/
1131BERR_Code BGRC_WaitForOperationReady(
1132        BGRC_Handle   hGrc,
1133        BGRC_Callback pCallback_isr,
1134        void         *pData
1135);
1136
1137/***************************************************************************
1138Summary:
1139        Wait until operations are complete.
1140
1141Description:
1142        This function will wait until all operations are complete. If a callback
1143        function is provided then this function will return immediately, and
1144        call the callback function when all operations are complete.
1145
1146Returns:
1147        BERR_SUCCESS - Task was issued and finished.
1148
1149See Also:
1150        BGRC_WaitForOperationReady
1151****************************************************************************/
1152BERR_Code BGRC_WaitForOperationsComplete(
1153        BGRC_Handle   hGrc,
1154        BGRC_Callback pCallback_isr,
1155        void         *pData
1156);
1157
1158/***************************************************************************
1159Summary:
1160        Sets the main surface for the source.
1161
1162Description:
1163        This is used in conjunction with the alpha surface specified
1164        with BGRC_Source_SetAlphaSurface to describe the source pixels.
1165
1166        This surface is not required. As a default, this surface is not
1167        specified.
1168
1169Returns:
1170        BERR_SUCCESS - Main surface was set.
1171        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1172 
1173See Also:
1174        BGRC_Source_SetAlphaSurface,
1175****************************************************************************/
1176BERR_Code BGRC_Source_SetSurface(
1177        BGRC_Handle hGrc,                  /* [in] Handle to GRC module. */
1178        BSUR_Surface_Handle hSurface       /* [in] Main surface handle. */
1179);
1180
1181/***************************************************************************
1182Summary:
1183        Sets the alpha surface for the source
1184
1185Description:
1186        This is used in conjunction with the main surface specified with
1187        BGRC_Source_SetSurface to describe the source pixels.
1188
1189        Currently, this can only be used with a main surface having a pixel
1190        format of BPXL_eR5_G6_B5 and an alpha surface having a pixel format
1191        of BPXL_eA1 or BPXL_eW1.
1192
1193        This surface is not required. As a default, this surface is not
1194        specified.
1195
1196Returns:
1197        BERR_SUCCESS - Alpha surface was set.
1198        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1199
1200See Also:
1201        BGRC_Source_SetSurface
1202****************************************************************************/
1203BERR_Code BGRC_Source_SetAlphaSurface(
1204        BGRC_Handle hGrc,                     /* [in] Handle to GRC module. */
1205        BSUR_Surface_Handle hSurface          /* [in] Alpha surface handle. */
1206);
1207
1208/***************************************************************************
1209Summary:
1210        Enables or disables the palette index bypass.
1211
1212Description:
1213    Typically when a source contains a palette, the palette index
1214        is used to get color channel information from an actual palette.
1215        However, the user may decide to override this behavior and
1216        pass through the index as is. This function is used to
1217        enable and disable this state.
1218
1219        If this state is enabled, C2 and C1 will be set to zero and C0 will
1220        contain the index value.
1221
1222    The default is for the palette index to be used as a reference
1223        to a palette and not to use the palette index.
1224
1225Returns:
1226        BERR_SUCCESS - Palette bypass was set.
1227        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1228
1229See Also:
1230        BGRC_Source_SetSurface
1231****************************************************************************/
1232BERR_Code BGRC_Source_TogglePaletteBypass(
1233        BGRC_Handle hGrc,               /* [in] Handle to GRC module. */
1234        bool bEnableBypass              /* [in] If true, index will be used
1235                                                                           directly. If false, the palette will
1236                                                                           be referenced. */
1237);
1238
1239/***************************************************************************
1240Summary:
1241        Controls the chroma expansion for compressed YCrCb formats.
1242
1243Description:
1244    When a compressed YCrCb format is used as an input, say
1245        BPXL_eY08_Cb8_Y18_Cr8, the pixels must first be uncompressed
1246        before they are converted. This function controls how the
1247        pixels are uncompressed.
1248
1249        As a default, eChromaExpansion will have a value of
1250        BGRC_ChromaExpansion_eReplicate.
1251
1252Returns:
1253        BERR_SUCCESS - Alpha surface was set.
1254        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1255
1256See Also:
1257        BGRC_Source_SetSurface
1258****************************************************************************/
1259BERR_Code BGRC_Source_SetChromaExpansion(
1260        BGRC_Handle hGrc,                      /* [in] Handle to GRC module. */
1261        BGRC_ChromaExpansion eChromaExpansion  /* [in] Chroma expansion type. */
1262);
1263
1264/***************************************************************************
1265Summary:
1266        Enables zero padding or bit replication.
1267
1268Description:
1269        When the source feeder reads pixels, if the pixel components are less
1270        than 8 bits in size, it can either zero pad the low order bits, or
1271        replicate the high order bits into the low order bits.
1272
1273    The default is false (replication).
1274
1275Returns:
1276        BERR_SUCCESS - Palette bypass was set.
1277        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1278
1279See Also:
1280        BGRC_Source_SetSurface
1281****************************************************************************/
1282BERR_Code BGRC_Source_SetZeroPad(
1283        BGRC_Handle hGrc,                /* [in] Handle to GRC module. */
1284        bool bEnableZeroPad              /* [in] If true, zero padding will be
1285                                                                            used. If false, bit replication
1286                                                                                will be used. */
1287);
1288
1289/***************************************************************************
1290Summary:
1291        Sets color key values for the source.
1292
1293Description:
1294        When called, the source color key state is set to use the given values.
1295        When color keying is enabled with BGRC_Source_ToggleColorKey,
1296        the values are used as follows:
1297
1298        o Input color channels are masked with ulMask. The minimum
1299          (ulMin) and maximum (ulMax) range values are also masked.
1300        o If each of the components is less than or equal to the masked
1301          maximum and greater than or equal to the masked minimum, then the
1302          value is considered to be color keyed. Otherwise, it is not color
1303          keyed.
1304        o If the value is color keyed, Any bits of the result that have
1305          a corresponding bit set in ulReplacementMask are replaced
1306          with the bit value in ulReplacement.
1307
1308        When setting bExclusive to true, the above compares become less than
1309        instead of less equal, and greater than instead of greater equal.
1310
1311        When using ARGB, the color format of the parameters are
1312        BPXL_eA8_R8_G8_B8, and when using AYCbCr, the formats are
1313        BPXL_eA8_Y8_Cb8_Cr8.
1314
1315        When a pixel is or isn't chroma keyed it effects the final output
1316        selection specified with the function BGRC_Output_SetColorKeySelection.
1317
1318        The default is for all values to be set to zero, and bExclusive set
1319        to false.
1320
1321Returns:
1322        BERR_SUCCESS - Color key was enabled and set.
1323        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1324 
1325See Also:
1326        BGRC_Source_ToggleColorKey,
1327        BGRC_Source_SetKeyMatrixOrder,
1328        BGRC_Output_SetColorKeySelection,
1329****************************************************************************/
1330BERR_Code BGRC_Source_SetColorKey(
1331        BGRC_Handle hGrc,                     /* [in] Handle to GRC module. */
1332        uint32_t ulMin,                       /* [in] Minimum color key value. */
1333        uint32_t ulMax,                       /* [in] Maximum color key value. */
1334        uint32_t ulMask,                      /* [in] Color key mask. */
1335        uint32_t ulReplacement,               /* [in] Replacement value. */
1336        uint32_t ulReplacementMask,           /* [in] Replacement mask. */
1337        bool bExclusive                       /* [in] Inclusive/exclusive
1338                                                 compare. */
1339);
1340
1341/***************************************************************************
1342Summary:
1343        Toggles the state of color keying.
1344
1345Description:
1346        This function is used to enable and disable the state of color keying.
1347        When enabled, the values and process described in
1348        BGRC_Source_SetColorKey will be used. When disabled, all pixels
1349        are marked as not being color keyed. This effects the final output
1350        selection, specified with the function
1351        BGRC_Output_SetColorKeySelection.
1352
1353        The default is for color keying to be disabled.
1354       
1355Returns:
1356        BERR_SUCCESS - Color key was set.
1357        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1358 
1359See Also:
1360        BGRC_Source_SetColorKey,
1361        BGRC_Source_SetKeyMatrixOrder,
1362        BGRC_Output_SetColorKeySelection,
1363****************************************************************************/
1364BERR_Code BGRC_Source_ToggleColorKey(
1365        BGRC_Handle hGrc,                /* [in] Handle to GRC module. */
1366        bool bEnable                     /* [in] If true, color keying is
1367                                                                                enabled. If false, color keying
1368                                                                                is disabled. */
1369);
1370
1371/***************************************************************************
1372Summary:
1373        Sets the 5x4 color matrix for the source.
1374
1375Description:
1376        This matrix is used to modify the incoming source values.
1377        Typically this is done to convert from one color space to another.
1378
1379        The values used for the color matrix are equal to the values stored
1380        in the ai32_Matrix array right shifted by the ulShift value. In
1381        addition, negative values are converted to positive values before
1382        shifting and then turned back into negative values. For
1383        example, if a value in the matrix was 4 and the shift value was 2, then
1384        the final value is 1 (4>>2 = 1). If a value in the matrix was 7
1385        and the shift value was 3, then the final value would be 0.875.
1386        If a value in the matrix was -7 and the shift value was 3 then the
1387        final values is -0.875.
1388
1389        The values within the color matrix are in the following order:
1390
1391              |  M[0]   M[1]   M[2]   M[3]   M[4] |
1392              |  M[5]   M[6]   M[7]   M[8]   M[9] |
1393              | M[10]  M[11]  M[12]  M[13]  M[14] |
1394              | M[15]  M[16]  M[17]  M[18]  M[19] |
1395
1396        This is multiplied with a column vector of
1397        < C2in, C1in, C0in, Ain, 1 > which yields the following equations:
1398
1399        C2out =  M[0]*C2in +  M[1]*C1in +  M[2]*C0in +  M[3]*Ain +  M[4]
1400        C1out =  M[5]*C2in +  M[6]*C1in +  M[7]*C0in +  M[8]*Ain +  M[9]
1401        C0out = M[10]*C2in + M[11]*C1in + M[12]*C0in + M[13]*Ain + M[14]
1402        Aout  = M[15]*C2in + M[16]*C1in + M[17]*C0in + M[18]*Ain + M[19]
1403
1404        The default is to for the matrix to represent the identity.
1405        M[0] = M[6] = M[12] = M[18] = 1. All other values are zero.
1406
1407Returns:
1408        BERR_SUCCESS - Color matrix was set.
1409        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1410
1411See Also:
1412        BGRC_Source_ToggleColorMatrix,
1413        BGRC_Source_SetColorMatrixRounding,
1414        BGRC_Source_SetKeyMatrixOrder,
1415****************************************************************************/
1416BERR_Code BGRC_Source_SetColorMatrix5x4(
1417        BGRC_Handle hGrc,                 /* [in] Handle to GRC module. */
1418        const int32_t ai32_Matrix[20],    /* [in] Array of unshifted matrix
1419                                             values. */
1420        uint32_t ulShift                  /* [in] Matrix shift value. */
1421);
1422
1423/***************************************************************************
1424Summary:
1425        Toggles the state of the color matrix.
1426
1427Description:
1428        This function is used to enable and disable the color matrix.
1429        When enabled, the values and process described in
1430        BGRC_Source_SetColorMatrix5x4 will be used. When disabled, the matrix
1431        values have no effect.
1432
1433        The default is for the color matrix to be disabled.
1434       
1435Returns:
1436        BERR_SUCCESS - Color matrix was enabled and set.
1437        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1438
1439See Also:
1440        BGRC_Source_SetColorMatrix5x4,
1441        BGRC_Source_SetKeyMatrixOrder,
1442****************************************************************************/
1443BERR_Code BGRC_Source_ToggleColorMatrix(
1444        BGRC_Handle hGrc,                /* [in] Handle to GRC module. */
1445        bool bEnable                     /* [in] If true, the color matrix is
1446                                                                                enabled. If false, the color matrix
1447                                                                                is disabled. */
1448);
1449
1450/***************************************************************************
1451Summary:
1452        Specifies how to round the output values from the source color matrix.
1453
1454Description:
1455        The default rounding state is BGRC_Rounding_eNearest.
1456
1457        In our current hardware implementation, this setting cannot differ from
1458        the destination color matrix rounding setting or output color matrix
1459        rounding setting. The user must insure that these settings are the
1460        same or an error will result.
1461
1462Returns:
1463        BERR_SUCCESS - Color matrix rounding was set.
1464        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1465 
1466See Also:
1467        BGRC_Source_SetColorMatrix5x4,
1468        BGRC_Source_ToggleColorMatrix,
1469        BGRC_Destination_SetColorMatrixRounding,
1470        BGRC_Output_SetColorMatrixRounding
1471****************************************************************************/
1472BERR_Code BGRC_Source_SetColorMatrixRounding(
1473        BGRC_Handle hGrc,                   /* [in] Handle to GRC module. */
1474        BGRC_Rounding eMatrixRounding       /* [in] Matrix rounding selection. */
1475);
1476
1477/***************************************************************************
1478Summary:
1479        Determines the order of the color key and matrix operation.
1480
1481Description:
1482        Gives the user the option of doing color keying first and color
1483        matrix operations second or the option of doing color matrix
1484        operations first and color keying second.
1485
1486        The default is to use an order of
1487        BGRC_KeyMatrixOrder_eKeyThenMatrix.
1488
1489Returns:
1490        BERR_SUCCESS - Order was set.
1491        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1492
1493See Also:
1494        BGRC_Source_ToggleColorKey,
1495        BGRC_Source_ToggleColorMatrix
1496****************************************************************************/
1497BERR_Code BGRC_Source_SetKeyMatrixOrder(
1498        BGRC_Handle hGrc,                      /* [in] Handle to GRC module. */
1499        BGRC_KeyMatrixOrder eKeyMatrixOrder    /* [in] Color key/matrix order
1500                                                  selection. */
1501);
1502
1503/***************************************************************************
1504Summary:
1505        Determines the order of the color key, color matrix, and scaling.
1506
1507Description:
1508        Gives the user the option of selecting the order of color key,
1509        color matrix, and scaling operations. The user also has the option
1510        of bypassing all these operations.
1511
1512        The default is to use an order of
1513        BGRC_KeyMatrixScaleOrder_eKeyThenScaleThenMatrix.
1514
1515Returns:
1516        BERR_SUCCESS - Order was set.
1517        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1518
1519See Also:
1520        BGRC_Source_ToggleColorKey,
1521        BGRC_Source_ToggleColorMatrix
1522****************************************************************************/
1523BERR_Code BGRC_Source_SetKeyMatrixScaleOrder(
1524        BGRC_Handle hGrc,                             /* [in] Handle to GRC. */
1525        BGRC_KeyMatrixScaleOrder eKeyMatrixScaleOrder /* [in] Key/matrix/scale
1526                                                         order selection. */
1527);
1528
1529/***************************************************************************
1530Summary:
1531        Sets the constant color for the source.
1532
1533Description:
1534        This value is used when the source surfaces are missing the alpha
1535        or color channels. When the color is ARGB, the color format is
1536        BPXL_eA8_R8_G8_B8, and when it is AYCbCr, the format is
1537        BPXL_eA8_Y8_Cb8_Cr8. When the surface format is less than a byte in
1538        size, the high-bits of the low-byte contains the constant color.
1539
1540
1541        The default is 0xFF000000 (Alpha is 1, color channels are 0).
1542 
1543Returns:
1544        BERR_SUCCESS - Constant alpha and color was set.
1545        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1546
1547See Also:
1548        BGRC_Source_SetSurface,
1549        BGRC_Source_SetAlphaSurface
1550****************************************************************************/
1551BERR_Code BGRC_Source_SetColor(
1552        BGRC_Handle hGrc,                      /* [in] Handle to GRC module. */
1553        uint32_t ulColor                       /* [in] Constant values to use. */
1554);
1555
1556/***************************************************************************
1557Summary:
1558        Specifies the sub-rectangle of the source surface.
1559
1560Description:
1561        Only the values within this rectangle will be used in the
1562        compositor calculations. The values given here must be restricted
1563        to the size of the surface itself.
1564
1565        The source will be scaled to the size of the output
1566        rectangle, specified by BGRC_Output_SetRectangle.
1567
1568        The default behavior is to use a rectangle the size of the entire
1569        specified source.
1570
1571Returns:
1572        BERR_SUCCESS - Rectangle was set.
1573        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1574
1575See Also:
1576        BGRC_Output_SetRectangle
1577****************************************************************************/
1578BERR_Code BGRC_Source_SetRectangle(
1579        BGRC_Handle hGrc,                      /* [in] Handle to GRC module. */
1580        uint32_t ulLeft,                       /* [in] Rectangle left. */
1581        uint32_t ulTop,                        /* [in] Rectangle top. */
1582        uint32_t ulWidth,                      /* [in] Rectangle width. */
1583        uint32_t ulHeight                      /* [in] Rectangle height. */
1584);
1585
1586/***************************************************************************
1587Summary:
1588        Sets the coefficients for the source filter.
1589
1590Description:
1591        Specifies the coefficients to use when filtering is enabled on the
1592        source. If scaling is enabled, filtering will be enabled except
1593        for severe downscaling. If scaling isn't enabled, filtering
1594        can be enabled through BGRC_Source_ToggleFilter.
1595
1596        The default for both filter coefficients is BGRC_FilterCoeffs_eSharp.
1597
1598Returns:
1599        BERR_SUCCESS - Filter coefficients were set.
1600        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1601
1602See Also:
1603        BGRC_Source_ToggleFilter
1604****************************************************************************/
1605BERR_Code BGRC_Source_SetFilterCoeffs(
1606        BGRC_Handle hGrc,                      /* [in] Handle to GRC module. */
1607        BGRC_FilterCoeffs eHorizontalCoeffs,   /* [in] Horizontal coefficients
1608                                                  selection. */
1609        BGRC_FilterCoeffs eVerticalCoeffs      /* [in] Vertical coefficients
1610                                                  selection. */
1611);
1612
1613/***************************************************************************
1614Summary:
1615        Used to toggle filtering on the source.
1616
1617Description:
1618        This function is used to enable filtering on the horizontal
1619        or vertical axis of the source. This state is only used when scaling
1620        is disabled for a specific axis.
1621
1622Returns:
1623        BERR_SUCCESS - Filtering state was updated.
1624        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1625
1626See Also:
1627        BGRC_Source_SetFilterCoeffs
1628****************************************************************************/
1629BERR_Code BGRC_Source_ToggleFilter(
1630        BGRC_Handle hGrc,                 /* [in] Handle to GRC module. */
1631        bool bEnableHorizontalFilter,     /* [in] If true, the horizontal
1632                                             filter is enabled. When false,
1633                                                                             the horizontal filter is disabled. */       
1634        bool bEnableVerticalFilter        /* [in] If true, the vertical
1635                                             filter is enabled. When false,
1636                                                                             the vertical filter is disabled. */
1637);
1638
1639/***************************************************************************
1640Summary:
1641        Sets the initial phase adjustment for filtering.
1642
1643Description:
1644        Specifies how many source pixels to initial shift when filtering.
1645        The phase will be shifted by the shift value and added to the default
1646        initial phase value. A positive value will shift the image left or
1647        up, and a negative value will shift it right or down.
1648
1649        The resulting initial phase shift formula when scaling is:
1650                (SrcSize / OutSize - 1) / 2 + PhaseAdj
1651
1652        When not scaling the formula is:
1653                1/2 + PhaseAdj
1654
1655        The final adjusted phase shift must be greater than or equal to -4.0
1656        and less than 4.0.
1657
1658        The default values are all 0.
1659
1660Returns:
1661        BERR_SUCCESS - Filter inital phase was set.
1662        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1663
1664See Also:
1665        BGRC_Source_SetFilterCoeffs
1666****************************************************************************/
1667BERR_Code BGRC_Source_SetFilterPhaseAdjustment(
1668        BGRC_Handle hGrc,                  /* [in] Handle to GRC module. */
1669        int32_t iHorizontalPhase,          /* [in] Horizontal initial phase. */
1670        int32_t iVerticalPhase,            /* [in] Vertical initial phase. */
1671        uint32_t ulShift                   /* [in] Initial phase shift value. */
1672);
1673
1674/***************************************************************************
1675Summary:
1676        Sets the scale factors when scaling or filtering.
1677
1678Description:
1679        Overrides the horizontal and vertical scale factor when scaling or when
1680        filtering is enabled. When either a numerator or a denominator is set
1681        to 0, the corresponding scale factor will be calculated using the source
1682        and output rectangles, where the source size is used as the numerator.
1683
1684        The default values are all 0.
1685
1686Returns:
1687        BERR_SUCCESS - Scale factors were set.
1688        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1689
1690See Also:
1691        BGRC_Source_SetFilterPhaseAdjustment
1692****************************************************************************/
1693BERR_Code BGRC_Source_SetFixedScaleFactor(
1694        BGRC_Handle hGrc,                  /* [in] Handle to GRC module. */
1695        uint32_t ulHorizontalNumerator,    /* [in] Horizontal/Source numerator */
1696        uint32_t ulHorizontalDenominator,  /* [in] Horizontal/Source denominator */
1697        uint32_t ulVerticalNumerator,      /* [in] Vertical/Output numerator */
1698        uint32_t ulVerticalDenominator     /* [in] Vertical/Output denominator */
1699);
1700
1701/***************************************************************************
1702Summary:
1703        Specifies whether to adjust alpha for scaling.
1704
1705Description:
1706        This bit will have effect only when "ScaleAlphaAdjust" is enabled.
1707        When enabled, alpha/2 value is subtracted from input sample components.
1708        When disabled, a constant value of 128 is subtracted from the input
1709        sample components. These subtractions are done before data goes into
1710        the filter and are added back once the sample comes out, however the
1711        alpha value added is the modified (scaled) alpha value.
1712
1713        The default is false.
1714
1715Returns:
1716        BERR_SUCCESS - Alpha adjust was set.
1717        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1718        BERR_NOT_SUPPORTED - Not supported.
1719 
1720See Also:
1721        BGRC_Source_SetFilterCoeffs
1722****************************************************************************/
1723BERR_Code BGRC_Source_SetScaleAlphaAdjust(
1724        BGRC_Handle hGrc,                      /* [in] Handle to GRC module. */
1725        bool bAdjustAlpha                      /* [in] Adjust alpha enable. */
1726);
1727
1728/***************************************************************************
1729Summary:
1730        Specifies whether to alpha premultiply for scaling.
1731
1732Description:
1733        Indicates if the input samples are required to be treated as alpha
1734        premultiplied by the scaler. This will have effect only when
1735        BGRC_Source_SetScaleAlphaAdjust is enabled. When enabled, alpha/2 value
1736        is subtracted from input sample. When disabled, a constant value of 0x80
1737        is subtracted from the input sample. These subtractions are done before
1738        data goes into the FIR. They are added back in the same way as above once
1739        the sample comes out of FIR. However, the alpha value added is the
1740        modified (scaled) alpha value.
1741
1742        The default is false.
1743
1744Returns:
1745        BERR_SUCCESS - Scale premultiply was set.
1746        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1747        BERR_NOT_SUPPORTED - Not supported.
1748 
1749See Also:
1750        BGRC_Source_SetFilterCoeffs
1751****************************************************************************/
1752BERR_Code BGRC_Source_SetScaleAlphaPreMultiply(
1753        BGRC_Handle hGrc,                      /* [in] Handle to GRC module. */
1754        bool bAlphaPreMultiply                 /* [in] Premultiply enable. */
1755);
1756
1757/***************************************************************************
1758Summary:
1759        Specifies how to round values after scaling.
1760
1761Description:
1762        The default rounding state is BGRC_Rounding_eNearest.
1763
1764Returns:
1765        BERR_SUCCESS - Scale rounding was set.
1766        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1767
1768See Also:
1769        BGRC_Source_SetFilterCoeffs
1770****************************************************************************/
1771BERR_Code BGRC_Source_SetScaleRounding(
1772        BGRC_Handle hGrc,                    /* [in] Handle to GRC module. */
1773        BGRC_Rounding eScaleRounding         /* [in] Scale rounding selection. */
1774);
1775       
1776/***************************************************************************
1777Summary:
1778        Specifies what to do on scaler edge conditions.
1779
1780Description:
1781        The default is to use an edge condition of BGRC_EdgeCondition_eMirror.
1782
1783Returns:
1784        BERR_SUCCESS - Scale edge condition was set.
1785        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1786        BERR_NOT_SUPPORTED - Not supported.
1787 
1788See Also:
1789        BGRC_Source_SetFilterCoeffs
1790****************************************************************************/
1791BERR_Code BGRC_Source_SetScaleEdgeCondition(
1792        BGRC_Handle hGrc,                    /* [in] Handle to GRC module. */
1793        BGRC_EdgeCondition eEdgeCondition    /* [in] Edge condition selection. */
1794);
1795
1796/***************************************************************************
1797Summary:
1798        Enables alpha premultiply.
1799
1800Description:
1801        When this bit is enabled the components of the pixel are multiplied by
1802        the correspnding alpha value before scaling.
1803
1804Returns:
1805        BERR_SUCCESS - Alpha premultiply was set.
1806        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1807        BERR_NOT_SUPPORTED - Not supported.
1808 
1809See Also:
1810        BGRC_Source_SetClutScaleMode
1811****************************************************************************/
1812BERR_Code BGRC_Source_SetAlphaPreMultiply(
1813        BGRC_Handle hGrc,                    /* [in] Handle to GRC module. */
1814        bool bAlphaPreMultiply               /* [in] Alpha premultiply enable. */
1815);
1816
1817/***************************************************************************
1818Summary:
1819        Enables alpha premultiply offset.
1820
1821Description:
1822        When this bit is enabled a constant value of 128 is subtracted from
1823        the components before alpha-premultiply and is added back afterwords.
1824        This has no effect if "AlphaPreMultiply" is not enabled.
1825
1826Returns:
1827        BERR_SUCCESS - Alpha premultiply offset was set.
1828        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1829        BERR_NOT_SUPPORTED - Not supported.
1830 
1831See Also:
1832        BGRC_Source_SetClutScaleMode
1833****************************************************************************/
1834BERR_Code BGRC_Source_SetAlphaPreMultiplyOffset(
1835        BGRC_Handle hGrc,                    /* [in] Handle to GRC module. */
1836        bool bOffset                         /* [in] Offset adjustment enable. */
1837);
1838
1839/***************************************************************************
1840Summary:
1841        Sets MacroBlock range type for YCbCr 420 source.
1842
1843Description:
1844        When using a YCbCr 420 source, the MacroBlock range can be set to
1845        none, expansion, or remapping for both Y and CbCr. With remapping,
1846        a scale factor between 0 and 7 is required.
1847
1848        The formula for range remapping using a scale factor is:
1849        Y = CLIP(((Y - 128) * (ucScaleFactorY + 9) + 4) >> 3) + 128)
1850        C = CLIP(((C - 128) * (ucScaleFactorC + 9) + 4) >> 3) + 128)
1851
1852        Default is none.
1853
1854Returns:
1855        BERR_SUCCESS - MacroBlock was set.
1856        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1857        BERR_NOT_SUPPORTED - Not supported.
1858 
1859See Also:
1860        BGRC_Source_SetSurface
1861****************************************************************************/
1862BERR_Code BGRC_Source_SetMacroBlock(
1863        BGRC_Handle hGrc,                    /* [in] Handle to GRC module. */
1864        BGRC_MacroBlockRange eRangeY,        /* [in] Range type for Y */
1865        BGRC_MacroBlockRange eRangeC,        /* [in] Range type for CbCr */
1866        uint8_t ucScaleFactorY,              /* [in] Scale factor for Y */
1867        uint8_t ucScaleFactorC               /* [in] Scale factor for CbCr */
1868);
1869
1870/***************************************************************************
1871Summary:
1872        Sets MacroBlock strip width.
1873
1874Description:
1875        When using a YCbCr 420 source, the MacroBlock strip width defaults
1876        to 64 but can also be set to 128 for newer M2MCs.
1877
1878        Default is 64.
1879
1880Returns:
1881        BERR_SUCCESS - MacroBlock strip width was set.
1882        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1883        BERR_NOT_SUPPORTED - Not supported.
1884 
1885See Also:
1886        BGRC_Source_SetMacroBlock
1887****************************************************************************/
1888BERR_Code BGRC_Source_SetMacroBlock_StripWidth(
1889        BGRC_Handle hGrc,                    /* [in] Handle to GRC module. */
1890        uint32_t ulStripWidth                /* [in] Macroblock strip width */
1891);
1892
1893/***************************************************************************
1894Summary:
1895        Sets MacroBlock storage format.
1896
1897Description:
1898        When using a YCbCr 420 source, the MacroBlock source can either be
1899        stored in the display or linear format.
1900
1901        Default is display format (false).
1902
1903Returns:
1904        BERR_SUCCESS - MacroBlock linear format was set.
1905        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1906        BERR_NOT_SUPPORTED - Not supported.
1907 
1908See Also:
1909        BGRC_Source_SetMacroBlock
1910****************************************************************************/
1911BERR_Code BGRC_Source_SetMacroBlock_LinearFormat(
1912        BGRC_Handle hGrc,                    /* [in] Handle to GRC module. */
1913        bool bLinearFormat                   /* [in] Enable linear format */
1914);
1915
1916/***************************************************************************
1917Summary:
1918        Sets MacroBlock endian.
1919
1920Description:
1921        When using a YCbCr 420 source, the MacroBlock source can either be
1922        stored as little or big endian.
1923
1924        Default is little endian (false).
1925
1926Returns:
1927        BERR_SUCCESS - MacroBlock endian was set.
1928        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1929        BERR_NOT_SUPPORTED - Not supported.
1930 
1931See Also:
1932        BGRC_Source_SetMacroBlock
1933****************************************************************************/
1934BERR_Code BGRC_Source_SetMacroBlock_Endian(
1935        BGRC_Handle hGrc,                    /* [in] Handle to GRC module. */
1936        bool bBigEndian                      /* [in] Enable big endian format */
1937);
1938
1939/***************************************************************************
1940Summary:
1941        Sets source blit direction.
1942
1943Description:
1944        This function inverts the pixels of the surface in the specified
1945        direction(s), from right to left, and bottom to top.
1946
1947        Defaults are false, left to right, and top to bottom.
1948
1949Returns:
1950        BERR_SUCCESS - Direction was set.
1951        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1952        BERR_NOT_SUPPORTED - Not supported.
1953****************************************************************************/
1954BERR_Code BGRC_Source_SetDirection(
1955        BGRC_Handle hGrc,
1956        bool bRightToLeft,
1957        bool bBottomToTop
1958);
1959
1960/***************************************************************************
1961Summary:
1962        Resets the state of the source.
1963
1964Description:
1965        All state set by source functions is now set to be the default value.
1966
1967Returns:
1968        BERR_SUCCESS - Default state now set.
1969        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1970 
1971See Also:
1972        BGRC_Source_SetDefault
1973****************************************************************************/
1974BERR_Code BGRC_Source_ResetState(
1975        BGRC_Handle hGrc                     /* [in] Handle to GRC module. */
1976);
1977
1978/***************************************************************************
1979Summary:
1980        Sets the default parameters for the source.
1981
1982Description:
1983        Each source function has a default state associated with it, described
1984        in each of the functions used to modify that state. However, the user
1985        may wish to modify the default state so that future calls to
1986        BGRC_Source_ResetState will use user defined values.
1987       
1988        This function allows you to change the default state. First the user
1989        calls functions to set the needed source state. It then calls
1990        this function which will then use the current state as the default.
1991        Subsequent calls to BGRC_Source_ResetState will use the new
1992        values.
1993
1994Returns:
1995        BERR_SUCCESS - Default state now set.
1996        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1997 
1998See Also:
1999        BGRC_Source_ResetState
2000****************************************************************************/
2001BERR_Code BGRC_Source_SetDefault(
2002        BGRC_Handle hGrc                     /* [in] Handle to GRC module. */
2003);
2004
2005/***************************************************************************
2006Summary:
2007        Sets the main surface for the destination.
2008
2009Description:
2010        This is used in conjunction with the alpha surface specified
2011        with BGRC_Destination_SetAlphaSurface to describe the destination
2012        pixels.
2013
2014        This surface is not required. As a default, this surface is not
2015        specified.
2016
2017Returns:
2018        BERR_SUCCESS - Main surface was set.
2019        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
2020 
2021See Also:
2022        BGRC_Destination_SetAlphaSurface,
2023****************************************************************************/
2024BERR_Code BGRC_Destination_SetSurface(
2025        BGRC_Handle hGrc,                  /* [in] Handle to GRC module. */
2026        BSUR_Surface_Handle hSurface       /* [in] Main surface handle. */
2027);
2028
2029/***************************************************************************
2030Summary:
2031        Sets the alpha surface for the destination
2032
2033Description:
2034        This is used in conjunction with the main surface specified with
2035        BGRC_Destination_SetSurface to describe the destination pixels.
2036
2037        Currently, this can only be used with a main surface having a pixel
2038        format of BPXL_eR5_G6_B5 and an alpha surface having a pixel format
2039        of BPXL_eA1 or BPXL_eW1.
2040
2041        This surface is not required. As a default, this surface is not
2042        specified.
2043
2044Returns:
2045        BERR_SUCCESS - Alpha surface was set.
2046        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
2047
2048See Also:
2049        BGRC_Destination_SetSurface,
2050****************************************************************************/
2051BERR_Code BGRC_Destination_SetAlphaSurface(
2052        BGRC_Handle hGrc,                     /* [in] Handle to GRC module. */
2053        BSUR_Surface_Handle hSurface          /* [in] Alpha surface handle. */
2054);
2055
2056/***************************************************************************
2057Summary:
2058        Enables or disables the palette index bypass.
2059
2060Description:
2061    Typically when a source contains a palette, the palette index
2062        is used to get color channel information from an actual palette.
2063        However, the user may decide to override this behavior and
2064        pass through the index as is. This function is used to
2065        enable and disable this state.
2066
2067        If this state is enabled, C2 and C1 will be set to zero and C0 will
2068        contain the index value.
2069
2070    The default is for the palette index to be used as a reference
2071        to a palette and not to use the palette index.
2072
2073Returns:
2074        BERR_SUCCESS - Palette bypass was set.
2075        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
2076        BERR_NOT_SUPPORTED - Not supported.
2077
2078See Also:
2079        BGRC_Destination_SetSurface
2080****************************************************************************/
2081BERR_Code BGRC_Destination_TogglePaletteBypass(
2082        BGRC_Handle hGrc,               /* [in] Handle to GRC module. */
2083        bool bEnableBypass              /* [in] If true, index will be used
2084                                                                           directly. If false, the palette will
2085                                                                           be referenced. */
2086);
2087
2088/***************************************************************************
2089Summary:
2090        Controls the chroma expansion for compressed YCrCb formats.
2091
2092Description:
2093    When a compressed YCrCb format is used as an input, say
2094        BPXL_eY08_Cb8_Y18_Cr8, the pixels must first be uncompressed
2095        before they are converted into the device's internal color format,
2096        BPXL_eA8_Y8_Cb8_Cr8. This function controls how the pixels
2097        are uncompressed.
2098
2099        As a default, eChromaExpansion will have a value of
2100        BGRC_ChromaExpansion_eReplicate.
2101
2102Returns:
2103        BERR_SUCCESS - Alpha surface was set.
2104        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
2105
2106See Also:
2107        BGRC_Destination_SetSurface,
2108****************************************************************************/
2109BERR_Code BGRC_Destination_SetChromaExpansion(
2110        BGRC_Handle hGrc,                      /* [in] Handle to GRC module. */
2111        BGRC_ChromaExpansion eChromaExpansion  /* [in] Chroma expansion type. */
2112);
2113
2114/***************************************************************************
2115Summary:
2116        Enables zero padding or bit replication.
2117
2118Description:
2119        When the destination feeder reads pixels, it the pixel components are
2120        less than 8 bits in size, it can either zero pad the low order bits, or
2121        replicate the high order bits into the low order bits.
2122
2123    The default is false (replication).
2124
2125Returns:
2126        BERR_SUCCESS - Palette bypass was set.
2127        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
2128
2129See Also:
2130        BGRC_Destination_SetSurface
2131****************************************************************************/
2132BERR_Code BGRC_Destination_SetZeroPad(
2133        BGRC_Handle hGrc,                /* [in] Handle to GRC module. */
2134        bool bEnableZeroPad              /* [in] If true, zero padding will be
2135                                                                            used. If false, bit replication
2136                                                                                will be used. */
2137);
2138
2139/***************************************************************************
2140Summary:
2141        Sets color key values for the destination.
2142
2143Description:
2144        When called, the destination color key state is set to use the given
2145        values. When color keying is enabled with
2146        BGRC_Destination_ToggleColorKey, the values are used as follows:
2147
2148        o Input color channels are masked with ulMask. The minimum (ulMin)
2149          and maximum (ulMax) range values are also masked.
2150        o If each of the components is less than or equal to the masked
2151          maximum and greater than or equal to the masked minimum, then the
2152          value is considered to be color keyed. Otherwise, it is not color
2153          keyed.
2154        o If the value is color keyed, Any bits of the result that have
2155          a corresponding bit set in ulReplacementMask are replaced with
2156          the bit value in ulReplacement.
2157
2158        When setting bExclusive to true, the above compares become less than
2159        instead of less equal, and greater than instead of greater equal.
2160
2161        When using ARGB, the color format of the parameters are
2162        BPXL_eA8_R8_G8_B8, and when using AYCbCr, the formats are
2163        BPXL_eA8_Y8_Cb8_Cr8.
2164
2165        When a pixel is or isn't chroma keyed it effects the final output
2166        selection specified with the function BGRC_Output_SetColorKeySelection.
2167
2168        The default is for all values to be set to zero, and bExclusive set to
2169        false.
2170
2171Returns:
2172        BERR_SUCCESS - Color key was enabled and set.
2173        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
2174 
2175See Also:
2176        BGRC_Destination_ToggleColorKey,
2177        BGRC_Destination_SetKeyMatrixOrder,
2178        BGRC_Output_SetColorKeySelection,
2179****************************************************************************/
2180BERR_Code BGRC_Destination_SetColorKey(
2181        BGRC_Handle hGrc,                     /* [in] Handle to GRC module. */
2182        uint32_t ulMin,                       /* [in] Minimum color key value. */
2183        uint32_t ulMax,                       /* [in] Maximum color key value. */
2184        uint32_t ulMask,                      /* [in] Color key mask. */
2185        uint32_t ulReplacement,               /* [in] Replacement value. */
2186        uint32_t ulReplacementMask,           /* [in] Replacement mask. */
2187        bool bExclusive                       /* [in] Inclusive/exclusive
2188                                                 compare. */
2189);
2190
2191/***************************************************************************
2192Summary:
2193        Toggles the state of color keying.
2194
2195Description:
2196        This function is used to enable and disable the state of color keying.
2197        When enabled, the values and process described in
2198        BGRC_Destination_SetColorKey will be used. When disabled, all pixels
2199        are marked as not being color keyed. This effects the final output
2200        selection, specified with the function
2201        BGRC_Output_SetColorKeySelection.
2202
2203        The default is for color keying to be disabled.
2204       
2205Returns:
2206        BERR_SUCCESS - Color key was set.
2207        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
2208 
2209See Also:
2210        BGRC_Destination_SetColorKey,
2211        BGRC_Destination_SetKeyMatrixOrder,
2212        BGRC_Output_SetColorKeySelection,
2213****************************************************************************/
2214BERR_Code BGRC_Destination_ToggleColorKey(
2215        BGRC_Handle hGrc,                /* [in] Handle to GRC module. */
2216        bool bEnable                     /* [in] If true, color keying is
2217                                                                                enabled. If false, color keying
2218                                                                                is disabled. */
2219);
2220
2221/***************************************************************************
2222Summary:
2223        Sets the 5x4 color matrix for the destination.
2224
2225Description:
2226        This matrix is used to modify the incoming destination values.
2227        Typically this is done to convert from one color space to another.
2228
2229        The values used for the color matrix are equal to the values stored
2230        in the ai32_Matrix array right shifted by the ulShift value. In
2231        addition, negative values are converted to positive values before
2232        shifting and then turned back into negative values. For
2233        example, if a value in the matrix was 4 and the shift value was 2, then
2234        the final value is 1 (4>>2 = 1). If a value in the matrix was 7
2235        and the shift value was 3, then the final value would be 0.875.
2236        If a value in the matrix was -7 and the shift value was 3 then the
2237        final values is -0.875.
2238
2239        The values within the color matrix are in the following order:
2240
2241              |  M[0]   M[1]   M[2]   M[3]   M[4] |
2242              |  M[5]   M[6]   M[7]   M[8]   M[9] |
2243              | M[10]  M[11]  M[12]  M[13]  M[14] |
2244              | M[15]  M[16]  M[17]  M[18]  M[19] |
2245
2246        This is multiplied with a column vector of
2247        < C2in, C1in, C0in, Ain, 1 > which yields the following equations:
2248
2249        C2out =  M[0]*C2in +  M[1]*C1in +  M[2]*C0in +  M[3]*Ain +  M[4]
2250        C1out =  M[5]*C2in +  M[6]*C1in +  M[7]*C0in +  M[8]*Ain +  M[9]
2251        C0out = M[10]*C2in + M[11]*C1in + M[12]*C0in + M[13]*Ain + M[14]
2252        Aout  = M[15]*C2in + M[16]*C1in + M[17]*C0in + M[18]*Ain + M[19]
2253
2254        The default is to for the matrix to represent the identity.
2255        M[0] = M[6] = M[12] = M[18] = 1. All other values are zero.
2256
2257Returns:
2258        BERR_SUCCESS - Color matrix was set.
2259        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
2260        BERR_NOT_SUPPORTED - Not supported.
2261
2262See Also:
2263        BGRC_Destination_ToggleColorMatrix,
2264        BGRC_Destination_SetColorMatrixRounding,
2265        BGRC_Destination_SetKeyMatrixOrder,
2266****************************************************************************/
2267BERR_Code BGRC_Destination_SetColorMatrix5x4(
2268        BGRC_Handle hGrc,                 /* [in] Handle to GRC module. */
2269        const int32_t ai32_Matrix[20],    /* [in] Array of unshifted matrix
2270                                             values. */
2271        uint32_t ulShift                  /* [in] Matrix shift value. */
2272);
2273
2274/***************************************************************************
2275Summary:
2276        Toggles the state of the color matrix.
2277
2278Description:
2279        This function is used to enable and disable the color matrix.
2280        When enabled, the values and process described in
2281        BGRC_Destination_SetColorMatrix5x4 will be used. When disabled,
2282        the matrix values have no effect.
2283
2284        The default is for the color matrix to be disabled.
2285       
2286Returns:
2287        BERR_SUCCESS - Color matrix was enabled and set.
2288        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
2289        BERR_NOT_SUPPORTED - Not supported.
2290
2291See Also:
2292        BGRC_Destination_SetColorMatrix5x4,
2293        BGRC_Destination_SetKeyMatrixOrder,
2294****************************************************************************/
2295BERR_Code BGRC_Destination_ToggleColorMatrix(
2296        BGRC_Handle hGrc,                /* [in] Handle to GRC module. */
2297        bool bEnable                     /* [in] If true, the color matrix is
2298                                                                                enabled. If false, the color matrix
2299                                                                                is disabled. */
2300);
2301
2302/***************************************************************************
2303Summary:
2304        Specifies how to round the output values from the destination color
2305        matrix.
2306
2307Description:
2308        The default rounding state is BGRC_Rounding_eNearest.
2309
2310        In our current hardware implementation, this setting cannot differ from
2311        the source color matrix rounding setting or output color matrix
2312        rounding setting. The user must insure that these settings are the
2313        same or an error will result.
2314
2315Returns:
2316        BERR_SUCCESS - Color matrix rounding was set.
2317        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
2318        BERR_NOT_SUPPORTED - Not supported.
2319 
2320See Also:
2321        BGRC_Destination_SetColorMatrix5x4,
2322        BGRC_Destination_ToggleColorMatrix,
2323        BGRC_Source_SetColorMatrixRounding,
2324        BGRC_Output_SetColorMatrixRounding
2325****************************************************************************/
2326BERR_Code BGRC_Destination_SetColorMatrixRounding(
2327        BGRC_Handle hGrc,                   /* [in] Handle to GRC module. */
2328        BGRC_Rounding eMatrixRounding       /* [in] Matrix rounding selection. */
2329);
2330
2331/***************************************************************************
2332Summary:
2333        Determines the order of the color key and matrix operation.
2334
2335Description:
2336        Gives the user the option of doing color keying first and color
2337        matrix operations second or the option of doing color matrix
2338        operations first and color keying second.
2339
2340        The default is to use an order of
2341        BGRC_KeyMatrixOrder_eKeyThenMatrix.
2342
2343Returns:
2344        BERR_SUCCESS - Color keying was enabled.
2345        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
2346        BERR_NOT_SUPPORTED - Not supported.
2347
2348See Also:
2349        BGRC_Destination_ToggleColorKey,
2350        BGRC_Destination_ToggleColorMatrix
2351****************************************************************************/
2352BERR_Code BGRC_Destination_SetKeyMatrixOrder(
2353        BGRC_Handle hGrc,                      /* [in] Handle to GRC module. */
2354        BGRC_KeyMatrixOrder eKeyMatrixOrder    /* [in] Color key/matrix order
2355                                                  selection. */
2356);
2357
2358/***************************************************************************
2359Summary:
2360        Sets the constant color for the destination.
2361
2362Description:
2363        This value is used when the destination surfaces are missing the alpha
2364        or color channels. When the color is ARGB, the color format is
2365        BPXL_eA8_R8_G8_B8, and when it is AYCbCr, the format is
2366        BPXL_eA8_Y8_Cb8_Cr8. When the surface format is less than a byte in
2367        size, the high-bits of the low-byte contains the constant color.
2368
2369        The default is 0xFF000000 (Alpha is 1, color channels are 0).
2370 
2371Returns:
2372        BERR_SUCCESS - Constant alpha and color was set.
2373        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
2374
2375See Also:
2376        BGRC_Destination_SetSurface,
2377        BGRC_Destination_SetAlphaSurface
2378****************************************************************************/
2379BERR_Code BGRC_Destination_SetColor(
2380        BGRC_Handle hGrc,                      /* [in] Handle to GRC module. */
2381        uint32_t ulColor                       /* [in] Constant values to use. */
2382);
2383
2384/***************************************************************************
2385Summary:
2386        Specifies the sub-rectangle of the destination surface.
2387
2388Description:
2389        Only the values within this rectangle will be used in the
2390        compositor calculations. The values given here must be restricted
2391        to the size of the surface itself.
2392
2393        The source will be scaled to the size of the output
2394        rectangle, specified by BGRC_Output_SetRectangle. Since our
2395        current hardware does not support scaling of the destination,
2396        the destination rectangle size must match the size of the
2397        output rectangle.
2398
2399        The default behavior is to use a rectangle the size of the entire
2400        specified destination.
2401
2402Returns:
2403        BERR_SUCCESS - Rectangle was set.
2404        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
2405
2406See Also:
2407        BGRC_Output_SetRectangle
2408****************************************************************************/
2409BERR_Code BGRC_Destination_SetRectangle(
2410        BGRC_Handle hGrc,                      /* [in] Handle to GRC module. */
2411        uint32_t ulLeft,                       /* [in] Rectangle left. */
2412        uint32_t ulTop,                        /* [in] Rectangle top. */
2413        uint32_t ulWidth,                      /* [in] Rectangle width. */
2414        uint32_t ulHeight                      /* [in] Rectangle height. */
2415);
2416
2417/***************************************************************************
2418Summary:
2419        Sets destination blit direction.
2420
2421Description:
2422        This function inverts the pixels of the surface in the specified
2423        direction(s), from right to left, and bottom to top.
2424
2425        Defaults are false, left to right, and top to bottom.
2426
2427Returns:
2428        BERR_SUCCESS - Direction was set.
2429        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
2430        BERR_NOT_SUPPORTED - Not supported.
2431****************************************************************************/
2432BERR_Code BGRC_Destination_SetDirection(
2433        BGRC_Handle hGrc,
2434        bool bRightToLeft,
2435        bool bBottomToTop
2436);
2437
2438/***************************************************************************
2439Summary:
2440        Resets the state of the destination.
2441
2442Description:
2443        All state set by destination functions is now set to be the default
2444        value.
2445
2446Returns:
2447        BERR_SUCCESS - Default state now set.
2448        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
2449 
2450See Also:
2451        BGRC_Destination_SetDefault
2452****************************************************************************/
2453BERR_Code BGRC_Destination_ResetState(
2454        BGRC_Handle hGrc                     /* [in] Handle to GRC module. */
2455);
2456
2457/***************************************************************************
2458Summary:
2459        Sets the default parameters for the destination.
2460
2461Description:
2462        Each destination function has a default state associated with it,
2463        described in each of the functions used to modify that state. However,
2464        the user may wish to modify the default state so that future calls to
2465        BGRC_Destination_ResetState will use user defined values.
2466       
2467        This function allows you to change the default state. First the user
2468        calls functions to set the needed destination state. It then calls
2469        this function which will then use the current state as the default.
2470        Subsequent calls to BGRC_Destination_ResetState will use the new
2471        values.
2472
2473Returns:
2474        BERR_SUCCESS - Default state now set.
2475        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
2476 
2477See Also:
2478        BGRC_Destination_ResetState
2479****************************************************************************/
2480BERR_Code BGRC_Destination_SetDefault(
2481        BGRC_Handle hGrc                     /* [in] Handle to GRC module. */
2482);
2483
2484/***************************************************************************
2485Summary:
2486        Sets the parameters for the pattern operation.
2487
2488Description:
2489        Mixes source, destination, and/or pattern using standard
2490        ROP3 operations.
2491
2492        The pattern will be oriented to the output top/left position.
2493
2494Returns:
2495        BERR_SUCCESS - Pattern was set.
2496        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
2497
2498See Also:
2499        BGRC_Output_SetColorKeySelection
2500****************************************************************************/
2501BERR_Code BGRC_Pattern_Set(
2502        BGRC_Handle hGrc,                      /* [in] Handle to GRC module. */
2503        uint8_t ucVector,                      /* [in] 8 bit ROP vector. */
2504        const uint8_t aucPattern[8],           /* [in] 8x8 bit ROP pattern. */
2505        uint32_t ulColor0,                     /* [in] ROP background color. */
2506        uint32_t ulColor1                      /* [in] ROP foreground color. */
2507);
2508
2509/***************************************************************************
2510Summary:
2511        Resets the state of the pattern block.
2512
2513Description:
2514        All state set by pattern functions is now set to be the default value.
2515
2516Returns:
2517        BERR_SUCCESS - Default state now set.
2518        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
2519 
2520See Also:
2521        BGRC_Pattern_SetDefault
2522****************************************************************************/
2523BERR_Code BGRC_Pattern_ResetState(
2524        BGRC_Handle hGrc                     /* [in] Handle to GRC module. */
2525);
2526
2527/***************************************************************************
2528Summary:
2529        Sets the default parameters for the pattern block.
2530
2531Description:
2532        Each pattern function has a default state associated with it, described
2533        in each of the functions used to modify that state. However, the user
2534        may wish to modify the default state so that future calls to
2535        BGRC_Pattern_ResetState will use user defined values.
2536       
2537        This function allows you to change the default state. First the user
2538        calls functions to set the needed source state. It then calls
2539        this function which will then use the current state as the default.
2540        Subsequent calls to BGRC_Pattern_ResetState will use the new
2541        values.
2542
2543Returns:
2544        BERR_SUCCESS - Default state now set.
2545        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
2546 
2547See Also:
2548        BGRC_Pattern_ResetState
2549****************************************************************************/
2550BERR_Code BGRC_Pattern_SetDefault(
2551        BGRC_Handle hGrc                     /* [in] Handle to GRC module. */
2552);
2553
2554/***************************************************************************
2555Summary:
2556        Sets the constant color for blending operations.
2557
2558Description:
2559        This value is used during the blend operations when blend source values
2560        are BGRC_Blend_Source_eConstantColor,
2561        BGRC_Blend_Source_eInverseConstantColor,
2562        BGRC_Blend_Source_eConstantAlpha, or
2563        BGRC_Blend_Source_eInverseConstantAlpha. When the color is ARGB, the
2564        color format is BPXL_eA8_R8_G8_B8, and when it is AYCbCr, the format
2565        is BPXL_eA8_Y8_Cb8_Cr8. When the surface format is less than a byte in
2566        size, the high-bits of the low-byte contains the constant color.
2567
2568        The default is 0xFF000000 (Alpha is 1, color channels are 0).
2569
2570Returns:
2571        BERR_SUCCESS - Constant color was set.
2572        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
2573
2574See Also:
2575        BGRC_Blend_SetColorBlend,
2576        BGRC_Blend_SetAlphaBlend
2577****************************************************************************/
2578BERR_Code BGRC_Blend_SetColor(
2579        BGRC_Handle hGrc,                      /* [in] Handle to GRC module. */
2580        uint32_t ulColor                       /* [in] Constant values to use. */
2581);
2582
2583/***************************************************************************
2584Summary:
2585        Sets the blending operations for the color components.
2586
2587Description:
2588        The basic function used for each color component is determined
2589        by the following function:
2590
2591        (A*B) +/- (C*D) +/- E
2592
2593        By picking and choosing the values for A, B, C, D, and E, you can
2594        achieve many different kinds of blending effects. In addition,
2595        you can make the +/- choice in the equation.
2596
2597        The default is for eSourceA to be BGRC_Blend_Source_eSourceColor,
2598        eSourceB to be BGRC_Blend_Source_eOne, bSubtractCD to be false,
2599        eSourceC to be BGRC_Blend_Source_eZero, eSourceD to be
2600        BGRC_Blend_Source_eZero, bSubtractE to be false, and eSourceE to be
2601        BGRC_Blend_Source_eZero. This results in a pass through of the color
2602        information.
2603
2604Returns:
2605        BERR_SUCCESS - Color blend operations were set.
2606        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
2607
2608See Also:
2609        BGRC_Blend_SetAlphaBlend
2610****************************************************************************/
2611BERR_Code BGRC_Blend_SetColorBlend(
2612        BGRC_Handle hGrc,                      /* [in] Handle to GRC module. */
2613        BGRC_Blend_Source eSourceA,            /* [in] Source for A. */
2614        BGRC_Blend_Source eSourceB,            /* [in] Source for B. */
2615        bool bSubtractCD,                      /* [in] Subtract C*D enable. */
2616        BGRC_Blend_Source eSourceC,            /* [in] Source for C. */
2617        BGRC_Blend_Source eSourceD,            /* [in] Source for D. */
2618        bool bSubtractE,                       /* [in] Subtract for E enable. */
2619        BGRC_Blend_Source eSourceE             /* [in] Source for E. */
2620);
2621
2622/***************************************************************************
2623Summary:
2624        Sets the blending operations for the alpha component.
2625
2626Description:
2627        The basic function used for the alpha component is determined
2628        by the following function:
2629
2630        (A*B) +/- (C*D) +/- E
2631
2632        By picking and choosing the values for A, B, C, D, and E, you can
2633        achieve many different kinds of blending effects. In addition,
2634        you can make the +/- choice in the equation.
2635
2636        The default is for eSourceA to be BGRC_Blend_Source_eSourceAlpha,
2637        eSourceB to be BGRC_Blend_Source_eOne, bSubtractCD to be false,
2638        eSourceC to be BGRC_Blend_Source_eZero, eSourceD to be
2639        BGRC_Blend_Source_eZero, bSubtractE to be false, and eSourceE to be
2640        BGRC_Blend_Source_eZero. This results in a pass through of the alpha
2641        component.
2642
2643    Note that the following sources cannot be used by the alpha blender:
2644        BGRC_Blend_Source_eSourceColor, BGRC_Blend_Source_eInverseSourceColor,
2645        BGRC_Blend_Source_eDestinationColor, or
2646        BGRC_Blend_Source_eInverseDestinationColor.
2647
2648Returns:
2649        BERR_SUCCESS - Alpha blend operations were set.
2650        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
2651
2652See Also:
2653        BGRC_Blend_SetColorBlend
2654****************************************************************************/
2655BERR_Code BGRC_Blend_SetAlphaBlend(
2656        BGRC_Handle hGrc,                      /* [in] Handle to GRC module. */
2657        BGRC_Blend_Source eSourceA,            /* [in] Source for A. */
2658        BGRC_Blend_Source eSourceB,            /* [in] Source for B. */
2659        bool bSubtractCD,                      /* [in] Subtract C*D enable. */
2660        BGRC_Blend_Source eSourceC,            /* [in] Source for C. */
2661        BGRC_Blend_Source eSourceD,            /* [in] Source for D. */
2662        bool bSubtractE,                       /* [in] Subtract for E enable. */
2663        BGRC_Blend_Source eSourceE             /* [in] Source for E. */
2664);
2665
2666/***************************************************************************
2667Summary:
2668        Resets the state of the blend block.
2669
2670Description:
2671        All state set by blend functions is now set to be the default value.
2672
2673Returns:
2674        BERR_SUCCESS - Default state now set.
2675        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
2676 
2677See Also:
2678        BGRC_Blend_SetDefault
2679****************************************************************************/
2680BERR_Code BGRC_Blend_ResetState(
2681        BGRC_Handle hGrc                     /* [in] Handle to GRC module. */
2682);
2683
2684/***************************************************************************
2685Summary:
2686        Sets the default parameters for the blend block.
2687
2688Description:
2689        Each blend function has a default state associated with it, described
2690        in each of the functions used to modify that state. However, the user
2691        may wish to modify the default state so that future calls to
2692        BGRC_Blend_ResetState will use user defined values.
2693       
2694        This function allows you to change the default state. First the user
2695        calls functions to set the needed blend state. It then calls
2696        this function which will then use the current state as the default.
2697        Subsequent calls to BGRC_Blend_ResetState will use the new
2698        values.
2699
2700Returns:
2701        BERR_SUCCESS - Default state now set.
2702        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
2703 
2704See Also:
2705        BGRC_Blend_ResetState
2706****************************************************************************/
2707BERR_Code BGRC_Blend_SetDefault(
2708        BGRC_Handle hGrc                     /* [in] Handle to GRC module. */
2709);
2710
2711/***************************************************************************
2712Summary:
2713        Sets the main surface for the output.
2714
2715Description:
2716        This is used in conjunction with the alpha surface specified
2717        with BGRC_Output_SetAlphaSurface to describe the location where the
2718        final pixels are stored.
2719
2720        This surface must be supplied. As a default, this surface is not
2721        specified.
2722
2723Returns:
2724        BERR_SUCCESS - Main surface was set.
2725        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
2726 
2727See Also:
2728        BGRC_Output_SetAlphaSurface,
2729****************************************************************************/
2730BERR_Code BGRC_Output_SetSurface(
2731        BGRC_Handle hGrc,                  /* [in] Handle to GRC module. */
2732        BSUR_Surface_Handle hSurface       /* [in] Main surface handle. */
2733);
2734
2735/***************************************************************************
2736Summary:
2737        Sets the alpha surface for the output.
2738
2739Description:
2740        This is used in conjunction with the main surface specified with
2741        BGRC_Output_SetSurface to describe the location where the
2742        final pixels are stored.
2743
2744        Currently, this can only be used with a main surface having a pixel
2745        format of BPXL_eR5_G6_B5 and an alpha surface having a pixel format
2746        of BPXL_eA1 or BPXL_eW1.
2747
2748        This surface is not required. As a default, this surface is not
2749        specified.
2750
2751Returns:
2752        BERR_SUCCESS - Alpha surface was set.
2753        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
2754
2755See Also:
2756        BGRC_Output_SetSurface
2757****************************************************************************/
2758BERR_Code BGRC_Output_SetAlphaSurface(
2759        BGRC_Handle hGrc,                     /* [in] Handle to GRC module. */
2760        BSUR_Surface_Handle hSurface          /* [in] Alpha surface handle. */
2761);
2762
2763/***************************************************************************
2764Summary:
2765        Sets the 5x4 color matrix for the output.
2766
2767Description:
2768        This matrix is used to modify the outgoing output values.
2769        Typically this is done to convert from one color space to another.
2770
2771        The values used for the color matrix are equal to the values stored
2772        in the ai32_Matrix array right shifted by the ulShift value. In
2773        addition, negative values are converted to positive values before
2774        shifting and then turned back into negative values. For
2775        example, if a value in the matrix was 4 and the shift value was 2, then
2776        the final value is 1 (4>>2 = 1). If a value in the matrix was 7
2777        and the shift value was 3, then the final value would be 0.875.
2778        If a value in the matrix was -7 and the shift value was 3 then the
2779        final values is -0.875.
2780
2781        The values within the color matrix are in the following order:
2782
2783              |  M[0]   M[1]   M[2]   M[3]   M[4] |
2784              |  M[5]   M[6]   M[7]   M[8]   M[9] |
2785              | M[10]  M[11]  M[12]  M[13]  M[14] |
2786              | M[15]  M[16]  M[17]  M[18]  M[19] |
2787
2788        This is multiplied with a column vector of
2789        < C2in, C1in, C0in, Ain, 1 > which yields the following equations:
2790
2791        C2out =  M[0]*C2in +  M[1]*C1in +  M[2]*C0in +  M[3]*Ain +  M[4]
2792        C1out =  M[5]*C2in +  M[6]*C1in +  M[7]*C0in +  M[8]*Ain +  M[9]
2793        C0out = M[10]*C2in + M[11]*C1in + M[12]*C0in + M[13]*Ain + M[14]
2794        Aout  = M[15]*C2in + M[16]*C1in + M[17]*C0in + M[18]*Ain + M[19]
2795
2796        The default is to for the matrix to represent the identity.
2797        M[0] = M[6] = M[12] = M[18] = 1. All other values are zero.
2798
2799Returns:
2800        BERR_SUCCESS - Color matrix was set.
2801        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
2802        BERR_NOT_SUPPORTED - Not supported.
2803
2804See Also:
2805        BGRC_Output_ToggleColorMatrix,
2806        BGRC_Output_SetColorMatrixRounding,
2807        BGRC_Output_SetKeyMatrixOrder,
2808****************************************************************************/
2809BERR_Code BGRC_Output_SetColorMatrix5x4(
2810        BGRC_Handle hGrc,                 /* [in] Handle to GRC module. */
2811        const int32_t ai32_Matrix[20],    /* [in] Array of unshifted matrix
2812                                             values. */
2813        uint32_t ulShift                  /* [in] Matrix shift value. */
2814);
2815
2816/***************************************************************************
2817Summary:
2818        Toggles the state of the color matrix.
2819
2820Description:
2821        This function is used to enable and disable the color matrix.
2822        When enabled, the values and process described in
2823        BGRC_Output_SetColorMatrix5x4 will be used. When disabled, the matrix
2824        values have no effect.
2825
2826        The default is for the color matrix to be disabled.
2827       
2828Returns:
2829        BERR_SUCCESS - Color matrix was enabled and set.
2830        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
2831        BERR_NOT_SUPPORTED - Not supported.
2832
2833See Also:
2834        BGRC_Output_SetColorMatrix5x4,
2835        BGRC_Output_SetKeyMatrixOrder,
2836****************************************************************************/
2837BERR_Code BGRC_Output_ToggleColorMatrix(
2838        BGRC_Handle hGrc,                /* [in] Handle to GRC module. */
2839        bool bEnable                     /* [in] If true, the color matrix is
2840                                                                                enabled. If false, the color matrix
2841                                                                                is disabled. */
2842);
2843
2844/***************************************************************************
2845Summary:
2846        Specifies how to round the output values from the output color matrix.
2847
2848Description:
2849        The default rounding state is BGRC_Rounding_eNearest.
2850
2851        In our current hardware implementation, this setting cannot differ from
2852        the source color matrix rounding setting or destination color matrix
2853        rounding setting. The user must insure that these settings are the
2854        same or an error will result.
2855
2856Returns:
2857        BERR_SUCCESS - Color matrix rounding was set.
2858        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
2859        BERR_NOT_SUPPORTED - Not supported.
2860 
2861See Also:
2862        BGRC_Output_SetColorMatrix5x4,
2863        BGRC_Output_ToggleColorMatrix,
2864        BGRC_Source_SetColorMatrixRounding,
2865        BGRC_Destination_SetColorMatrixRounding
2866****************************************************************************/
2867BERR_Code BGRC_Output_SetColorMatrixRounding(
2868        BGRC_Handle hGrc,                   /* [in] Handle to GRC module. */
2869        BGRC_Rounding eMatrixRounding       /* [in] Matrix rounding selection. */
2870);
2871
2872/***************************************************************************
2873Summary:
2874        Specifies the sub-rectangle of the output surface.
2875
2876Description:
2877        Only the values within this rectangle will be used to store the
2878        compositor calculations. The values given here must be restricted
2879        to the size of the surface itself.
2880
2881        The source rectangle, specified with BGRC_Source_SetRectangle will
2882        be scaled to the size of this output rectangle. Since the destination
2883        cannot be scaled, its rectangle specified with
2884        BGRC_Destination_SetRectangle must have the same with and height as
2885        the output rectangle.
2886
2887        The default behavior is to use a rectangle the size of the entire
2888        specified output.
2889
2890Returns:
2891        BERR_SUCCESS - Rectangle was set.
2892        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
2893
2894See Also:
2895        BGRC_Source_SetRectangle,
2896        BGRC_Destination_SetRectangle
2897****************************************************************************/
2898BERR_Code BGRC_Output_SetRectangle(
2899        BGRC_Handle hGrc,                      /* [in] Handle to GRC module. */
2900        uint32_t ulLeft,                       /* [in] Rectangle left. */
2901        uint32_t ulTop,                        /* [in] Rectangle top. */
2902        uint32_t ulWidth,                      /* [in] Rectangle width. */
2903        uint32_t ulHeight                      /* [in] Rectangle height. */
2904);
2905
2906/***************************************************************************
2907Summary:
2908        Determines the selection based on color key results to be customized.
2909
2910Description:
2911        This function determines the final output of the blender by checking
2912        whether a specific pixel was color keyed by source or destination
2913        and using the result specified in this table.
2914
2915        The following defaults are used:
2916
2917        eSrcNotKeyedDstNotKeyed - BGRC_Output_ColorKeySelection_eTakeSource
2918        eSrcNotKeyedDstKeyed - BGRC_Output_ColorKeySelection_eTakeSource
2919        eSrcKeyedDstNotKeyed - BGRC_Output_ColorKeySelection_eTakeDestination
2920        eSrcKeyedDstKeyed - BGRC_Output_ColorKeySelection_eTakeDestination
2921
2922Returns:
2923        BERR_SUCCESS - Selection based on color key was set.
2924        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
2925 
2926See Also:
2927        BGRC_Source_ToggleColorKey,
2928        BGRC_Destination_ToggleColorKey
2929****************************************************************************/
2930BERR_Code BGRC_Output_SetColorKeySelection(
2931        BGRC_Handle hGrc,         /* [in] Handle to GRC module. */             
2932        BGRC_Output_ColorKeySelection eSrcNotKeyedDstNotKeyed, /* [in]
2933                Selection when neither source or destination is color keyed. */
2934        BGRC_Output_ColorKeySelection eSrcNotKeyedDstKeyed,    /* [in]
2935                Selection when source isn't color keyed but the destination is. */
2936        BGRC_Output_ColorKeySelection eSrcKeyedDstNotKeyed,    /* [in]
2937                Selection when source is color keyed but the destination isn't. */
2938        BGRC_Output_ColorKeySelection eSrcKeyedDstKeyed        /* [in]
2939                Selection when both source and destination are color keyed. */
2940
2941);
2942
2943/***************************************************************************
2944Summary:
2945        Enables dithering.
2946
2947Description:
2948        Enables dithering of output pixels.
2949
2950        If dithering is enabled, a 2-dimensional dithering will be applied
2951        to adjust the channels in the output block based on the low 2 bits of
2952        the current X and Y position being written.
2953
2954        This is typically done to increase the perceived range of colors for
2955        a given resulting image.
2956
2957        The default state is false.
2958 
2959Returns:
2960        BERR_SUCCESS - Constant alpha and color was set.
2961        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
2962
2963See Also:
2964        BGRC_Output_SetSurface,
2965****************************************************************************/
2966BERR_Code BGRC_Output_SetDither(
2967        BGRC_Handle hGrc,                     /* [in] Handle to GRC module.*/
2968        bool bEnableDither                    /* [in] If true, dither will be used.
2969                                                 If false, dither will not be
2970                                                                                         used. */
2971);
2972
2973/***************************************************************************
2974Summary:
2975        Sets output blit direction.
2976
2977Description:
2978        This function inverts the pixels of the surface in the specified
2979        direction(s), from right to left, and bottom to top.
2980
2981        Defaults are false, left to right, and top to bottom.
2982
2983Returns:
2984        BERR_SUCCESS - Direction was set.
2985        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
2986        BERR_NOT_SUPPORTED - Not supported.
2987****************************************************************************/
2988BERR_Code BGRC_Output_SetDirection(
2989        BGRC_Handle hGrc,
2990        bool bRightToLeft,
2991        bool bBottomToTop
2992);
2993
2994/***************************************************************************
2995Summary:
2996        Resets the state of the output.
2997
2998Description:
2999        All state set by output functions is now set to be the default value.
3000
3001Returns:
3002        BERR_SUCCESS - Default state now set.
3003        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
3004 
3005See Also:
3006        BGRC_Output_SetDefault
3007****************************************************************************/
3008BERR_Code BGRC_Output_ResetState(
3009        BGRC_Handle hGrc                     /* [in] Handle to GRC module. */
3010);
3011
3012/***************************************************************************
3013Summary:
3014        Sets the default parameters for the output.
3015
3016Description:
3017        Each output function has a default state associated with it, described
3018        in each of the functions used to modify that state. However, the user
3019        may wish to modify the default state so that future calls to
3020        BGRC_Output_ResetState will use user defined values.
3021       
3022        This function allows you to change the default state. First the user
3023        calls functions to set the needed output state. It then calls
3024        this function which will then use the current state as the default.
3025        Subsequent calls to BGRC_Output_ResetState will use the new
3026        values.
3027
3028Returns:
3029        BERR_SUCCESS - Default state now set.
3030        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
3031 
3032See Also:
3033        BGRC_Output_ResetState
3034****************************************************************************/
3035BERR_Code BGRC_Output_SetDefault(
3036        BGRC_Handle hGrc                     /* [in] Handle to GRC module. */
3037);
3038
3039#ifdef __cplusplus
3040}
3041#endif
3042
3043#endif /* #ifndef BGRC_H__ */
3044
3045/* end of file */
Note: See TracBrowser for help on using the repository browser.