c2d2.h revision 07bbf1e89c031a5d41a7561433e832d396c311a5
107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Copyright (c) 2010-2013, The Linux Foundation. All rights reserved. 207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * 307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * Redistribution and use in source and binary forms, with or without 407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * modification, are permitted provided that the following conditions are 507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * met: 607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * * Redistributions of source code must retain the above copyright 707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * notice, this list of conditions and the following disclaimer. 807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * * Redistributions in binary form must reproduce the above 907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * copyright notice, this list of conditions and the following 1007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * disclaimer in the documentation and/or other materials provided 1107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * with the distribution. 1207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * * Neither the name of The Linux Foundation. nor the names of its 1307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * contributors may be used to endorse or promote products derived 1407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * from this software without specific prior written permission. 1507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * 1607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 1707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 1907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 2007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 2307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 2407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 2507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 2607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * 2807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani */ 2907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#ifndef __c2d2_h_ 3007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#define __c2d2_h_ 3107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 3207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#ifdef __cplusplus 3307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malaniextern "C" { 3407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#endif 3507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 3607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#ifndef C2D_API 3707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#define C2D_API /* define API export as needed */ 3807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#endif 3907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#if !defined(int32) && !defined(_INT32_DEFINED) 4007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malanitypedef int int32; 4107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#define _INT32_DEFINED 4207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#endif 4307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#if !defined(uint32) && !defined(_UINT32_DEFINED) 4407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malanitypedef unsigned int uint32; 4507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#define _UINT32_DEFINED 4607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#endif 4707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 4807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/*****************************************************************************/ 4907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/*********************** Blit definitions *****************************/ 5007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/*****************************************************************************/ 5107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 5207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Status codes, returned by any blit function */ 5307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malanitypedef enum { 5407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_STATUS_OK = 0, 5507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_STATUS_NOT_SUPPORTED = 1, 5607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_STATUS_OUT_OF_MEMORY = 2, 5707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_STATUS_INVALID_PARAM = 3, 5807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_STATUS_SURFACE_IN_USE = 4, 5907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani} C2D_STATUS; 6007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 6107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 6207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Definitions of color format modes, used together with color formats */ 6307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malanitypedef enum { 6407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_FORMAT_PACK_INTO_32BIT = (1 << 8), /* pack into dword if set */ 6507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_FORMAT_SWAP_ENDIANNESS = (1 << 9), /* swaps the order */ 6607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_FORMAT_LINEAR_SPACE = (1 << 10), /* linear color space */ 6707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_FORMAT_PREMULTIPLIED = (1 << 11), /* alpha premultiplied */ 6807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_FORMAT_INVERT_ALPHA = (1 << 12), /* inverts alpha */ 6907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_FORMAT_DISABLE_ALPHA = (1 << 13), /* disables alpha */ 7007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_FORMAT_INTERLACED = (1 << 14), /* YUV line-interlaced */ 7107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_FORMAT_TRANSPARENT = (1 << 15), /* YUV 1-bit alpha in Y */ 7207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_FORMAT_MACROTILED = (1 << 16), /* tiled in macro level */ 7307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_FORMAT_TILED_4x4 = (1 << 17), /* 4x4 tiled format */ 7407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_FORMAT_SWAP_RB = (1 << 18), /* Swap R & B color components */ 7507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani} C2D_FORMAT_MODE; 7607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 7707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Definitions of supported RGB formats, used in C2D_RGB_SURFACE_DEF. 7807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * The bits of each color channel are packed into a machine word 7907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * representing a single pixel from left to right (MSB to LSB) in the 8007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * order indicated by format name. For the sub-byte formats the pixels 8107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * are packed into bytes from left to right (MSbit to LSBit). 8207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * If the C2D_FORMAT_PACK_INTO_32BIT bit is set, the minimal 8307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * machine word used for pixel storage is 32-bit and the whole word 8407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * is reversed if endianness is swapped. 8507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * If the C2D_FORMAT_SWAP_ENDIANNESS bit is set, the order within a 8607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * minimal machine word representing a pixel 8707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * is reversed for both sub-byte and multi-byte formats. 8807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * If the C2D_FORMAT_LINEAR_SPACE bit is set, the color space of 8907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * the formats below is considered linear, if applicable. 9007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * If the C2D_FORMAT_PREMULTIPLIED bit is set, the color channels 9107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * are premultiplied with the alpha, if applicable. 9207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * If the C2D_FORMAT_INVERT_ALPHA bit is set, the alpha interpretation 9307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * is inverted: 0 - opaque, 1 - transparent, if applicable. 9407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * If the C2D_FORMAT_DISABLE_ALPHA bit is set, the alpha channel serves 9507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * as a placeholder and is ignored during blit, if applicable. 9607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * If the C2D_FORMAT_MACROTILED bit is set, the surface is in the 9707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * tiled format : 64x32 for 8bpp, 32x32 for 16bpp formats */ 9807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malanitypedef enum { 9907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_1 = 0, /* 1-bit alpha/color expansion */ 10007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 10107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_2_PALETTE = 1, /* 2-bit indices for palette */ 10207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_4_PALETTE = 2, /* 4-bit indices for palette */ 10307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_8_PALETTE = 3, /* 8-bit indices for palette */ 10407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 10507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_2_L = 4, /* 2-bit grayscale */ 10607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_4_L = 5, /* 4-bit grayscale */ 10707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_8_L = 6, /* 8-bit grayscale */ 10807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 10907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_2_A = 7, /* 2-bit alpha only */ 11007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_4_A = 8, /* 4-bit alpha only */ 11107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_8_A = 9, /* 8-bit alpha only */ 11207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 11307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_444_RGB = 10, /* 12-bit colors */ 11407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_565_RGB = 11, /* 16-bit colors */ 11507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_888_RGB = 12, /* 24-bit colors */ 11607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 11707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_1555_ARGB = 13, /* 16-bit colors (1-bit alpha) */ 11807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_4444_ARGB = 14, /* 16-bit colors (4-bit alpha) */ 11907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_8565_ARGB = 15, /* 24-bit colors (8-bit alpha) */ 12007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_8888_ARGB = 16, /* 32-bit colors (8-bit alpha) */ 12107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 12207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_5551_RGBA = 17, /* 16-bit colors (1-bit alpha) */ 12307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_4444_RGBA = 18, /* 16-bit colors (4-bit alpha) */ 12407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_5658_RGBA = 19, /* 24-bit colors (8-bit alpha) */ 12507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_8888_RGBA = 20, /* 32-bit colors (8-bit alpha) */ 12607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 12707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani /* derived RGB color formats (base format + mode bits) */ 12807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 12907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani} C2D_RGB_FORMAT; 13007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 13107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Definitions of supported YUV formats, used in C2D_YUV_SURFACE_DEF. 13207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * Each of Y,U,V channels usually takes 1 byte and therefore is 13307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * individually addressable. The definitions below show how Y,U,V 13407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * channels are packed into macropixels for each particular format. 13507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * The order is from left (smaller byte addresses) to right (larger 13607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * byte addresses). The first three digits (4xx) denote the chroma 13707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * subsampling in standard YUV notation. The digits in the macropixel 13807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * denote that the whole block (from the previous digit or from the 13907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * beginning) has to be repeated the number of times. Underscores 14007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * between Y,U,V channels are used to describe separate planes for 14107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * planar YUV formats. Formats are mapped to numbers so that future 14207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * versions with various YUV permutations are easy to add. 14307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * If the C2D_FORMAT_INTERLACED bit is set, the line order is 14407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * interlaced: 0,2,4,...1,3,5... if applicable. 14507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * If the C2D_FORMAT_TRANSPARENT bit is set, the least significant 14607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * bit of Y channel serves as alpha: 0 - transparent, 1 - opaque. */ 14707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malanitypedef enum { 14807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_411_YYUYYV = 110, /* packed, 12-bit */ 14907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_411_YUYYVY = 111, /* packed, 12-bit */ 15007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_411_UYYVYY = 112, /* packed, 12-bit, "Y411" */ 15107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_411_YUYV2Y4 = 116, /* packed, 12-bit */ 15207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_411_UYVY2Y4 = 117, /* packed, 12-bit, "Y41P" */ 15307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 15407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_422_YUYV = 120, /* packed, 16-bit, "YUY2" */ 15507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_422_UYVY = 121, /* packed, 16-bit, "UYVY" */ 15607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_422_YVYU = 122, /* packed, 16-bit, "YVYU" */ 15707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_422_VYUY = 123, /* packed, 16-bit */ 15807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 15907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_444_YUV = 130, /* packed, 24-bit */ 16007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_444_UYV = 131, /* packed, 24-bit, "IYU2" */ 16107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_444_AYUV = 136, /* packed, 24-bit, "AYUV" */ 16207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 16307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_410_Y_UV = 150, /* planar, Y + interleaved UV */ 16407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_411_Y_UV = 151, /* planar, Y + interleaved UV */ 16507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_420_Y_UV = 152, /* planar, Y + interleaved UV */ 16607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_422_Y_UV = 153, /* planar, Y + interleaved UV */ 16707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_444_Y_UV = 154, /* planar, Y + interleaved UV */ 16807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 16907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_410_Y_VU = 160, /* planar, Y + interleaved VU */ 17007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_411_Y_VU = 161, /* planar, Y + interleaved VU */ 17107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_420_Y_VU = 162, /* planar, Y + interleaved VU */ 17207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_422_Y_VU = 163, /* planar, Y + interleaved VU */ 17307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_444_Y_VU = 164, /* planar, Y + interleaved VU */ 17407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 17507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_410_Y_U_V = 170, /* planar, Y + U + V separate */ 17607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_411_Y_U_V = 171, /* planar, Y + U + V separate */ 17707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_420_Y_V_U = 172, /* planar, Y + V + U separate */ 17807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_420_Y_U_V = 173, /* planar, Y + U + V separate */ 17907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_422_Y_U_V = 174, /* planar, Y + U + V separate */ 18007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_444_Y_U_V = 175, /* planar, Y + U + V separate */ 18107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 18207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_800_Y = 190, /* planar, Y only, grayscale */ 18307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 18407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani /* derived YUV color formats (base format + mode bits), FOURCC */ 18507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 18607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_411_Y411 = 112, 18707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_411_Y41P = 117, 18807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_411_IY41 = 117 | (1 << 14), 18907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_411_Y41T = 117 | (1 << 15), 19007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 19107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_422_YUY2 = 120, 19207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_422_IUYV = 121 | (1 << 14), 19307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_422_Y42T = 121 | (1 << 15), 19407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_444_IYU2 = 131, 19507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 19607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_420_NV12 = 152, 19707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_420_NV21 = 162, 19807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 19907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_410_YUV9 = 170, 20007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_410_YVU9 = 170, 20107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_411_Y41B = 171, 20207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_420_YV12 = 172, 20307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_420_IYUV = 173, 20407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_420_I420 = 173, 20507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_422_YV16 = 174, 20607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_422_Y42B = 174, 20707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 20807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_FORMAT_800_Y800 = 190, 20907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 21007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani} C2D_YUV_FORMAT; 21107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 21207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 21307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Configuration bits, used in the config_mask field of C2D_OBJECT struct */ 21407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malanitypedef enum { 21507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_SOURCE_RECT_BIT = (1 << 0), /* enables source_rect field */ 21607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_MIRROR_H_BIT = (1 << 1), /* enables horizontal flipping */ 21707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_MIRROR_V_BIT = (1 << 2), /* enables vertical flipping */ 21807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_SOURCE_TILE_BIT = (1 << 3), /* enables source surface tiling */ 21907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_TARGET_RECT_BIT = (1 << 4), /* enables target_rect field */ 22007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_ROTATE_BIT = (1 << 5), /* enables all rotation fields */ 22107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_SCISSOR_RECT_BIT = (1 << 6), /* enables scissor_rect field */ 22207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_MASK_SURFACE_BIT = (1 << 7), /* enables mask_surface_id field */ 22307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_MASK_ALIGN_BIT = (1 << 8), /* aligns mask to source_rect */ 22407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_MASK_SCALE_BIT = (1 << 9), /* enables mask surface scaling */ 22507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_MASK_TILE_BIT = (1 << 10), /* enables mask surface tiling */ 22607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_GLOBAL_ALPHA_BIT = (1 << 11), /* enables global_alpha field */ 22707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_COLOR_KEY_BIT = (1 << 12), /* enables color_key field */ 22807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_NO_PIXEL_ALPHA_BIT = (1 << 13), /* disables source alpha channel */ 22907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_NO_BILINEAR_BIT = (1 << 14), /* disables bilinear on scaling */ 23007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_NO_ANTIALIASING_BIT = (1 << 15), /* disables antialiasing on edges */ 23107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_DRAW_LINE_BIT = (1 << 16), /* enables line drawing with source rectangle */ 23207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_DRAW_LINE_NOLAST = (1 << 17), /* disable last pixel draw for line */ 23307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani} C2D_SOURCE_CONFIG; 23407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 23507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 23607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Target configuration bits, defines rotation + mirroring. 23707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * Mirror is applied prior to rotation if enabled. */ 23807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malanitypedef enum { 23907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_TARGET_MIRROR_H = (1 << 0), /* horizontal flip */ 24007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_TARGET_MIRROR_V = (1 << 1), /* vertical flip */ 24107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_TARGET_ROTATE_0 = (0 << 2), /* no rotation */ 24207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_TARGET_ROTATE_90 = (1 << 2), /* 90 degree rotation */ 24307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_TARGET_ROTATE_180 = (2 << 2), /* 180 degree rotation */ 24407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_TARGET_ROTATE_270 = (3 << 2), /* 270 degree rotation, 90 + 180 */ 24507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_TARGET_MASK_ALIGN = (1 << 4), /* aligns mask to target scissor */ 24607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_TARGET_MASK_SCALE = (1 << 5), /* enables mask scaling */ 24707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_TARGET_MASK_TILE = (1 << 6), /* enables mask tiling */ 24807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_TARGET_COLOR_KEY = (1 << 7), /* enables target_color_key */ 24907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_TARGET_NO_PIXEL_ALPHA = (1 << 8), /* disables target alpha channel */ 25007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani} C2D_TARGET_CONFIG; 25107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 25207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#define C2D_TARGET_ROTATION_MASK (C2D_TARGET_ROTATE_90*3) 25307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 25407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Additional blend modes, can be used with both source and target configs. 25507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani If none of the below is set, the default "SRC over DST" is applied. */ 25607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malanitypedef enum { 25707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_ALPHA_BLEND_SRC_OVER = (0 << 20), /* Default, Porter-Duff "SRC over DST" */ 25807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_ALPHA_BLEND_SRC = (1 << 20), /* Porter-Duff "SRC" */ 25907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_ALPHA_BLEND_SRC_IN = (2 << 20), /* Porter-Duff "SRC in DST" */ 26007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_ALPHA_BLEND_DST_IN = (3 << 20), /* Porter-Duff "DST in SRC" */ 26107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_ALPHA_BLEND_SRC_OUT = (4 << 20), /* Porter-Duff "SRC out DST" */ 26207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_ALPHA_BLEND_DST_OUT = (5 << 20), /* Porter-Duff "DST out SRC" */ 26307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_ALPHA_BLEND_DST_OVER = (6 << 20), /* Porter-Duff "DST over SRC" */ 26407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_ALPHA_BLEND_SRC_ATOP = (7 << 20), /* Porter-Duff "SRC ATOP" */ 26507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_ALPHA_BLEND_DST_ATOP = (8 << 20), /* Porter-Duff "DST ATOP" */ 26607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_ALPHA_BLEND_XOR = (9 << 20), /* Xor */ 26707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_ALPHA_BLEND_MULTIPLY = (10 << 20), /* OpenVG "MULTIPLY" */ 26807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_ALPHA_BLEND_SCREEN = (11 << 20), /* OpenVG "SCREEN" */ 26907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_ALPHA_BLEND_DARKEN = (12 << 20), /* OpenVG "DARKEN" */ 27007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_ALPHA_BLEND_LIGHTEN = (13 << 20), /* OpenVG "LIGHTEN" */ 27107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_ALPHA_BLEND_ADDITIVE = (14 << 20), /* OpenVG "ADDITIVE" */ 27207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_ALPHA_BLEND_DIRECT = (15 << 20), /* Direct alpha blitting */ 27307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_ALPHA_BLEND_INVERTC = (16 << 20), /* Invert color */ 27407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_ALPHA_BLEND_NONE = (1 << 25), /* disables alpha blending */ 27507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani} C2D_ALPHA_BLEND_MODE; 27607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 27707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Configuration bits, used in the config_mask field of C2D_OBJECT struct */ 27807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malanitypedef enum { 27907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_OVERRIDE_GLOBAL_TARGET_ROTATE_CONFIG = (1 << 27), /* Overrides TARGET Config */ 28007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_OVERRIDE_TARGET_ROTATE_0 = (0 << 28), /* no rotation */ 28107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_OVERRIDE_TARGET_ROTATE_90 = (1 << 28), /* 90 degree rotation */ 28207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_OVERRIDE_TARGET_ROTATE_180 = (2 << 28), /* 180 degree rotation */ 28307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_OVERRIDE_TARGET_ROTATE_270 = (3 << 28), /* 270 degree rotation */ 28407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani} C2D_SOURCE_TARGET_CONFIG; 28507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 28607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#define C2D_OVERRIDE_SOURCE_CONFIG_TARGET_ROTATION_SHIFT_MASK 28 28707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#define C2D_OVERRIDE_TARGET_CONFIG_TARGET_ROTATION_SHIFT_MASK 2 28807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 28907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 29007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Surface caps enumeration */ 29107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malanitypedef enum { 29207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_SOURCE = (1 << 0), /* allows to use as a source */ 29307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_TARGET = (1 << 1), /* allows to use as a target */ 29407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_MASK = (1 << 2), /* allows to use as a mask */ 29507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_PALETTE = (1 << 3), /* allows to use as a palette */ 29607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani} C2D_SURFACE_BITS; 29707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 29807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Surface type enumeration */ 29907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malanitypedef enum { 30007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_SURFACE_RGB_HOST = 1, /* Host memory RGB surface */ 30107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_SURFACE_RGB_EXT = 2, /* External memory RGB surface */ 30207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_SURFACE_YUV_HOST = 3, /* Host memory YUV surface */ 30307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_SURFACE_YUV_EXT = 4, /* External memory YUV surface */ 30407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_SURFACE_WITH_PHYS = (1<<3), /* physical address already mapped */ 30507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani /* this bit is valid with HOST types */ 30607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_SURFACE_WITH_PHYS_DUMMY = (1<<4), /* physical address already mapped */ 30707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani /* this bit is valid with HOST types */ 30807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani} C2D_SURFACE_TYPE; 30907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 31007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Structure for registering a RGB buffer as a blit surface */ 31107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malanitypedef struct { 31207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 format; /* RGB color format plus additional mode bits */ 31307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 width; /* defines width in pixels */ 31407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 height; /* defines height in pixels */ 31507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani void *buffer; /* pointer to the RGB buffer */ 31607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani void *phys; /* physical address */ 31707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int32 stride; /* defines stride in bytes, negative stride is allowed */ 31807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani} C2D_RGB_SURFACE_DEF; 31907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 32007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Structure for registering a YUV plane(s) as a blit surface */ 32107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malanitypedef struct { 32207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 format; /* YUV color format plus additional mode bits */ 32307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 width; /* defines width in pixels */ 32407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 height; /* defines height in pixels */ 32507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani void *plane0; /* holds the whole buffer if YUV format is not planar */ 32607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani void *phys0; /* physical address */ 32707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int32 stride0; /* stride in bytes if YUV format is not planar */ 32807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani void *plane1; /* holds UV or VU plane for planar interleaved */ 32907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani void *phys1; /* physical address */ 33007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int32 stride1; /* stride for UV or VU plane for planar interleaved */ 33107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani void *plane2; /* holds the 3. plane, ignored if YUV format is not planar */ 33207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani void *phys2; /* physical address */ 33307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int32 stride2; /* stride for the 3. plane, ignored if YUV format is not planar */ 33407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani} C2D_YUV_SURFACE_DEF; 33507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 33607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 33707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Rectangle definition */ 33807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malanitypedef struct { 33907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int32 x; /* upper-left x */ 34007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int32 y; /* upper-left y */ 34107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int32 width; /* width */ 34207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int32 height; /* height */ 34307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani} C2D_RECT; 34407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 34507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* C2D_OBJECT encapsulates the blit parameters for a source surface. 34607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * The fg_color defines color in target format for bits equal to 1 34707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * in the source C2D_COLOR_FORMAT_1 format. It also defines rendering 34807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * color for all alpha-only source formats. If the surface_id is 0 34907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * the fg_color defines a constant fill color used instead of the surface. 35007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * The bg_color defines color in target format for bits equal to 0 35107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * in the source C2D_COLOR_FORMAT_1 format, otherwise both are ignored. 35207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * The palette_id is used for all palette source formats, otherwise ignored. 35307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 35407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * The source_rect first defines the content of the source surface, 35507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * it is then horizontally/vertically flipped if C2D_MIRROR_*_BIT is set, 35607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * then scaled with bilinear interpolation to exactly fit target_rect 35707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * or repeated across target_rect if C2D_SOURCE_TILE_BIT is set, 35807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * target_rect is then rotated clockwise by an arbitrary angle in degrees 35907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * around the rot_orig_x/y, defined relative to target_rect's top left point, 36007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * and then clipped to scissor_rect defined in target coordinate system. 36107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 36207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * Finally alpha blending is applied before pixels get written into the target. 36307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * Surface's pixel alpha is combined with mask alpha and with global alpha. 36407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * Mask surface follows all transformations applied to the source surface. 36507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * Source color key defines transparent color, applied together with alpha. */ 36607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malanitypedef struct C2D_OBJECT_STR { 36707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 surface_id; /* source surface */ 36807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 36907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 fg_color; /* foreground color */ 37007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 bg_color; /* background color */ 37107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 palette_id; /* one-dimensional horizontal palette surface */ 37207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 37307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 config_mask; /* defines which fields below are enabled */ 37407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 37507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_RECT source_rect; /* region of the source surface, 16.16 fp */ 37607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_RECT target_rect; /* position and scaling in target, 16.16 fp */ 37707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 37807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int32 rot_orig_x; /* rotation origin relative to target_rect's... */ 37907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int32 rot_orig_y; /* ...top left point, both are 16.16 fp */ 38007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int32 rotation; /* clock-wise rotation in degrees, 16.16 fp */ 38107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 38207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_RECT scissor_rect; /* defines the clip rectangle in target surface */ 38307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 38407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 mask_surface_id; /* source alpha-mask surface */ 38507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 global_alpha; /* 0 = fully transparent, 255 = fully opaque */ 38607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 color_key; /* transparent color for the source surface */ 38707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 38807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani struct C2D_OBJECT_STR *next; /* pointer to the next object or NULL */ 38907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani} C2D_OBJECT; 39007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 39107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Configuration bits, driver capabilities used by 2Dapplications */ 39207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malanitypedef enum { 39307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_DRIVER_SUPPORTS_GLOBAL_ALPHA_OP = (1 << 0), 39407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_DRIVER_SUPPORTS_TILE_OP = (1 << 1), 39507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_DRIVER_SUPPORTS_COLOR_KEY_OP = (1 << 2), 39607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_DRIVER_SUPPORTS_NO_PIXEL_ALPHA_OP = (1 << 3), 39707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_DRIVER_SUPPORTS_TARGET_ROTATE_OP = (1 << 4), 39807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_DRIVER_SUPPORTS_ANTI_ALIASING_OP = (1 << 5), /* antialiasing */ 39907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_DRIVER_SUPPORTS_BILINEAR_FILTER_OP = (1 << 6), 40007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_DRIVER_SUPPORTS_LENS_CORRECTION_OP = (1 << 7), 40107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_DRIVER_SUPPORTS_OVERRIDE_TARGET_ROTATE_OP = (1 << 8), 40207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_DRIVER_SUPPORTS_SHADER_BLOB_OP = (1 << 9), 40307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_DRIVER_SUPPORTS_MASK_SURFACE_OP = (1 << 10), /* mask surface */ 40407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_DRIVER_SUPPORTS_MIRROR_H_OP = (1 << 11), /* horizontal flip */ 40507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_DRIVER_SUPPORTS_MIRROR_V_OP = (1 << 12), /* vertical flip */ 40607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_DRIVER_SUPPORTS_SCISSOR_RECT_OP = (1 << 13), 40707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_DRIVER_SUPPORTS_SOURCE_RECT_OP = (1 << 14), 40807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_DRIVER_SUPPORTS_TARGET_RECT_OP = (1 << 15), 40907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_DRIVER_SUPPORTS_ROTATE_OP = (1 << 16), /* all rotations */ 41007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_DRIVER_SUPPORTS_FLUSH_WITH_FENCE_FD_OP = (1 << 17), /* all rotations */ 41107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_DRIVER_SUPPORTS_ALL_CAPABILITIES_OP = ((0xFFFFFFFF) >> (31 - 17)) /* mask for all capabilities supported */ 41207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani} C2D_DRIVER_CAPABILITIES; 41307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 41407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* 2D driver workaround bits used by the 2D applications */ 41507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malanitypedef enum { 41607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_DRIVER_WORKAROUND_NONE = 0, /* NO workaround */ 41707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_DRIVER_WORKAROUND_SWAP_UV_FOR_YUV_TARGET = (1 << 0), /* Swap UV when this flag set */ 41807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani} C2D_DRIVER_WORKAROUND; 41907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 42007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Structure to query Driver information */ 42107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malanitypedef struct { 42207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 capabilities_mask; 42307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 workaround_mask; 42407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 reserved1; 42507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 reserved2; 42607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 reserved3; 42707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani} C2D_DRIVER_INFO; 42807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 42907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Structure to query Driver information */ 43007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malanitypedef struct { 43107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 max_surface_template_needed; 43207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 reserved1; 43307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 reserved2; 43407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 reserved3; 43507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani} C2D_DRIVER_SETUP_INFO; 43607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 43707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/*****************************************************************************/ 43807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/**************************** C2D API 2.0 ********************************/ 43907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/*****************************************************************************/ 44007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 44107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/****************************************************************************** 44207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * Functions to create/destroy surfaces */ 44307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 44407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Creates a generic blit surface according to its type. 44507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * Pass a combination of desired surface bits according to planned usage. 44607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * Accepted values for surface_bits may include bits from C2D_SURFACE_BITS, 44707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * and also from C2D_DISPLAY for compatibility with HW display controller. 44807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * For host memory types the memory is preallocated outside the API 44907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * and should remain valid until surface is destroyed. 45007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * For external memory types the memory is allocated within API. 45107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * On success, the non-zero surface identifier is returned. 45207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * All numbers greater that 0 are valid surface identifiers, 0 is invalid. 45307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 45407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * Host memory RGB surface: 45507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * surface_type = C2D_SURFACE_RGB_HOST 45607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * surface_definition = C2D_RGB_SURFACE_DEF 45707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * all fields in definition structure should be set 45807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 45907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * External memory RGB surface: 46007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * surface_type = C2D_SURFACE_RGB_EXT 46107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * surface_definition = C2D_RGB_SURFACE_DEF 46207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * buffer field in definition structure is ignored 46307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 46407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * Host memory YUV surface: 46507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * surface_type = C2D_SURFACE_YUV_HOST 46607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * surface_definition = C2D_YUV_SURFACE_DEF 46707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * one or all plane and stride fields in definition structure 46807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * should be set depending on whether the format is planar or not 46907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 47007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * External memory YUV surface: 47107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * surface_type = C2D_SURFACE_YUV_EXT 47207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * surface_definition = C2D_YUV_SURFACE_DEF 47307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * all plane and stride fields in definition structure are ignored */ 47407bbf1e89c031a5d41a7561433e832d396c311a5Prashant MalaniC2D_API C2D_STATUS c2dCreateSurface( uint32 *surface_id, 47507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 surface_bits, 47607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_SURFACE_TYPE surface_type, 47707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani void *surface_definition ); 47807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 47907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Requests properties of the specified surface. */ 48007bbf1e89c031a5d41a7561433e832d396c311a5Prashant MalaniC2D_API C2D_STATUS c2dQuerySurface( uint32 surface_id, 48107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 *surface_bits, 48207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_SURFACE_TYPE *surface_type, 48307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 *width, uint32 *height, 48407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 *format ); 48507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 48607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Destroys a generic blit surface. 48707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * For external memory surfaces also deallocates the memory. 48807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * It is safe to free any external resources associated with a given 48907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * surface on c2dCreateSurface call after this function returns. */ 49007bbf1e89c031a5d41a7561433e832d396c311a5Prashant MalaniC2D_API C2D_STATUS c2dDestroySurface( uint32 surface_id ); 49107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 49207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 49307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/****************************************************************************** 49407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * Functions to modify/exchange surface data */ 49507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 49607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* The format of fill_color is the same as color format being used 49707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * for specified surface. If fill_rect is NULL the whole surface is filled. 49807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * Alpha-blending is not performed while filling. 49907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * The operation is complete when function returns. */ 50007bbf1e89c031a5d41a7561433e832d396c311a5Prashant MalaniC2D_API C2D_STATUS c2dFillSurface( uint32 surface_id, 50107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 fill_color, 50207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_RECT *fill_rect ); 50307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 50407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Writes data located in host memory into the specified surface. 50507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * The chunk of host memory is identified with surface_type and 50607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * surface_definition, no surface registration needed in this case. 50707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * Only C2D_SURFACE_RGB_HOST, C2D_SURFACE_YUV_HOST are accepted. 50807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * If only part of the host memory buffer should be loaded, it should 50907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * be configured in surface_definition using width, height and stride. 51007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * The x and y are defined in target surface coordinate space. 51107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * Color conversion has to be done, if color formats differ. 51207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * Alpha-blending is not performed while writing. 51307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * The operation is complete when function returns. */ 51407bbf1e89c031a5d41a7561433e832d396c311a5Prashant MalaniC2D_API C2D_STATUS c2dWriteSurface( uint32 surface_id, 51507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_SURFACE_TYPE surface_type, 51607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani void *surface_definition, 51707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int32 x, int32 y ); 51807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 51907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Reads data from the specified surface into the host memory. 52007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * The chunk of host memory is identified with surface_type and 52107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * surface_definition, no surface registration needed in this case. 52207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * Only C2D_SURFACE_RGB_HOST, C2D_SURFACE_YUV_HOST are accepted. 52307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * If only part of the surface should be read, it should 52407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * be configured in surface_definition using width, height and stride. 52507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * The x and y are defined in source surface coordinate space. 52607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * Color conversion has to be done, if color formats differ. 52707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * Alpha-blending is not performed while reading. 52807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * The operation is complete when function returns. */ 52907bbf1e89c031a5d41a7561433e832d396c311a5Prashant MalaniC2D_API C2D_STATUS c2dReadSurface( uint32 surface_id, 53007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_SURFACE_TYPE surface_type, 53107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani void *surface_definition, 53207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int32 x, int32 y ); 53307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 53407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Notifies c2d imlementation that surface has been updated from outside the API, 53507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * if updated_rect is NULL then the whole surface has been updated. */ 53607bbf1e89c031a5d41a7561433e832d396c311a5Prashant MalaniC2D_API C2D_STATUS c2dSurfaceUpdated( uint32 surface_id, 53707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_RECT *updated_rect ); 53807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 53907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Updates surface information. 54007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * Could be called only for host surfaces set with parameter "C2D_SURFACE_WITH_PHYS". 54107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * Count for surface planes have to be same than for already allocated surface */ 54207bbf1e89c031a5d41a7561433e832d396c311a5Prashant MalaniC2D_API C2D_STATUS c2dUpdateSurface( uint32 surface_id, 54307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 surface_bits, 54407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_SURFACE_TYPE surface_type, 54507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani void *surface_definition ); 54607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 54707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/****************************************************************************** 54807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * Functions to do actual blit */ 54907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 55007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Draw a list of blit objects into the given target. 55107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * The target_config is a bitwise OR of values from C2D_TARGET_CONFIG. 55207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * The target transformation creates the effect that target surface 55307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * is transformed before the blit and then transformed back 55407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * after blit, however no physical target transform is performed. 55507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * The objects_list is a linked list of blit objects, no more 55607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * than num_objects is drawn from the given list. 55707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * If num_objects is 0, the whole list is drawn. 55807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * The blit is not guaranteed to complete after function returns. */ 55907bbf1e89c031a5d41a7561433e832d396c311a5Prashant MalaniC2D_API C2D_STATUS c2dDraw( uint32 target_id, 56007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 target_config, C2D_RECT *target_scissor, 56107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 target_mask_id, uint32 target_color_key, 56207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_OBJECT *objects_list, uint32 num_objects ); 56307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 56407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 56507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* timstamp set in the blit commands flush */ 56607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malanitypedef void* c2d_ts_handle; 56707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 56807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Forces any pending blit to complete for a given target. 56907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * Non-blocking. All input surfaces for this target except those 57007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * which are shared with other targets are expected to be immediately 57107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * writable after client has been waiting returned timestamp with 57207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * c2dWaitTimestamp funtion or c2dFinish has been called for same target */ 57307bbf1e89c031a5d41a7561433e832d396c311a5Prashant MalaniC2D_API C2D_STATUS c2dFlush( uint32 target_id, c2d_ts_handle *timestamp); 57407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 57507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 57607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Waits the pending timestamp */ 57707bbf1e89c031a5d41a7561433e832d396c311a5Prashant MalaniC2D_API C2D_STATUS c2dWaitTimestamp( c2d_ts_handle timestamp ); 57807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 57907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 58007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Forces any pending blit to complete for a given target. 58107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * Blocking version, returns when blit is done. 58207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * All input surfaces for this target except those which are shared with 58307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * other targets are expected to be immediately 58407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * writable after this function returns. */ 58507bbf1e89c031a5d41a7561433e832d396c311a5Prashant MalaniC2D_API C2D_STATUS c2dFinish( uint32 target_id ); 58607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 58707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 58807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/*****************************************************************************/ 58907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/****************************** Display API **********************************/ 59007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/*****************************************************************************/ 59107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 59207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 59307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Display input enumeration */ 59407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malanitypedef enum { 59507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_DISPLAY_INPUT_0 = 0, /*!< default input */ 59607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_DISPLAY_INPUT_1 = (1<<16), /*!< Overlay 1 */ 59707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_DISPLAY_INPUT_2 = (1<<17), /*!< Overlay 2... */ 59807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani} C2D_DISPLAY_INPUT; 59907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 60007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 60107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/****************************************************************************** 60207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * Functions for display output. */ 60307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 60407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Functionality described in this section is optional and is 60507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * provided only for the cases when blit HW 60607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * is tightly bound to the display controller. */ 60707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 60807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Display enumeration, may also be used in surface caps */ 60907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malanitypedef enum { 61007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_DISPLAY_MAIN = (1 << 10), /* main display */ 61107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_DISPLAY_SECONDARY = (1 << 11), /* secondary display */ 61207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_DISPLAY_TV_OUT = (1 << 12), /* tv-out */ 61307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani} C2D_DISPLAY; 61407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 61507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Display window enumeration */ 61607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malanitypedef enum { 61707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_DISPLAY_OVERLAY = C2D_DISPLAY_INPUT_1, /*!< Overlay window bit. This defines display input. 61807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani When defined the surface is set on the overlay window 61907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani otherwise the surface is set on the background window. */ 62007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani} C2D_DISPLAY_WINDOW; /*!< Window bit set with display parameter */ 62107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 62207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 62307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Display update modes */ 62407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malanitypedef enum { 62507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_DISPLAY_MODE_TEAR_SYNC = (1 << 0), /* enables tearing sync */ 62607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_DISPLAY_MODE_SURF_REMOVE = (1 << 1), /* Remove surface from given display + input */ 62707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani} C2D_DISPLAY_MODE; 62807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 62907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 63007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Sets the given surface as a current display front buffer. 63107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * Several displays can be specified as an output if supported. 63207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * Still only one input can be specified at a time fro display/displays. 63307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * The surface remains shown until it gets replaced with another one. */ 63407bbf1e89c031a5d41a7561433e832d396c311a5Prashant MalaniC2D_API C2D_STATUS c2dDisplaySetSurface( uint32 display, 63507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 surface_id, uint32 mode ); 63607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 63707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Returns the current surface for a particular display. 63807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * Only one display can be specified at a time. 63907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * The latest surface set with compDisplaySetSurface or 64007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * the default pre-allocated surface is returned. */ 64107bbf1e89c031a5d41a7561433e832d396c311a5Prashant MalaniC2D_API C2D_STATUS c2dDisplayGetSurface( uint32 display, 64207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 *surface_id ); 64307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 64407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Returns the properties for a particular display. 64507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * Only one display can be specified at a time. */ 64607bbf1e89c031a5d41a7561433e832d396c311a5Prashant MalaniC2D_API C2D_STATUS c2dDisplayGetProperties( uint32 display, 64707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 *width, uint32 *height, 64807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 *format ); 64907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 65007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* Sets the properties for a particular display input. 65107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * Only one display + input can be specified at a time. 65207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * C2D_OBJECT used to set input rect(target rect), 65307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * blending operations, rotation...etc for display source */ 65407bbf1e89c031a5d41a7561433e832d396c311a5Prashant MalaniC2D_API C2D_STATUS c2dDisplaySetObject( uint32 display, 65507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32 target_config, uint32 target_color_key, 65607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani C2D_OBJECT * c2dObject, uint32 mode); 65707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 65807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* allows user to map a memory region to the gpu. only supported on linux 65907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * mem_fd is the fd of the memory region, hostptr is the host pointer to the region, 66007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * len and offset are the size and offset of the memory. 66107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * flags is one of the memory types supported by gsl 66207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * gpaddr is passed by refernce back to the user 66307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani */ 66407bbf1e89c031a5d41a7561433e832d396c311a5Prashant MalaniC2D_API C2D_STATUS c2dMapAddr ( int mem_fd, void * hostptr, uint32 len, uint32 offset, uint32 flags, void ** gpuaddr); 66507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 66607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* allows user to unmap memory region mapped by c2dMapAddr. 66707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * gpaddr is the gpuaddr to unmap */ 66807bbf1e89c031a5d41a7561433e832d396c311a5Prashant MalaniC2D_API C2D_STATUS c2dUnMapAddr (void * gpuaddr); 66907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 67007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* allows user to query driver capabilities. 67107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * driver_info is the information about driver */ 67207bbf1e89c031a5d41a7561433e832d396c311a5Prashant MalaniC2D_API C2D_STATUS c2dGetDriverCapabilities( C2D_DRIVER_INFO * driver_info); 67307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 67407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* create a fence fd for the timestamp */ 67507bbf1e89c031a5d41a7561433e832d396c311a5Prashant MalaniC2D_API C2D_STATUS c2dCreateFenceFD( uint32 target_id, c2d_ts_handle timestamp, int32 *fd); 67607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 67707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/*****************************************************************************/ 67807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 67907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#ifdef __cplusplus 68007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani} 68107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#endif 68207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 68307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#endif /* __c2d2_h_ */ 684