Ramkumar Radhakrishnan | 47573e2 | 2012-11-07 11:36:41 -0800 | [diff] [blame] | 1 | /* |
Praneeth Paladugu | 3e3e8f8 | 2017-03-07 10:42:20 -0800 | [diff] [blame^] | 2 | * Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. |
Ramkumar Radhakrishnan | 47573e2 | 2012-11-07 11:36:41 -0800 | [diff] [blame] | 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions are |
| 6 | * met: |
| 7 | * * Redistributions of source code must retain the above copyright |
| 8 | * notice, this list of conditions and the following disclaimer. |
| 9 | * * Redistributions in binary form must reproduce the above |
| 10 | * copyright notice, this list of conditions and the following |
| 11 | * disclaimer in the documentation and/or other materials provided |
| 12 | * with the distribution. |
| 13 | * * Neither the name of The Linux Foundation nor the names of its |
| 14 | * contributors may be used to endorse or promote products derived |
| 15 | * from this software without specific prior written permission. |
| 16 | * |
| 17 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED |
| 18 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT |
| 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS |
| 21 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| 24 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 25 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
| 26 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| 27 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | */ |
| 29 | |
| 30 | #ifndef _QDMETADATA_H |
| 31 | #define _QDMETADATA_H |
| 32 | |
Arun Kumar K.R | b2771bf | 2016-10-03 21:38:23 -0700 | [diff] [blame] | 33 | #ifdef USE_COLOR_METADATA |
| 34 | #include <color_metadata.h> |
| 35 | #endif |
| 36 | |
Shuzhen Wang | f3529c3 | 2014-01-28 17:15:45 -0800 | [diff] [blame] | 37 | #ifdef __cplusplus |
| 38 | extern "C" { |
| 39 | #endif |
| 40 | |
Praneeth Paladugu | 3e3e8f8 | 2017-03-07 10:42:20 -0800 | [diff] [blame^] | 41 | #define MAX_UBWC_STATS_LENGTH 32 |
| 42 | |
Shuzhen Wang | f3529c3 | 2014-01-28 17:15:45 -0800 | [diff] [blame] | 43 | enum ColorSpace_t{ |
Shuzhen Wang | 0d11348 | 2014-01-28 16:10:22 -0800 | [diff] [blame] | 44 | ITU_R_601, |
| 45 | ITU_R_601_FR, |
| 46 | ITU_R_709, |
Arun Kumar K.R | c18263e | 2016-10-03 21:26:10 -0700 | [diff] [blame] | 47 | ITU_R_2020, |
| 48 | ITU_R_2020_FR, |
Shuzhen Wang | f3529c3 | 2014-01-28 17:15:45 -0800 | [diff] [blame] | 49 | }; |
Shuzhen Wang | 0d11348 | 2014-01-28 16:10:22 -0800 | [diff] [blame] | 50 | |
Dileep Marchya | 1a7e1f1 | 2015-09-25 19:11:57 -0700 | [diff] [blame] | 51 | enum IGC_t { |
| 52 | IGC_NotSpecified, |
| 53 | IGC_sRGB, |
| 54 | }; |
| 55 | |
Saurabh Shah | 5daeee5 | 2013-01-23 16:52:26 +0800 | [diff] [blame] | 56 | struct HSICData_t { |
Ramkumar Radhakrishnan | 47573e2 | 2012-11-07 11:36:41 -0800 | [diff] [blame] | 57 | int32_t hue; |
| 58 | float saturation; |
| 59 | int32_t intensity; |
| 60 | float contrast; |
Saurabh Shah | 5daeee5 | 2013-01-23 16:52:26 +0800 | [diff] [blame] | 61 | }; |
Ramkumar Radhakrishnan | 47573e2 | 2012-11-07 11:36:41 -0800 | [diff] [blame] | 62 | |
Ramkumar Radhakrishnan | 92f3abe | 2013-06-05 13:52:40 -0700 | [diff] [blame] | 63 | struct BufferDim_t { |
| 64 | int32_t sliceWidth; |
| 65 | int32_t sliceHeight; |
| 66 | }; |
| 67 | |
Praneeth Paladugu | 3e3e8f8 | 2017-03-07 10:42:20 -0800 | [diff] [blame^] | 68 | enum UBWC_Version { |
| 69 | UBWC_UNUSED = 0, |
| 70 | UBWC_1_0 = 0x1, |
| 71 | UBWC_2_0 = 0x2, |
| 72 | UBWC_MAX_VERSION = 0xFF, |
| 73 | }; |
| 74 | |
| 75 | struct UBWC_2_0_Stats { |
| 76 | uint32_t nCRStatsTile32; /**< UBWC Stats info for 32 Byte Tile */ |
| 77 | uint32_t nCRStatsTile64; /**< UBWC Stats info for 64 Byte Tile */ |
| 78 | uint32_t nCRStatsTile96; /**< UBWC Stats info for 96 Byte Tile */ |
| 79 | uint32_t nCRStatsTile128; /**< UBWC Stats info for 128 Byte Tile */ |
| 80 | uint32_t nCRStatsTile160; /**< UBWC Stats info for 160 Byte Tile */ |
| 81 | uint32_t nCRStatsTile192; /**< UBWC Stats info for 192 Byte Tile */ |
| 82 | uint32_t nCRStatsTile256; /**< UBWC Stats info for 256 Byte Tile */ |
| 83 | }; |
| 84 | |
| 85 | struct UBWCStats { |
| 86 | enum UBWC_Version version; /* Union depends on this version. */ |
| 87 | uint8_t bDataValid; /* If [non-zero], CR Stats data is valid. |
| 88 | * Consumers may use stats data. |
| 89 | * If [zero], CR Stats data is invalid. |
| 90 | * Consumers *Shall* not use stats data */ |
| 91 | union { |
| 92 | struct UBWC_2_0_Stats ubwc_stats; |
| 93 | uint32_t reserved[MAX_UBWC_STATS_LENGTH]; /* This is for future */ |
| 94 | }; |
| 95 | }; |
| 96 | |
Ray Zhang | 8ace84d | 2016-08-08 19:36:03 +0800 | [diff] [blame] | 97 | struct S3DGpuComp_t { |
| 98 | int32_t displayId; /* on which display S3D is composed by client */ |
| 99 | uint32_t s3dMode; /* the S3D format of this layer to be accessed by client */ |
| 100 | }; |
| 101 | |
Saurabh Shah | 5daeee5 | 2013-01-23 16:52:26 +0800 | [diff] [blame] | 102 | struct MetaData_t { |
Ramkumar Radhakrishnan | 47573e2 | 2012-11-07 11:36:41 -0800 | [diff] [blame] | 103 | int32_t operation; |
| 104 | int32_t interlaced; |
Shuzhen Wang | f3529c3 | 2014-01-28 17:15:45 -0800 | [diff] [blame] | 105 | struct BufferDim_t bufferDim; |
feifanz | 9cc2303 | 2016-03-23 18:48:56 +0800 | [diff] [blame] | 106 | float refreshrate; |
Shuzhen Wang | f3529c3 | 2014-01-28 17:15:45 -0800 | [diff] [blame] | 107 | enum ColorSpace_t colorSpace; |
Dileep Marchya | 1a7e1f1 | 2015-09-25 19:11:57 -0700 | [diff] [blame] | 108 | enum IGC_t igc; |
Arun Kumar K.R | da2f69b | 2014-09-30 15:45:37 -0700 | [diff] [blame] | 109 | /* Gralloc sets PRIV_SECURE_BUFFER flag to inform that the buffers are from |
| 110 | * ION_SECURE. which should not be mapped. However, for GPU post proc |
| 111 | * feature, GFX needs to map this buffer, in the client context and in SF |
| 112 | * context, it should not. Hence to differentiate, add this metadata field |
| 113 | * for clients to set, and GPU will to read and know when to map the |
| 114 | * SECURE_BUFFER(ION) */ |
| 115 | int32_t mapSecureBuffer; |
Naseer Ahmed | 3324ff7 | 2015-01-21 17:14:44 -0500 | [diff] [blame] | 116 | /* The supported formats are defined in gralloc_priv.h to |
| 117 | * support legacy code*/ |
| 118 | uint32_t s3dFormat; |
Sushil Chauhan | e7acc3c | 2015-06-23 16:22:30 -0700 | [diff] [blame] | 119 | /* VENUS output buffer is linear for UBWC Interlaced video */ |
| 120 | uint32_t linearFormat; |
Saurabh Shah | 95f8368 | 2015-10-16 10:30:04 -0700 | [diff] [blame] | 121 | /* Set by graphics to indicate that this buffer will be written to but not |
| 122 | * swapped out */ |
Saurabh Shah | b8067a4 | 2015-11-06 16:52:02 -0800 | [diff] [blame] | 123 | uint32_t isSingleBufferMode; |
Ray Zhang | 8ace84d | 2016-08-08 19:36:03 +0800 | [diff] [blame] | 124 | /* Indicate GPU to draw S3D layer on dedicate display device */ |
| 125 | struct S3DGpuComp_t s3dComp; |
Naseer Ahmed | e8f254d | 2016-08-02 20:06:40 -0400 | [diff] [blame] | 126 | |
| 127 | /* Set by camera to program the VT Timestamp */ |
| 128 | uint64_t vtTimeStamp; |
Arun Kumar K.R | b2771bf | 2016-10-03 21:38:23 -0700 | [diff] [blame] | 129 | #ifdef USE_COLOR_METADATA |
| 130 | /* Color Aspects + HDR info */ |
| 131 | ColorMetaData color; |
| 132 | #endif |
Praneeth Paladugu | 3e3e8f8 | 2017-03-07 10:42:20 -0800 | [diff] [blame^] | 133 | /* Consumer should read this data as follows based on |
| 134 | * Gralloc flag "interlaced" listed above. |
| 135 | * [0] : If it is progressive. |
| 136 | * [0] : Top field, if it is interlaced. |
| 137 | * [1] : Do not read, if it is progressive. |
| 138 | * [1] : Bottom field, if it is interlaced. |
| 139 | */ |
| 140 | struct UBWCStats ubwcCRStats[2]; |
Saurabh Shah | 5daeee5 | 2013-01-23 16:52:26 +0800 | [diff] [blame] | 141 | }; |
Ramkumar Radhakrishnan | 47573e2 | 2012-11-07 11:36:41 -0800 | [diff] [blame] | 142 | |
Shuzhen Wang | f3529c3 | 2014-01-28 17:15:45 -0800 | [diff] [blame] | 143 | enum DispParamType { |
Naseer Ahmed | e8f254d | 2016-08-02 20:06:40 -0400 | [diff] [blame] | 144 | SET_VT_TIMESTAMP = 0x0001, |
Arun Kumar K.R | b2771bf | 2016-10-03 21:38:23 -0700 | [diff] [blame] | 145 | COLOR_METADATA = 0x0002, |
Naseer Ahmed | e8f254d | 2016-08-02 20:06:40 -0400 | [diff] [blame] | 146 | PP_PARAM_INTERLACED = 0x0004, |
| 147 | UNUSED2 = 0x0008, |
| 148 | UNUSED3 = 0x0010, |
| 149 | UNUSED4 = 0x0020, |
Praneeth Paladugu | 3e3e8f8 | 2017-03-07 10:42:20 -0800 | [diff] [blame^] | 150 | SET_UBWC_CR_STATS_INFO = 0x0040, |
Naseer Ahmed | e8f254d | 2016-08-02 20:06:40 -0400 | [diff] [blame] | 151 | UPDATE_BUFFER_GEOMETRY = 0x0080, |
| 152 | UPDATE_REFRESH_RATE = 0x0100, |
| 153 | UPDATE_COLOR_SPACE = 0x0200, |
| 154 | MAP_SECURE_BUFFER = 0x0400, |
| 155 | S3D_FORMAT = 0x0800, |
| 156 | LINEAR_FORMAT = 0x1000, |
| 157 | SET_IGC = 0x2000, |
| 158 | SET_SINGLE_BUFFER_MODE = 0x4000, |
| 159 | SET_S3D_COMP = 0x8000, |
Shuzhen Wang | f3529c3 | 2014-01-28 17:15:45 -0800 | [diff] [blame] | 160 | }; |
Ramkumar Radhakrishnan | 47573e2 | 2012-11-07 11:36:41 -0800 | [diff] [blame] | 161 | |
feifanz | 9cc2303 | 2016-03-23 18:48:56 +0800 | [diff] [blame] | 162 | enum DispFetchParamType { |
Naseer Ahmed | e8f254d | 2016-08-02 20:06:40 -0400 | [diff] [blame] | 163 | GET_VT_TIMESTAMP = 0x0001, |
Arun Kumar K.R | b2771bf | 2016-10-03 21:38:23 -0700 | [diff] [blame] | 164 | GET_COLOR_METADATA = 0x0002, |
Naseer Ahmed | e8f254d | 2016-08-02 20:06:40 -0400 | [diff] [blame] | 165 | GET_PP_PARAM_INTERLACED = 0x0004, |
Praneeth Paladugu | 3e3e8f8 | 2017-03-07 10:42:20 -0800 | [diff] [blame^] | 166 | GET_UBWC_CR_STATS_INFO = 0x0040, |
Naseer Ahmed | e8f254d | 2016-08-02 20:06:40 -0400 | [diff] [blame] | 167 | GET_BUFFER_GEOMETRY = 0x0080, |
| 168 | GET_REFRESH_RATE = 0x0100, |
| 169 | GET_COLOR_SPACE = 0x0200, |
| 170 | GET_MAP_SECURE_BUFFER = 0x0400, |
| 171 | GET_S3D_FORMAT = 0x0800, |
| 172 | GET_LINEAR_FORMAT = 0x1000, |
| 173 | GET_IGC = 0x2000, |
| 174 | GET_SINGLE_BUFFER_MODE = 0x4000, |
| 175 | GET_S3D_COMP = 0x8000, |
feifanz | 9cc2303 | 2016-03-23 18:48:56 +0800 | [diff] [blame] | 176 | }; |
| 177 | |
Shuzhen Wang | f3529c3 | 2014-01-28 17:15:45 -0800 | [diff] [blame] | 178 | struct private_handle_t; |
| 179 | int setMetaData(struct private_handle_t *handle, enum DispParamType paramType, |
| 180 | void *param); |
| 181 | |
feifanz | 9cc2303 | 2016-03-23 18:48:56 +0800 | [diff] [blame] | 182 | int getMetaData(struct private_handle_t *handle, enum DispFetchParamType paramType, |
| 183 | void *param); |
| 184 | |
| 185 | int copyMetaData(struct private_handle_t *src, struct private_handle_t *dst); |
Ray Zhang | 8ace84d | 2016-08-08 19:36:03 +0800 | [diff] [blame] | 186 | |
| 187 | int clearMetaData(struct private_handle_t *handle, enum DispParamType paramType); |
| 188 | |
Shuzhen Wang | f3529c3 | 2014-01-28 17:15:45 -0800 | [diff] [blame] | 189 | #ifdef __cplusplus |
| 190 | } |
| 191 | #endif |
Ramkumar Radhakrishnan | 47573e2 | 2012-11-07 11:36:41 -0800 | [diff] [blame] | 192 | |
| 193 | #endif /* _QDMETADATA_H */ |
| 194 | |