Ramkumar Radhakrishnan | 47573e2 | 2012-11-07 11:36:41 -0800 | [diff] [blame] | 1 | /* |
Gousemoodhin Nadaf | 8da58ee | 2019-01-03 10:44:59 +0530 | [diff] [blame^] | 2 | * Copyright (c) 2012-2019, 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 | #include <color_metadata.h> |
Arun Kumar K.R | b2771bf | 2016-10-03 21:38:23 -0700 | [diff] [blame] | 34 | |
Shuzhen Wang | f3529c3 | 2014-01-28 17:15:45 -0800 | [diff] [blame] | 35 | #ifdef __cplusplus |
| 36 | extern "C" { |
| 37 | #endif |
| 38 | |
Praneeth Paladugu | 3e3e8f8 | 2017-03-07 10:42:20 -0800 | [diff] [blame] | 39 | #define MAX_UBWC_STATS_LENGTH 32 |
Mohan Pallaka | 5d81443 | 2018-08-01 10:40:13 -0700 | [diff] [blame] | 40 | #define GRAPHICS_METADATA_SIZE 4096 |
Praneeth Paladugu | 3e3e8f8 | 2017-03-07 10:42:20 -0800 | [diff] [blame] | 41 | |
Shuzhen Wang | f3529c3 | 2014-01-28 17:15:45 -0800 | [diff] [blame] | 42 | enum ColorSpace_t{ |
Shuzhen Wang | 0d11348 | 2014-01-28 16:10:22 -0800 | [diff] [blame] | 43 | ITU_R_601, |
| 44 | ITU_R_601_FR, |
| 45 | ITU_R_709, |
Arun Kumar K.R | c18263e | 2016-10-03 21:26:10 -0700 | [diff] [blame] | 46 | ITU_R_2020, |
| 47 | ITU_R_2020_FR, |
Shuzhen Wang | f3529c3 | 2014-01-28 17:15:45 -0800 | [diff] [blame] | 48 | }; |
Shuzhen Wang | 0d11348 | 2014-01-28 16:10:22 -0800 | [diff] [blame] | 49 | |
Dileep Marchya | 1a7e1f1 | 2015-09-25 19:11:57 -0700 | [diff] [blame] | 50 | enum IGC_t { |
| 51 | IGC_NotSpecified, |
| 52 | IGC_sRGB, |
| 53 | }; |
| 54 | |
Saurabh Shah | 5daeee5 | 2013-01-23 16:52:26 +0800 | [diff] [blame] | 55 | struct HSICData_t { |
Ramkumar Radhakrishnan | 47573e2 | 2012-11-07 11:36:41 -0800 | [diff] [blame] | 56 | int32_t hue; |
| 57 | float saturation; |
| 58 | int32_t intensity; |
| 59 | float contrast; |
Saurabh Shah | 5daeee5 | 2013-01-23 16:52:26 +0800 | [diff] [blame] | 60 | }; |
Ramkumar Radhakrishnan | 47573e2 | 2012-11-07 11:36:41 -0800 | [diff] [blame] | 61 | |
Ramkumar Radhakrishnan | 92f3abe | 2013-06-05 13:52:40 -0700 | [diff] [blame] | 62 | struct BufferDim_t { |
| 63 | int32_t sliceWidth; |
| 64 | int32_t sliceHeight; |
| 65 | }; |
| 66 | |
Praneeth Paladugu | 3e3e8f8 | 2017-03-07 10:42:20 -0800 | [diff] [blame] | 67 | enum UBWC_Version { |
| 68 | UBWC_UNUSED = 0, |
| 69 | UBWC_1_0 = 0x1, |
| 70 | UBWC_2_0 = 0x2, |
Varun Arora | d7bb869 | 2018-09-11 15:22:00 -0700 | [diff] [blame] | 71 | UBWC_3_0 = 0x3, |
Gousemoodhin Nadaf | 8da58ee | 2019-01-03 10:44:59 +0530 | [diff] [blame^] | 72 | UBWC_4_0 = 0x4, |
Praneeth Paladugu | 3e3e8f8 | 2017-03-07 10:42:20 -0800 | [diff] [blame] | 73 | UBWC_MAX_VERSION = 0xFF, |
| 74 | }; |
| 75 | |
| 76 | struct UBWC_2_0_Stats { |
| 77 | uint32_t nCRStatsTile32; /**< UBWC Stats info for 32 Byte Tile */ |
| 78 | uint32_t nCRStatsTile64; /**< UBWC Stats info for 64 Byte Tile */ |
| 79 | uint32_t nCRStatsTile96; /**< UBWC Stats info for 96 Byte Tile */ |
| 80 | uint32_t nCRStatsTile128; /**< UBWC Stats info for 128 Byte Tile */ |
| 81 | uint32_t nCRStatsTile160; /**< UBWC Stats info for 160 Byte Tile */ |
| 82 | uint32_t nCRStatsTile192; /**< UBWC Stats info for 192 Byte Tile */ |
| 83 | uint32_t nCRStatsTile256; /**< UBWC Stats info for 256 Byte Tile */ |
| 84 | }; |
| 85 | |
| 86 | struct UBWCStats { |
| 87 | enum UBWC_Version version; /* Union depends on this version. */ |
| 88 | uint8_t bDataValid; /* If [non-zero], CR Stats data is valid. |
| 89 | * Consumers may use stats data. |
| 90 | * If [zero], CR Stats data is invalid. |
| 91 | * Consumers *Shall* not use stats data */ |
| 92 | union { |
| 93 | struct UBWC_2_0_Stats ubwc_stats; |
| 94 | uint32_t reserved[MAX_UBWC_STATS_LENGTH]; /* This is for future */ |
| 95 | }; |
| 96 | }; |
| 97 | |
Ray Zhang | 8ace84d | 2016-08-08 19:36:03 +0800 | [diff] [blame] | 98 | struct S3DGpuComp_t { |
| 99 | int32_t displayId; /* on which display S3D is composed by client */ |
| 100 | uint32_t s3dMode; /* the S3D format of this layer to be accessed by client */ |
| 101 | }; |
| 102 | |
Mohan Pallaka | 5d81443 | 2018-08-01 10:40:13 -0700 | [diff] [blame] | 103 | typedef struct GraphicsMetadata { |
| 104 | uint32_t size; |
| 105 | uint32_t data[GRAPHICS_METADATA_SIZE]; |
| 106 | } GraphicsMetadata; |
| 107 | |
Saurabh Shah | 5daeee5 | 2013-01-23 16:52:26 +0800 | [diff] [blame] | 108 | struct MetaData_t { |
Ramkumar Radhakrishnan | 47573e2 | 2012-11-07 11:36:41 -0800 | [diff] [blame] | 109 | int32_t operation; |
| 110 | int32_t interlaced; |
Shuzhen Wang | f3529c3 | 2014-01-28 17:15:45 -0800 | [diff] [blame] | 111 | struct BufferDim_t bufferDim; |
feifanz | 9cc2303 | 2016-03-23 18:48:56 +0800 | [diff] [blame] | 112 | float refreshrate; |
Shuzhen Wang | f3529c3 | 2014-01-28 17:15:45 -0800 | [diff] [blame] | 113 | enum ColorSpace_t colorSpace; |
Dileep Marchya | 1a7e1f1 | 2015-09-25 19:11:57 -0700 | [diff] [blame] | 114 | enum IGC_t igc; |
Arun Kumar K.R | da2f69b | 2014-09-30 15:45:37 -0700 | [diff] [blame] | 115 | /* Gralloc sets PRIV_SECURE_BUFFER flag to inform that the buffers are from |
| 116 | * ION_SECURE. which should not be mapped. However, for GPU post proc |
| 117 | * feature, GFX needs to map this buffer, in the client context and in SF |
| 118 | * context, it should not. Hence to differentiate, add this metadata field |
| 119 | * for clients to set, and GPU will to read and know when to map the |
| 120 | * SECURE_BUFFER(ION) */ |
| 121 | int32_t mapSecureBuffer; |
Naseer Ahmed | 3324ff7 | 2015-01-21 17:14:44 -0500 | [diff] [blame] | 122 | /* The supported formats are defined in gralloc_priv.h to |
| 123 | * support legacy code*/ |
| 124 | uint32_t s3dFormat; |
Sushil Chauhan | e7acc3c | 2015-06-23 16:22:30 -0700 | [diff] [blame] | 125 | /* VENUS output buffer is linear for UBWC Interlaced video */ |
| 126 | uint32_t linearFormat; |
Saurabh Shah | 95f8368 | 2015-10-16 10:30:04 -0700 | [diff] [blame] | 127 | /* Set by graphics to indicate that this buffer will be written to but not |
| 128 | * swapped out */ |
Saurabh Shah | b8067a4 | 2015-11-06 16:52:02 -0800 | [diff] [blame] | 129 | uint32_t isSingleBufferMode; |
Ray Zhang | 8ace84d | 2016-08-08 19:36:03 +0800 | [diff] [blame] | 130 | /* Indicate GPU to draw S3D layer on dedicate display device */ |
| 131 | struct S3DGpuComp_t s3dComp; |
Naseer Ahmed | e8f254d | 2016-08-02 20:06:40 -0400 | [diff] [blame] | 132 | |
| 133 | /* Set by camera to program the VT Timestamp */ |
| 134 | uint64_t vtTimeStamp; |
Arun Kumar K.R | b2771bf | 2016-10-03 21:38:23 -0700 | [diff] [blame] | 135 | /* Color Aspects + HDR info */ |
| 136 | ColorMetaData color; |
Praneeth Paladugu | 3e3e8f8 | 2017-03-07 10:42:20 -0800 | [diff] [blame] | 137 | /* Consumer should read this data as follows based on |
| 138 | * Gralloc flag "interlaced" listed above. |
| 139 | * [0] : If it is progressive. |
| 140 | * [0] : Top field, if it is interlaced. |
| 141 | * [1] : Do not read, if it is progressive. |
| 142 | * [1] : Bottom field, if it is interlaced. |
| 143 | */ |
| 144 | struct UBWCStats ubwcCRStats[2]; |
Ashwini Rao | 6e61696 | 2017-11-28 12:12:46 -0800 | [diff] [blame] | 145 | /* Set by camera to indicate that this buffer will be used for a High |
| 146 | * Performance Video Usecase */ |
| 147 | uint32_t isVideoPerfMode; |
Mohan Pallaka | 5d81443 | 2018-08-01 10:40:13 -0700 | [diff] [blame] | 148 | /* Populated and used by adreno during buffer size calculation. |
| 149 | * Set only for RGB formats. */ |
| 150 | GraphicsMetadata graphics_metadata; |
Saurabh Shah | 5daeee5 | 2013-01-23 16:52:26 +0800 | [diff] [blame] | 151 | }; |
Ramkumar Radhakrishnan | 47573e2 | 2012-11-07 11:36:41 -0800 | [diff] [blame] | 152 | |
Shuzhen Wang | f3529c3 | 2014-01-28 17:15:45 -0800 | [diff] [blame] | 153 | enum DispParamType { |
Mohan Pallaka | 5d81443 | 2018-08-01 10:40:13 -0700 | [diff] [blame] | 154 | SET_VT_TIMESTAMP = 0x0001, |
| 155 | COLOR_METADATA = 0x0002, |
| 156 | PP_PARAM_INTERLACED = 0x0004, |
| 157 | SET_VIDEO_PERF_MODE = 0x0008, |
| 158 | SET_GRAPHICS_METADATA = 0x0010, |
| 159 | SET_UNUSED = 0x0020, |
| 160 | SET_UBWC_CR_STATS_INFO = 0x0040, |
| 161 | UPDATE_BUFFER_GEOMETRY = 0x0080, |
| 162 | UPDATE_REFRESH_RATE = 0x0100, |
| 163 | UPDATE_COLOR_SPACE = 0x0200, |
| 164 | MAP_SECURE_BUFFER = 0x0400, |
| 165 | S3D_FORMAT = 0x0800, |
| 166 | LINEAR_FORMAT = 0x1000, |
| 167 | SET_IGC = 0x2000, |
| 168 | SET_SINGLE_BUFFER_MODE = 0x4000, |
| 169 | SET_S3D_COMP = 0x8000, |
Shuzhen Wang | f3529c3 | 2014-01-28 17:15:45 -0800 | [diff] [blame] | 170 | }; |
Ramkumar Radhakrishnan | 47573e2 | 2012-11-07 11:36:41 -0800 | [diff] [blame] | 171 | |
feifanz | 9cc2303 | 2016-03-23 18:48:56 +0800 | [diff] [blame] | 172 | enum DispFetchParamType { |
Mohan Pallaka | 5d81443 | 2018-08-01 10:40:13 -0700 | [diff] [blame] | 173 | GET_VT_TIMESTAMP = 0x0001, |
| 174 | GET_COLOR_METADATA = 0x0002, |
| 175 | GET_PP_PARAM_INTERLACED = 0x0004, |
| 176 | GET_VIDEO_PERF_MODE = 0x0008, |
| 177 | GET_GRAPHICS_METADATA = 0x0010, |
| 178 | GET_UNUSED = 0X0020, |
| 179 | GET_UBWC_CR_STATS_INFO = 0x0040, |
| 180 | GET_BUFFER_GEOMETRY = 0x0080, |
| 181 | GET_REFRESH_RATE = 0x0100, |
| 182 | GET_COLOR_SPACE = 0x0200, |
| 183 | GET_MAP_SECURE_BUFFER = 0x0400, |
| 184 | GET_S3D_FORMAT = 0x0800, |
| 185 | GET_LINEAR_FORMAT = 0x1000, |
| 186 | GET_IGC = 0x2000, |
| 187 | GET_SINGLE_BUFFER_MODE = 0x4000, |
| 188 | GET_S3D_COMP = 0x8000, |
feifanz | 9cc2303 | 2016-03-23 18:48:56 +0800 | [diff] [blame] | 189 | }; |
| 190 | |
Shuzhen Wang | f3529c3 | 2014-01-28 17:15:45 -0800 | [diff] [blame] | 191 | struct private_handle_t; |
| 192 | int setMetaData(struct private_handle_t *handle, enum DispParamType paramType, |
Naseer Ahmed | 2e6bee1 | 2017-04-13 22:45:54 -0400 | [diff] [blame] | 193 | void *param); |
| 194 | int setMetaDataVa(struct MetaData_t* data, enum DispParamType paramType, |
| 195 | void *param); |
Shuzhen Wang | f3529c3 | 2014-01-28 17:15:45 -0800 | [diff] [blame] | 196 | |
Naseer Ahmed | 2e6bee1 | 2017-04-13 22:45:54 -0400 | [diff] [blame] | 197 | int getMetaData(struct private_handle_t *handle, |
| 198 | enum DispFetchParamType paramType, |
| 199 | void *param); |
| 200 | int getMetaDataVa(struct MetaData_t* data, enum DispFetchParamType paramType, |
| 201 | void *param); |
feifanz | 9cc2303 | 2016-03-23 18:48:56 +0800 | [diff] [blame] | 202 | |
| 203 | int copyMetaData(struct private_handle_t *src, struct private_handle_t *dst); |
Naseer Ahmed | 2e6bee1 | 2017-04-13 22:45:54 -0400 | [diff] [blame] | 204 | int copyMetaDataVaToHandle(struct MetaData_t *src, struct private_handle_t *dst); |
| 205 | int copyMetaDataHandleToVa(struct private_handle_t* src, struct MetaData_t *dst); |
| 206 | int copyMetaDataVaToVa(struct MetaData_t *src, struct MetaData_t *dst); |
Ray Zhang | 8ace84d | 2016-08-08 19:36:03 +0800 | [diff] [blame] | 207 | |
| 208 | int clearMetaData(struct private_handle_t *handle, enum DispParamType paramType); |
Naseer Ahmed | 2e6bee1 | 2017-04-13 22:45:54 -0400 | [diff] [blame] | 209 | int clearMetaDataVa(struct MetaData_t *data, enum DispParamType paramType); |
| 210 | |
| 211 | unsigned long getMetaDataSize(); |
Ray Zhang | 8ace84d | 2016-08-08 19:36:03 +0800 | [diff] [blame] | 212 | |
Shuzhen Wang | f3529c3 | 2014-01-28 17:15:45 -0800 | [diff] [blame] | 213 | #ifdef __cplusplus |
| 214 | } |
| 215 | #endif |
Ramkumar Radhakrishnan | 47573e2 | 2012-11-07 11:36:41 -0800 | [diff] [blame] | 216 | |
| 217 | #endif /* _QDMETADATA_H */ |
| 218 | |