blob: 35d51dcc0a05c7a506c3f0e5a01db21fbe4ca360 [file] [log] [blame]
Tharaga Balachandrana069a7e2020-01-08 17:22:12 -05001/*
2 * Copyright (c) 2020 The Linux Foundation. All rights reserved.
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 __QTIGRALLOCMETADATA_H__
31#define __QTIGRALLOCMETADATA_H__
32
33#include <color_metadata.h>
34#define QTI_VT_TIMESTAMP 10000
35#define QTI_COLOR_METADATA 10001
36#define QTI_PP_PARAM_INTERLACED 10002
37#define QTI_VIDEO_PERF_MODE 10003
38#define QTI_GRAPHICS_METADATA 10004
39#define QTI_UBWC_CR_STATS_INFO 10005
40#define QTI_REFRESH_RATE 10006
41#define QTI_MAP_SECURE_BUFFER 10007
42#define QTI_LINEAR_FORMAT 10008
43#define QTI_SINGLE_BUFFER_MODE 10009
44#define QTI_CVP_METADATA 10010
45#define QTI_VIDEO_HISTOGRAM_STATS 10011
46#define QTI_FD 10012
47#define QTI_PRIVATE_FLAGS 10013
48
49// Used to indicate to framework that internal definitions are used instead
50#define COMPRESSION_QTI_UBWC 20001
51#define INTERLACED_QTI 20002
52
53#define PLANE_COMPONENT_TYPE_RAW 20003
54#define PLANE_COMPONENT_TYPE_META 20004
55
56#define MAX_NAME_LEN 256
57
58// GRAPHICS_METADATA
59#define GRAPHICS_METADATA_SIZE 4096
60typedef struct GraphicsMetadata {
61 uint32_t size;
62 uint32_t data[GRAPHICS_METADATA_SIZE];
63} GraphicsMetadata;
64
65// UBWC_CR_STATS_INFO
66#define MAX_UBWC_STATS_LENGTH 32
67enum UBWC_Version {
68 UBWC_UNUSED = 0,
69 UBWC_1_0 = 0x1,
70 UBWC_2_0 = 0x2,
71 UBWC_3_0 = 0x3,
72 UBWC_4_0 = 0x4,
73 UBWC_MAX_VERSION = 0xFF,
74};
75
76struct 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
86struct 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
98#define UBWC_STATS_ARRAY_SIZE 2
99struct CropRectangle_t {
100 int32_t left;
101 int32_t top;
102 int32_t right;
103 int32_t bottom;
104};
105
106// CVP_METADATA
107#define CVP_METADATA_SIZE 1024
108enum CVPMetadataFlags {
109 /* bit wise flags */
110 CVP_METADATA_FLAG_NONE = 0x00000000,
111 CVP_METADATA_FLAG_REPEAT = 0x00000001,
112};
113
114typedef struct CVPMetadata {
115 uint32_t size; /* payload size in bytes */
116 uint8_t payload[CVP_METADATA_SIZE];
117 uint32_t capture_frame_rate;
118 /* Frame rate in Q16 format.
119 Eg: fps = 7.5, then
120 capture_frame_rate = 7 << 16 --> Upper 16 bits to represent 7
121 capture_frame_rate |= 5 -------> Lower 16 bits to represent 5
122
123 If size > 0, framerate is valid
124 If size = 0, invalid data, so ignore all parameters */
125 uint32_t cvp_frame_rate;
126 enum CVPMetadataFlags flags;
127 uint32_t reserved[8];
128} CVPMetadata;
129
130// VIDEO_HISTOGRAM_STATS
131
132#define VIDEO_HISTOGRAM_STATS_SIZE (4 * 1024)
133struct VideoHistogramMetadata {
134 uint32_t stats_info[1024]; /* video stats payload */
135 uint32_t stat_len; /* Payload size in bytes */
136 uint32_t frame_type; /* bit mask to indicate frame type */
137 uint32_t display_width;
138 uint32_t display_height;
139 uint32_t decode_width;
140 uint32_t decode_height;
141 uint32_t reserved[12];
142};
143
144#define RESERVED_REGION_SIZE 4096
145typedef struct ReservedRegion {
146 uint32_t size;
147 uint8_t data[RESERVED_REGION_SIZE];
148} ReservedRegion;
149
150#endif //__QTIGRALLOCMETADATA_H__