19ef7b6a37a323bc5fd7a12ad3e5b34af15cc44a5Arun Kumar K.R/* Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed *
329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Redistribution and use in source and binary forms, with or without
429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * modification, are permitted provided that the following conditions are
529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * met:
629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed *     * Redistributions of source code must retain the above copyright
729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed *       notice, this list of conditions and the following disclaimer.
829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed *     * Redistributions in binary form must reproduce the above
929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed *       copyright notice, this list of conditions and the following
1029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed *       disclaimer in the documentation and/or other materials provided
1129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed *       with the distribution.
129ef7b6a37a323bc5fd7a12ad3e5b34af15cc44a5Arun Kumar K.R *     * Neither the name of The Linux Foundation. nor the names of its
1329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed *       contributors may be used to endorse or promote products derived
1429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed *       from this software without specific prior written permission.
1529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed *
1629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
1729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
1829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
1929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
2029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
2329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
2429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
2529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
2629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed *
2829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed */
2929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#ifndef __c2d2_h_
3029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#define __c2d2_h_
3129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
3229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#ifdef __cplusplus
3329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedextern "C" {
3429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#endif
3529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
3629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#ifndef C2D_API
3729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#define C2D_API /* define API export as needed */
3829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#endif
3929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#if !defined(int32) && !defined(_INT32_DEFINED)
4029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtypedef int                     int32;
4129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#define _INT32_DEFINED
4229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#endif
4329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#if !defined(uint32) && !defined(_UINT32_DEFINED)
4429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtypedef unsigned int            uint32;
4529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#define _UINT32_DEFINED
4629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#endif
4729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
4829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/*****************************************************************************/
4929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/*********************** Blit definitions *****************************/
5029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/*****************************************************************************/
5129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
5229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* Status codes, returned by any blit function */
5329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtypedef enum {
5429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_STATUS_OK              = 0,
5529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_STATUS_NOT_SUPPORTED   = 1,
5629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_STATUS_OUT_OF_MEMORY   = 2,
5729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_STATUS_INVALID_PARAM   = 3,
5829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_STATUS_SURFACE_IN_USE  = 4,
5929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} C2D_STATUS;
6029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
6129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
6229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* Definitions of color format modes, used together with color formats */
6329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtypedef enum {
6429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_FORMAT_PACK_INTO_32BIT   = (1 <<  8), /* pack into dword if set */
6529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_FORMAT_SWAP_ENDIANNESS   = (1 <<  9), /* swaps the order */
6629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_FORMAT_LINEAR_SPACE      = (1 << 10), /* linear color space */
6729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_FORMAT_PREMULTIPLIED     = (1 << 11), /* alpha premultiplied */
6829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_FORMAT_INVERT_ALPHA      = (1 << 12), /* inverts alpha */
6929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_FORMAT_DISABLE_ALPHA     = (1 << 13), /* disables alpha */
7029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_FORMAT_INTERLACED        = (1 << 14), /* YUV line-interlaced */
7129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_FORMAT_TRANSPARENT       = (1 << 15), /* YUV 1-bit alpha in Y */
7229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_FORMAT_MACROTILED        = (1 << 16), /* tiled in macro level */
7329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_FORMAT_TILED_4x4         = (1 << 17), /* 4x4 tiled format */
7429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_FORMAT_SWAP_RB           = (1 << 18), /* Swap R & B color components */
7529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} C2D_FORMAT_MODE;
7629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
7729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* Definitions of supported RGB formats, used in C2D_RGB_SURFACE_DEF.
7829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * The bits of each color channel are packed into a machine word
7929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * representing a single pixel from left to right (MSB to LSB) in the
8029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * order indicated by format name. For the sub-byte formats the pixels
8129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * are packed into bytes from left to right (MSbit to LSBit).
8229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * If the C2D_FORMAT_PACK_INTO_32BIT bit is set, the minimal
8329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * machine word used for pixel storage is 32-bit and the whole word
8429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * is reversed if endianness is swapped.
8529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * If the C2D_FORMAT_SWAP_ENDIANNESS bit is set, the order within a
8629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * minimal machine word representing a pixel
8729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * is reversed for both sub-byte and multi-byte formats.
8829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * If the C2D_FORMAT_LINEAR_SPACE bit is set, the color space of
8929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * the formats below is considered linear, if applicable.
9029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * If the C2D_FORMAT_PREMULTIPLIED bit is set, the color channels
9129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * are premultiplied with the alpha, if applicable.
9229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * If the C2D_FORMAT_INVERT_ALPHA bit is set, the alpha interpretation
9329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * is inverted: 0 - opaque, 1 - transparent, if applicable.
9429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * If the C2D_FORMAT_DISABLE_ALPHA bit is set, the alpha channel serves
9529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * as a placeholder and is ignored during blit, if applicable.
9629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * If the C2D_FORMAT_MACROTILED bit is set, the surface is in the
9729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * tiled format : 64x32 for 8bpp, 32x32 for 16bpp formats  */
9829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtypedef enum {
9929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_1            = 0,   /* 1-bit alpha/color expansion */
10029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
10129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_2_PALETTE    = 1,   /* 2-bit indices for palette */
10229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_4_PALETTE    = 2,   /* 4-bit indices for palette */
10329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_8_PALETTE    = 3,   /* 8-bit indices for palette */
10429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
10529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_2_L          = 4,   /* 2-bit grayscale */
10629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_4_L          = 5,   /* 4-bit grayscale */
10729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_8_L          = 6,   /* 8-bit grayscale */
10829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
10929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_2_A          = 7,   /* 2-bit alpha only */
11029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_4_A          = 8,   /* 4-bit alpha only */
11129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_8_A          = 9,   /* 8-bit alpha only */
11229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
11329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_444_RGB      = 10,  /* 12-bit colors */
11429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_565_RGB      = 11,  /* 16-bit colors */
11529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_888_RGB      = 12,  /* 24-bit colors */
11629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
11729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_1555_ARGB    = 13,  /* 16-bit colors (1-bit alpha) */
11829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_4444_ARGB    = 14,  /* 16-bit colors (4-bit alpha) */
11929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_8565_ARGB    = 15,  /* 24-bit colors (8-bit alpha) */
12029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_8888_ARGB    = 16,  /* 32-bit colors (8-bit alpha) */
12129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
12229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_5551_RGBA    = 17,  /* 16-bit colors (1-bit alpha) */
12329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_4444_RGBA    = 18,  /* 16-bit colors (4-bit alpha) */
12429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_5658_RGBA    = 19,  /* 24-bit colors (8-bit alpha) */
12529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_8888_RGBA    = 20,  /* 32-bit colors (8-bit alpha) */
12629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
12729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    /* derived RGB color formats (base format + mode bits) */
12829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
12929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} C2D_RGB_FORMAT;
13029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
13129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* Definitions of supported YUV formats, used in C2D_YUV_SURFACE_DEF.
13229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Each of Y,U,V channels usually takes 1 byte and therefore is
13329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * individually addressable. The definitions below show how Y,U,V
13429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * channels are packed into macropixels for each particular format.
13529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * The order is from left (smaller byte addresses) to right (larger
13629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * byte addresses). The first three digits (4xx) denote the chroma
13729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * subsampling in standard YUV notation. The digits in the macropixel
13829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * denote that the whole block (from the previous digit or from the
13929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * beginning) has to be repeated the number of times. Underscores
14029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * between Y,U,V channels are used to describe separate planes for
14129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * planar YUV formats. Formats are mapped to numbers so that future
14229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * versions with various YUV permutations are easy to add.
14329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * If the C2D_FORMAT_INTERLACED bit is set, the line order is
14429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * interlaced: 0,2,4,...1,3,5... if applicable.
14529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * If the C2D_FORMAT_TRANSPARENT bit is set, the least significant
14629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * bit of Y channel serves as alpha: 0 - transparent, 1 - opaque. */
14729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtypedef enum {
14829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_411_YYUYYV   = 110, /* packed, 12-bit         */
14929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_411_YUYYVY   = 111, /* packed, 12-bit         */
15029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_411_UYYVYY   = 112, /* packed, 12-bit, "Y411" */
15129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_411_YUYV2Y4  = 116, /* packed, 12-bit         */
15229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_411_UYVY2Y4  = 117, /* packed, 12-bit, "Y41P" */
15329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
15429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_422_YUYV     = 120, /* packed, 16-bit, "YUY2" */
15529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_422_UYVY     = 121, /* packed, 16-bit, "UYVY" */
15629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_422_YVYU     = 122, /* packed, 16-bit, "YVYU" */
15729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_422_VYUY     = 123, /* packed, 16-bit         */
15829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
15929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_444_YUV      = 130, /* packed, 24-bit         */
16029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_444_UYV      = 131, /* packed, 24-bit, "IYU2" */
16129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_444_AYUV     = 136, /* packed, 24-bit, "AYUV" */
16229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
16329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_410_Y_UV     = 150, /* planar, Y + interleaved UV */
16429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_411_Y_UV     = 151, /* planar, Y + interleaved UV */
16529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_420_Y_UV     = 152, /* planar, Y + interleaved UV */
16629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_422_Y_UV     = 153, /* planar, Y + interleaved UV */
16729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_444_Y_UV     = 154, /* planar, Y + interleaved UV */
16829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
16929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_410_Y_VU     = 160, /* planar, Y + interleaved VU */
17029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_411_Y_VU     = 161, /* planar, Y + interleaved VU */
17129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_420_Y_VU     = 162, /* planar, Y + interleaved VU */
17229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_422_Y_VU     = 163, /* planar, Y + interleaved VU */
17329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_444_Y_VU     = 164, /* planar, Y + interleaved VU */
17429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
17529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_410_Y_U_V    = 170, /* planar, Y + U + V separate */
17629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_411_Y_U_V    = 171, /* planar, Y + U + V separate */
17729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_420_Y_V_U    = 172, /* planar, Y + V + U separate */
17829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_420_Y_U_V    = 173, /* planar, Y + U + V separate */
17929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_422_Y_U_V    = 174, /* planar, Y + U + V separate */
18029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_444_Y_U_V    = 175, /* planar, Y + U + V separate */
18129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
18229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_800_Y        = 190, /* planar, Y only, grayscale */
18329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
18429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    /* derived YUV color formats (base format + mode bits), FOURCC */
18529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
18629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_411_Y411     = 112,
18729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_411_Y41P     = 117,
18829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_411_IY41     = 117 | (1 << 14),
18929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_411_Y41T     = 117 | (1 << 15),
19029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
19129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_422_YUY2     = 120,
19229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_422_IUYV     = 121 | (1 << 14),
19329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_422_Y42T     = 121 | (1 << 15),
19429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_444_IYU2     = 131,
19529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
19629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_420_NV12     = 152,
19729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_420_NV21     = 162,
19829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
19929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_410_YUV9     = 170,
20029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_410_YVU9     = 170,
20129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_411_Y41B     = 171,
20229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_420_YV12     = 172,
20329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_420_IYUV     = 173,
20429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_420_I420     = 173,
20529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_422_YV16     = 174,
20629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_422_Y42B     = 174,
20729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
20829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_FORMAT_800_Y800     = 190,
20929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
21029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} C2D_YUV_FORMAT;
21129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
21229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
21329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* Configuration bits, used in the config_mask field of C2D_OBJECT struct */
21429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtypedef enum {
21529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_SOURCE_RECT_BIT      = (1 <<  0), /* enables source_rect field */
21629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_MIRROR_H_BIT         = (1 <<  1), /* enables horizontal flipping */
21729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_MIRROR_V_BIT         = (1 <<  2), /* enables vertical flipping */
21829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_SOURCE_TILE_BIT      = (1 <<  3), /* enables source surface tiling */
21929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_TARGET_RECT_BIT      = (1 <<  4), /* enables target_rect field */
22029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_ROTATE_BIT           = (1 <<  5), /* enables all rotation fields */
22129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_SCISSOR_RECT_BIT     = (1 <<  6), /* enables scissor_rect field */
22229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_MASK_SURFACE_BIT     = (1 <<  7), /* enables mask_surface_id field */
22329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_MASK_ALIGN_BIT       = (1 <<  8), /* aligns mask to source_rect */
22429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_MASK_SCALE_BIT       = (1 <<  9), /* enables mask surface scaling */
22529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_MASK_TILE_BIT        = (1 << 10), /* enables mask surface tiling */
22629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_GLOBAL_ALPHA_BIT     = (1 << 11), /* enables global_alpha field */
22729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_COLOR_KEY_BIT        = (1 << 12), /* enables color_key field */
22829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_NO_PIXEL_ALPHA_BIT   = (1 << 13), /* disables source alpha channel */
22929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_NO_BILINEAR_BIT      = (1 << 14), /* disables bilinear on scaling */
23029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_NO_ANTIALIASING_BIT  = (1 << 15), /* disables antialiasing on edges */
23129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_DRAW_LINE_BIT        = (1 << 16), /* enables line drawing with source rectangle */
23229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_DRAW_LINE_NOLAST     = (1 << 17), /* disable last pixel draw for line */
23329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} C2D_SOURCE_CONFIG;
23429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
2359ef7b6a37a323bc5fd7a12ad3e5b34af15cc44a5Arun Kumar K.R
23629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* Target configuration bits, defines rotation + mirroring.
23729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Mirror is applied prior to rotation if enabled. */
23829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtypedef enum {
23929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_TARGET_MIRROR_H        = (1 << 0), /* horizontal flip */
24029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_TARGET_MIRROR_V        = (1 << 1), /* vertical flip */
24129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_TARGET_ROTATE_0        = (0 << 2), /* no rotation */
24229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_TARGET_ROTATE_90       = (1 << 2), /* 90 degree rotation */
24329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_TARGET_ROTATE_180      = (2 << 2), /* 180 degree rotation */
24429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_TARGET_ROTATE_270      = (3 << 2), /* 270 degree rotation, 90 + 180 */
24529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_TARGET_MASK_ALIGN      = (1 << 4), /* aligns mask to target scissor */
24629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_TARGET_MASK_SCALE      = (1 << 5), /* enables mask scaling */
24729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_TARGET_MASK_TILE       = (1 << 6), /* enables mask tiling */
24829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_TARGET_COLOR_KEY       = (1 << 7), /* enables target_color_key */
24929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_TARGET_NO_PIXEL_ALPHA  = (1 << 8), /* disables target alpha channel */
25029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} C2D_TARGET_CONFIG;
25129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
25229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#define C2D_TARGET_ROTATION_MASK  (C2D_TARGET_ROTATE_90*3)
25329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
25429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* Additional blend modes, can be used with both source and target configs.
25529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed   If none of the below is set, the default "SRC over DST" is applied. */
25629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtypedef enum {
25729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_ALPHA_BLEND_SRC_OVER   = (0  << 20), /* Default, Porter-Duff "SRC over DST" */
25829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_ALPHA_BLEND_SRC        = (1  << 20), /* Porter-Duff "SRC" */
25929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_ALPHA_BLEND_SRC_IN     = (2  << 20), /* Porter-Duff "SRC in DST" */
26029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_ALPHA_BLEND_DST_IN     = (3  << 20), /* Porter-Duff "DST in SRC" */
26129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_ALPHA_BLEND_SRC_OUT    = (4  << 20), /* Porter-Duff "SRC out DST" */
26229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_ALPHA_BLEND_DST_OUT    = (5  << 20), /* Porter-Duff "DST out SRC" */
26329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_ALPHA_BLEND_DST_OVER   = (6  << 20), /* Porter-Duff "DST over SRC" */
26429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_ALPHA_BLEND_SRC_ATOP   = (7  << 20), /* Porter-Duff "SRC ATOP" */
26529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_ALPHA_BLEND_DST_ATOP   = (8  << 20), /* Porter-Duff "DST ATOP" */
26629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_ALPHA_BLEND_XOR        = (9  << 20), /* Xor */
26729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_ALPHA_BLEND_MULTIPLY   = (10 << 20), /* OpenVG "MULTIPLY" */
26829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_ALPHA_BLEND_SCREEN     = (11 << 20), /* OpenVG "SCREEN" */
26929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_ALPHA_BLEND_DARKEN     = (12 << 20), /* OpenVG "DARKEN" */
27029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_ALPHA_BLEND_LIGHTEN    = (13 << 20), /* OpenVG "LIGHTEN" */
27129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_ALPHA_BLEND_ADDITIVE   = (14 << 20), /* OpenVG "ADDITIVE" */
27229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_ALPHA_BLEND_DIRECT     = (15 << 20), /* Direct alpha blitting */
27329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_ALPHA_BLEND_INVERTC    = (16 << 20), /* Invert color */
27429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_ALPHA_BLEND_NONE       = (1  << 25), /* disables alpha blending */
27529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} C2D_ALPHA_BLEND_MODE;
27629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
2779ef7b6a37a323bc5fd7a12ad3e5b34af15cc44a5Arun Kumar K.R/* Configuration bits, used in the config_mask field of C2D_OBJECT struct */
2789ef7b6a37a323bc5fd7a12ad3e5b34af15cc44a5Arun Kumar K.Rtypedef enum {
2799ef7b6a37a323bc5fd7a12ad3e5b34af15cc44a5Arun Kumar K.R    C2D_OVERRIDE_GLOBAL_TARGET_ROTATE_CONFIG = (1 << 27), /* Overrides TARGET Config */
2809ef7b6a37a323bc5fd7a12ad3e5b34af15cc44a5Arun Kumar K.R    C2D_OVERRIDE_TARGET_ROTATE_0             = (0 << 28), /* no rotation             */
2819ef7b6a37a323bc5fd7a12ad3e5b34af15cc44a5Arun Kumar K.R    C2D_OVERRIDE_TARGET_ROTATE_90            = (1 << 28), /* 90 degree rotation      */
2829ef7b6a37a323bc5fd7a12ad3e5b34af15cc44a5Arun Kumar K.R    C2D_OVERRIDE_TARGET_ROTATE_180           = (2 << 28), /* 180 degree rotation     */
2839ef7b6a37a323bc5fd7a12ad3e5b34af15cc44a5Arun Kumar K.R    C2D_OVERRIDE_TARGET_ROTATE_270           = (3 << 28), /* 270 degree rotation     */
2849ef7b6a37a323bc5fd7a12ad3e5b34af15cc44a5Arun Kumar K.R} C2D_SOURCE_TARGET_CONFIG;
2859ef7b6a37a323bc5fd7a12ad3e5b34af15cc44a5Arun Kumar K.R
2869ef7b6a37a323bc5fd7a12ad3e5b34af15cc44a5Arun Kumar K.R#define C2D_OVERRIDE_SOURCE_CONFIG_TARGET_ROTATION_SHIFT_MASK  28
2879ef7b6a37a323bc5fd7a12ad3e5b34af15cc44a5Arun Kumar K.R#define C2D_OVERRIDE_TARGET_CONFIG_TARGET_ROTATION_SHIFT_MASK  2
2889ef7b6a37a323bc5fd7a12ad3e5b34af15cc44a5Arun Kumar K.R
28929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
29029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* Surface caps enumeration */
29129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtypedef enum {
29229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_SOURCE          = (1 << 0), /* allows to use as a source */
29329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_TARGET          = (1 << 1), /* allows to use as a target */
29429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_MASK            = (1 << 2), /* allows to use as a mask */
29529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_PALETTE         = (1 << 3), /* allows to use as a palette */
29629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} C2D_SURFACE_BITS;
29729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
29829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* Surface type enumeration */
29929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtypedef enum {
30029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_SURFACE_RGB_HOST        = 1, /* Host memory RGB surface */
30129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_SURFACE_RGB_EXT         = 2, /* External memory RGB surface */
30229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_SURFACE_YUV_HOST        = 3, /* Host memory YUV surface */
30329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_SURFACE_YUV_EXT         = 4, /* External memory YUV surface */
30429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_SURFACE_WITH_PHYS       = (1<<3), /* physical address already mapped */
30529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed                                        /* this bit is valid with HOST types */
30629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_SURFACE_WITH_PHYS_DUMMY = (1<<4), /* physical address already mapped */
30729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed                                        /* this bit is valid with HOST types */
30829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} C2D_SURFACE_TYPE;
30929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
31029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* Structure for registering a RGB buffer as a blit surface */
31129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtypedef struct {
31229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    uint32 format;   /* RGB color format plus additional mode bits */
31329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    uint32 width;    /* defines width in pixels */
31429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    uint32 height;   /* defines height in pixels */
31529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    void  *buffer;   /* pointer to the RGB buffer */
31629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    void  *phys;     /* physical address */
31729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    int32  stride;   /* defines stride in bytes, negative stride is allowed */
31829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} C2D_RGB_SURFACE_DEF;
31929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
32029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* Structure for registering a YUV plane(s) as a blit surface */
32129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtypedef struct {
32229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    uint32 format;   /* YUV color format plus additional mode bits */
32329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    uint32 width;    /* defines width in pixels */
32429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    uint32 height;   /* defines height in pixels */
32529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    void  *plane0;  /* holds the whole buffer if YUV format is not planar */
32629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    void  *phys0;   /* physical address */
32729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    int32  stride0; /* stride in bytes if YUV format is not planar */
32829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    void  *plane1;  /* holds UV or VU plane for planar interleaved */
32929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    void  *phys1;   /* physical address */
33029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    int32  stride1; /* stride for UV or VU plane for planar interleaved */
33129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    void  *plane2;  /* holds the 3. plane, ignored if YUV format is not planar */
33229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    void  *phys2;    /* physical address */
33329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    int32  stride2; /* stride for the 3. plane, ignored if YUV format is not planar */
33429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} C2D_YUV_SURFACE_DEF;
33529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
33629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
33729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* Rectangle definition */
33829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtypedef struct {
33929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    int32 x;        /* upper-left x */
34029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    int32 y;        /* upper-left y */
34129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    int32 width;    /* width */
34229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    int32 height;   /* height */
34329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} C2D_RECT;
34429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
34529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* C2D_OBJECT encapsulates the blit parameters for a source surface.
34629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * The fg_color defines color in target format for bits equal to 1
34729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * in the source C2D_COLOR_FORMAT_1 format. It also defines rendering
34829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * color for all alpha-only source formats. If the surface_id is 0
34929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * the fg_color defines a constant fill color used instead of the surface.
35029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * The bg_color defines color in target format for bits equal to 0
35129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * in the source C2D_COLOR_FORMAT_1 format, otherwise both are ignored.
35229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * The palette_id is used for all palette source formats, otherwise ignored.
35329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
35429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * The source_rect first defines the content of the source surface,
35529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * it is then horizontally/vertically flipped if C2D_MIRROR_*_BIT is set,
35629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * then scaled with bilinear interpolation to exactly fit target_rect
35729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * or repeated across target_rect if C2D_SOURCE_TILE_BIT is set,
35829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * target_rect is then rotated clockwise by an arbitrary angle in degrees
35929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * around the rot_orig_x/y, defined relative to target_rect's top left point,
36029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * and then clipped to scissor_rect defined in target coordinate system.
36129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
36229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Finally alpha blending is applied before pixels get written into the target.
36329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Surface's pixel alpha is combined with mask alpha and with global alpha.
36429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Mask surface follows all transformations applied to the source surface.
36529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Source color key defines transparent color, applied together with alpha. */
36629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtypedef struct C2D_OBJECT_STR {
36729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    uint32 surface_id;      /* source surface */
36829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
36929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    uint32 fg_color;        /* foreground color */
37029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    uint32 bg_color;        /* background color */
37129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    uint32 palette_id;      /* one-dimensional horizontal palette surface */
37229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
37329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    uint32 config_mask;     /* defines which fields below are enabled */
37429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
37529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_RECT source_rect;  /* region of the source surface,   16.16 fp */
37629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_RECT target_rect;  /* position and scaling in target, 16.16 fp */
37729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
37829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    int32 rot_orig_x;       /* rotation origin relative to target_rect's... */
37929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    int32 rot_orig_y;       /* ...top left point,     both are 16.16 fp */
38029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    int32 rotation;         /* clock-wise rotation in degrees, 16.16 fp */
38129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
38229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_RECT scissor_rect; /* defines the clip rectangle in target surface */
38329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
38429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    uint32 mask_surface_id; /* source alpha-mask surface */
38529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    uint32 global_alpha;    /* 0 = fully transparent, 255 = fully opaque */
38629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    uint32 color_key;       /* transparent color for the source surface */
38729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
38829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    struct C2D_OBJECT_STR *next; /* pointer to the next object or NULL */
38929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} C2D_OBJECT;
39029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
391647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R/* Configuration bits, driver capabilities used by 2Dapplications */
392647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.Rtypedef enum {
393647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R    C2D_DRIVER_SUPPORTS_GLOBAL_ALPHA_OP           = (1 << 0),
394647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R    C2D_DRIVER_SUPPORTS_TILE_OP                   = (1 << 1),
395647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R    C2D_DRIVER_SUPPORTS_COLOR_KEY_OP              = (1 << 2),
396647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R    C2D_DRIVER_SUPPORTS_NO_PIXEL_ALPHA_OP         = (1 << 3),
397647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R    C2D_DRIVER_SUPPORTS_TARGET_ROTATE_OP          = (1 << 4),
398647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R    C2D_DRIVER_SUPPORTS_ANTI_ALIASING_OP          = (1 << 5), /* antialiasing */
399647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R    C2D_DRIVER_SUPPORTS_BILINEAR_FILTER_OP        = (1 << 6),
400647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R    C2D_DRIVER_SUPPORTS_LENS_CORRECTION_OP        = (1 << 7),
401647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R    C2D_DRIVER_SUPPORTS_OVERRIDE_TARGET_ROTATE_OP = (1 << 8),
402647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R    C2D_DRIVER_SUPPORTS_SHADER_BLOB_OP            = (1 << 9),
403647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R    C2D_DRIVER_SUPPORTS_MASK_SURFACE_OP           = (1 << 10), /* mask surface */
404647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R    C2D_DRIVER_SUPPORTS_MIRROR_H_OP               = (1 << 11), /* horizontal flip */
405647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R    C2D_DRIVER_SUPPORTS_MIRROR_V_OP               = (1 << 12), /* vertical flip */
406647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R    C2D_DRIVER_SUPPORTS_SCISSOR_RECT_OP           = (1 << 13),
407647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R    C2D_DRIVER_SUPPORTS_SOURCE_RECT_OP            = (1 << 14),
408647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R    C2D_DRIVER_SUPPORTS_TARGET_RECT_OP            = (1 << 15),
409647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R    C2D_DRIVER_SUPPORTS_ROTATE_OP                 = (1 << 16), /* all rotations */
410647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R    C2D_DRIVER_SUPPORTS_FLUSH_WITH_FENCE_FD_OP    = (1 << 17), /* all rotations */
411647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R    C2D_DRIVER_SUPPORTS_ALL_CAPABILITIES_OP       = ((0xFFFFFFFF) >> (31 - 17)) /* mask for all capabilities supported */
412647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R} C2D_DRIVER_CAPABILITIES;
413647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R
414647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R/* 2D driver workaround bits used by the 2D applications */
415647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.Rtypedef enum {
416647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R    C2D_DRIVER_WORKAROUND_NONE  = 0, /* NO workaround */
417647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R    C2D_DRIVER_WORKAROUND_SWAP_UV_FOR_YUV_TARGET  = (1 << 0), /* Swap UV when this flag set */
418647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R} C2D_DRIVER_WORKAROUND;
419647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R
420647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R/* Structure to query Driver information */
421647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.Rtypedef struct {
422647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R    uint32 capabilities_mask;
423647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R    uint32 workaround_mask;
424647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R    uint32 reserved1;
425647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R    uint32 reserved2;
426647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R    uint32 reserved3;
427647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R} C2D_DRIVER_INFO;
428647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R
429647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R/* Structure to query Driver information */
430647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.Rtypedef struct {
431647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R    uint32          max_surface_template_needed;
432647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R    uint32          reserved1;
433647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R    uint32          reserved2;
434647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R    uint32          reserved3;
435647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R} C2D_DRIVER_SETUP_INFO;
43629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
43729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/*****************************************************************************/
43829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/**************************** C2D API 2.0 ********************************/
43929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/*****************************************************************************/
44029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
44129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/******************************************************************************
44229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Functions to create/destroy surfaces */
44329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
44429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* Creates a generic blit surface according to its type.
44529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Pass a combination of desired surface bits according to planned usage.
44629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Accepted values for surface_bits may include bits from C2D_SURFACE_BITS,
44729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * and also from C2D_DISPLAY for compatibility with HW display controller.
44829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * For host memory types the memory is preallocated outside the API
44929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * and should remain valid until surface is destroyed.
45029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * For external memory types the memory is allocated within API.
45129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * On success, the non-zero surface identifier is returned.
45229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * All numbers greater that 0 are valid surface identifiers, 0 is invalid.
45329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
45429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Host memory RGB surface:
45529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * surface_type       = C2D_SURFACE_RGB_HOST
45629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * surface_definition = C2D_RGB_SURFACE_DEF
45729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * all fields in definition structure should be set
45829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
45929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * External memory RGB surface:
46029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * surface_type       = C2D_SURFACE_RGB_EXT
46129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * surface_definition = C2D_RGB_SURFACE_DEF
46229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * buffer field in definition structure is ignored
46329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
46429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Host memory YUV surface:
46529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * surface_type       = C2D_SURFACE_YUV_HOST
46629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * surface_definition = C2D_YUV_SURFACE_DEF
46729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * one or all plane and stride fields in definition structure
46829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * should be set depending on whether the format is planar or not
46929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
47029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * External memory YUV surface:
47129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * surface_type       = C2D_SURFACE_YUV_EXT
47229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * surface_definition = C2D_YUV_SURFACE_DEF
47329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * all plane and stride fields in definition structure are ignored */
47429a26818d7294055539167b2fbfdaa168bcf725cNaseer AhmedC2D_API C2D_STATUS c2dCreateSurface( uint32 *surface_id,
47529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed                         uint32 surface_bits,
47629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed                         C2D_SURFACE_TYPE surface_type,
47729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed                         void *surface_definition );
47829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
47929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* Requests properties of the specified surface. */
48029a26818d7294055539167b2fbfdaa168bcf725cNaseer AhmedC2D_API C2D_STATUS c2dQuerySurface( uint32 surface_id,
48129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed                         uint32 *surface_bits,
48229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed                         C2D_SURFACE_TYPE *surface_type,
48329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed                         uint32 *width, uint32 *height,
48429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed                         uint32 *format );
48529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
48629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* Destroys a generic blit surface.
48729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * For external memory surfaces also deallocates the memory.
48829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * It is safe to free any external resources associated with a given
48929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * surface on c2dCreateSurface call after this function returns. */
49029a26818d7294055539167b2fbfdaa168bcf725cNaseer AhmedC2D_API C2D_STATUS c2dDestroySurface( uint32 surface_id );
49129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
49229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
49329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/******************************************************************************
49429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Functions to modify/exchange surface data */
49529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
49629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* The format of fill_color is the same as color format being used
49729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * for specified surface. If fill_rect is NULL the whole surface is filled.
49829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Alpha-blending is not performed while filling.
49929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * The operation is complete when function returns. */
50029a26818d7294055539167b2fbfdaa168bcf725cNaseer AhmedC2D_API C2D_STATUS c2dFillSurface( uint32 surface_id,
50129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed                         uint32 fill_color,
50229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed                         C2D_RECT *fill_rect );
50329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
50429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* Writes data located in host memory into the specified surface.
50529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * The chunk of host memory is identified with surface_type and
50629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * surface_definition, no surface registration needed in this case.
50729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Only C2D_SURFACE_RGB_HOST, C2D_SURFACE_YUV_HOST are accepted.
50829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * If only part of the host memory buffer should be loaded, it should
50929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * be configured in surface_definition using width, height and stride.
51029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * The x and y are defined in target surface coordinate space.
51129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Color conversion has to be done, if color formats differ.
51229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Alpha-blending is not performed while writing.
51329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * The operation is complete when function returns. */
51429a26818d7294055539167b2fbfdaa168bcf725cNaseer AhmedC2D_API C2D_STATUS c2dWriteSurface( uint32 surface_id,
51529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed                         C2D_SURFACE_TYPE surface_type,
51629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed                         void *surface_definition,
51729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed                         int32 x, int32 y );
51829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
51929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* Reads data from the specified surface into the host memory.
52029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * The chunk of host memory is identified with surface_type and
52129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * surface_definition, no surface registration needed in this case.
52229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Only C2D_SURFACE_RGB_HOST, C2D_SURFACE_YUV_HOST are accepted.
52329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * If only part of the surface should be read, it should
52429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * be configured in surface_definition using width, height and stride.
52529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * The x and y are defined in source surface coordinate space.
52629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Color conversion has to be done, if color formats differ.
52729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Alpha-blending is not performed while reading.
52829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * The operation is complete when function returns. */
52929a26818d7294055539167b2fbfdaa168bcf725cNaseer AhmedC2D_API C2D_STATUS c2dReadSurface( uint32 surface_id,
53029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed                         C2D_SURFACE_TYPE surface_type,
53129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed                         void *surface_definition,
53229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed                         int32 x, int32 y );
53329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
53429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* Notifies c2d imlementation that surface has been updated from outside the API,
53529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * if updated_rect is NULL then the whole surface has been updated. */
53629a26818d7294055539167b2fbfdaa168bcf725cNaseer AhmedC2D_API C2D_STATUS c2dSurfaceUpdated( uint32 surface_id,
53729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed                         C2D_RECT *updated_rect );
53829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
53929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* Updates surface information.
54029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Could be called only for host surfaces set with parameter "C2D_SURFACE_WITH_PHYS".
54129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Count for surface planes have to be same than for already allocated surface */
54229a26818d7294055539167b2fbfdaa168bcf725cNaseer AhmedC2D_API C2D_STATUS c2dUpdateSurface( uint32 surface_id,
54329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed                         uint32 surface_bits,
54429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed                         C2D_SURFACE_TYPE surface_type,
54529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed                         void *surface_definition );
54629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
54729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/******************************************************************************
54829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Functions to do actual blit */
54929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
55029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* Draw a list of blit objects into the given target.
55129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * The target_config is a bitwise OR of values from C2D_TARGET_CONFIG.
55229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * The target transformation creates the effect that target surface
55329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * is transformed before the blit and then transformed back
55429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * after blit, however no physical target transform is performed.
55529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * The objects_list is a linked list of blit objects, no more
55629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * than num_objects is drawn from the given list.
55729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * If num_objects is 0, the whole list is drawn.
55829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * The blit is not guaranteed to complete after function returns. */
55929a26818d7294055539167b2fbfdaa168bcf725cNaseer AhmedC2D_API C2D_STATUS c2dDraw( uint32 target_id,
56029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed                         uint32 target_config, C2D_RECT *target_scissor,
56129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed                         uint32 target_mask_id, uint32 target_color_key,
56229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed                         C2D_OBJECT *objects_list, uint32 num_objects );
56329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
56429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
56529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* timstamp set in the blit commands flush */
56629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtypedef void*                   c2d_ts_handle;
56729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
56829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* Forces any pending blit to complete for a given target.
56929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Non-blocking. All input surfaces for this target except those
57029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * which are shared with other targets are expected to be immediately
57129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * writable after client has been waiting returned timestamp with
57229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * c2dWaitTimestamp funtion or c2dFinish has been called for same target */
57329a26818d7294055539167b2fbfdaa168bcf725cNaseer AhmedC2D_API C2D_STATUS c2dFlush( uint32 target_id, c2d_ts_handle *timestamp);
57429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
57529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
57629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* Waits the pending timestamp */
57729a26818d7294055539167b2fbfdaa168bcf725cNaseer AhmedC2D_API C2D_STATUS c2dWaitTimestamp( c2d_ts_handle timestamp );
57829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
57929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
58029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* Forces any pending blit to complete for a given target.
58129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Blocking version, returns when blit is done.
58229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * All input surfaces for this target except those which are shared with
58329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * other targets are expected to be immediately
58429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * writable after this function returns. */
58529a26818d7294055539167b2fbfdaa168bcf725cNaseer AhmedC2D_API C2D_STATUS c2dFinish( uint32 target_id );
58629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
58729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
58829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/*****************************************************************************/
58929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/****************************** Display API **********************************/
59029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/*****************************************************************************/
59129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
59229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
59329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* Display input enumeration */
59429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtypedef enum {
59529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_DISPLAY_INPUT_0      = 0,       /*!< default input */
59629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_DISPLAY_INPUT_1      = (1<<16), /*!< Overlay 1     */
59729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_DISPLAY_INPUT_2      = (1<<17), /*!< Overlay 2...    */
59829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} C2D_DISPLAY_INPUT;
59929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
60029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
60129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/******************************************************************************
60229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Functions for display output. */
60329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
60429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* Functionality described in this section is optional and is
60529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * provided only for the cases when blit HW
60629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * is tightly bound to the display controller. */
60729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
60829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* Display enumeration, may also be used in surface caps */
60929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtypedef enum {
61029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_DISPLAY_MAIN         = (1 << 10), /* main display */
61129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_DISPLAY_SECONDARY    = (1 << 11), /* secondary display */
61229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_DISPLAY_TV_OUT       = (1 << 12), /* tv-out */
61329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} C2D_DISPLAY;
61429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
61529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* Display window enumeration */
61629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtypedef enum {
61729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_DISPLAY_OVERLAY      = C2D_DISPLAY_INPUT_1, /*!< Overlay window bit. This defines display input.
61829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed                                                When defined the surface is set on the overlay window
61929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed                                                otherwise the surface is set on the background window. */
62029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} C2D_DISPLAY_WINDOW;                    /*!< Window bit set with display parameter */
62129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
62229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
62329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* Display update modes */
62429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtypedef enum {
62529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_DISPLAY_MODE_TEAR_SYNC   = (1 << 0), /* enables tearing sync */
62629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    C2D_DISPLAY_MODE_SURF_REMOVE = (1 << 1), /* Remove surface from given display + input */
62729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} C2D_DISPLAY_MODE;
62829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
62929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
63029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* Sets the given surface as a current display front buffer.
63129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Several displays can be specified as an output if supported.
63229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Still only one input can be specified at a time fro display/displays.
63329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * The surface remains shown until it gets replaced with another one. */
63429a26818d7294055539167b2fbfdaa168bcf725cNaseer AhmedC2D_API C2D_STATUS c2dDisplaySetSurface( uint32 display,
63529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed                         uint32 surface_id, uint32 mode );
63629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
63729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* Returns the current surface for a particular display.
63829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Only one display can be specified at a time.
63929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * The latest surface set with compDisplaySetSurface or
64029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * the default pre-allocated surface is returned. */
64129a26818d7294055539167b2fbfdaa168bcf725cNaseer AhmedC2D_API C2D_STATUS c2dDisplayGetSurface( uint32 display,
64229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed                         uint32 *surface_id );
64329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
64429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* Returns the properties for a particular display.
64529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Only one display can be specified at a time. */
64629a26818d7294055539167b2fbfdaa168bcf725cNaseer AhmedC2D_API C2D_STATUS c2dDisplayGetProperties( uint32 display,
64729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed                         uint32 *width, uint32 *height,
64829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed                         uint32 *format );
64929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
65029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* Sets the properties for a particular display input.
65129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Only one display + input can be specified at a time.
65229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * C2D_OBJECT used to set input rect(target rect),
65329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * blending operations, rotation...etc for display source */
65429a26818d7294055539167b2fbfdaa168bcf725cNaseer AhmedC2D_API C2D_STATUS c2dDisplaySetObject( uint32 display,
65529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed                         uint32 target_config, uint32 target_color_key,
65629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed                         C2D_OBJECT * c2dObject, uint32 mode);
65729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
65829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* allows user to map a memory region to the gpu. only supported on linux
65929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * mem_fd is the fd of the memory region, hostptr is the host pointer to the region,
66029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * len and offset are the size and offset of the memory.
66129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * flags is one of the memory types supported by gsl
66229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * gpaddr is passed by refernce back to the user
66329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed */
66429a26818d7294055539167b2fbfdaa168bcf725cNaseer AhmedC2D_API C2D_STATUS c2dMapAddr ( int mem_fd, void * hostptr, uint32 len, uint32 offset, uint32 flags, void ** gpuaddr);
66529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
66629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* allows user to unmap memory region mapped by c2dMapAddr.
66729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * gpaddr is the gpuaddr to unmap */
66829a26818d7294055539167b2fbfdaa168bcf725cNaseer AhmedC2D_API C2D_STATUS c2dUnMapAddr (void * gpuaddr);
66929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
6709ef7b6a37a323bc5fd7a12ad3e5b34af15cc44a5Arun Kumar K.R/* allows user to query driver capabilities.
6719ef7b6a37a323bc5fd7a12ad3e5b34af15cc44a5Arun Kumar K.R * driver_info is the information about driver */
6729ef7b6a37a323bc5fd7a12ad3e5b34af15cc44a5Arun Kumar K.RC2D_API C2D_STATUS c2dGetDriverCapabilities( C2D_DRIVER_INFO * driver_info);
6739ef7b6a37a323bc5fd7a12ad3e5b34af15cc44a5Arun Kumar K.R
674647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R/* create a fence fd for the timestamp */
675647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.RC2D_API C2D_STATUS c2dCreateFenceFD( uint32 target_id, c2d_ts_handle timestamp, int32 *fd);
676647c0289e836c3989fd9be435d5ee38639aa4e07Arun Kumar K.R
67729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/*****************************************************************************/
67829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
67929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#ifdef __cplusplus
68029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed}
68129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#endif
68229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
68329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#endif /* __c2d2_h_ */
684