blob: 93272dd3daeb682b98799493e3b24768e83d59c8 [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 __QTIGRALLOCDEFS_H__
31#define __QTIGRALLOCDEFS_H__
32
33// From gralloc_priv.h
34
35/* Gralloc usage bits indicating the type of allocation that should be used */
36/* Refer to BufferUsage in hardware/interfaces/graphics/common/<ver>/types.hal */
37
38/* The bits below are in officially defined vendor space
39 * i.e bits 28-31 and 48-63*/
40/* Non linear, Universal Bandwidth Compression */
41#define GRALLOC_USAGE_PRIVATE_ALLOC_UBWC (UINT32_C(1) << 28)
42
43/* Set this for allocating uncached memory (using O_DSYNC),
44 * cannot be used with noncontiguous heaps */
45#define GRALLOC_USAGE_PRIVATE_UNCACHED (UINT32_C(1) << 29)
46
47/* This flag is used to indicate 10 bit format.
48 * When both GRALLOC_USAGE_PRIVATE_ALLOC_UBWC & GRALLOC_USAGE_PRIVATE_10BIT
49 * are set then it will indicate UBWC_TP10 format.
50 * When only GRALLOC_USAGE_PRIVATE_10BIT is set it will indicate linear P010 format.
51 */
52#define GRALLOC_USAGE_PRIVATE_10BIT (UINT32_C(1) << 30)
53
54/* This flag is used for SECURE display usecase */
55#define GRALLOC_USAGE_PRIVATE_SECURE_DISPLAY (UINT32_C(1) << 31)
56
57/* This flag is used to indicate video NV21 format */
58#define GRALLOC_USAGE_PRIVATE_VIDEO_NV21_ENCODER 1ULL << 48
59
60/* unused legacy flags */
61#define GRALLOC_USAGE_PRIVATE_MM_HEAP 0
62#define GRALLOC_USAGE_PRIVATE_IOMMU_HEAP 0
63
64/* This flag is set for WFD usecase */
65#define GRALLOC_USAGE_PRIVATE_WFD 1ULL << 51
66
67/* This flag is set for HEIF usecase */
68#define GRALLOC_USAGE_PRIVATE_HEIF (UINT32_C(1) << 27)
69
70/* TODO(user): Remove when clients stop referencing this flag */
71#define GRALLOC_USAGE_PRIVATE_10BIT_TP 0
72
73/* This flag indicates PI format is being used */
74#define GRALLOC_USAGE_PRIVATE_ALLOC_UBWC_PI 1ULL << 49
75
76/* This flag is set while CDSP accesses the buffer */
77#define GRALLOC_USAGE_PRIVATE_CDSP 1ULL << 50
78
79// OEM specific HAL formats
80#define HAL_PIXEL_FORMAT_RGBA_5551 6
81#define HAL_PIXEL_FORMAT_RGBA_4444 7
82#define HAL_PIXEL_FORMAT_NV12_ENCODEABLE 0x102
83#define HAL_PIXEL_FORMAT_NV21_ENCODEABLE 0x7FA30C00
84#define HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS 0x7FA30C04
85#define HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED 0x7FA30C03
86#define HAL_PIXEL_FORMAT_YCbCr_420_SP 0x109
87#define HAL_PIXEL_FORMAT_YCrCb_420_SP_ADRENO 0x7FA30C01
88#define HAL_PIXEL_FORMAT_YCrCb_422_SP 0x10B
89#define HAL_PIXEL_FORMAT_R_8 0x10D
90#define HAL_PIXEL_FORMAT_RG_88 0x10E
91#define HAL_PIXEL_FORMAT_YCbCr_444_SP 0x10F
92#define HAL_PIXEL_FORMAT_YCrCb_444_SP 0x110
93#define HAL_PIXEL_FORMAT_YCrCb_422_I 0x111
94#define HAL_PIXEL_FORMAT_BGRX_8888 0x112
95#define HAL_PIXEL_FORMAT_NV21_ZSL 0x113
96#define HAL_PIXEL_FORMAT_YCrCb_420_SP_VENUS 0x114
97#define HAL_PIXEL_FORMAT_BGR_565 0x115
98#define HAL_PIXEL_FORMAT_RAW8 0x123
99#define HAL_PIXEL_FORMAT_NV12_HEIF 0x116
100
101// 10 bit
102#define HAL_PIXEL_FORMAT_ARGB_2101010 0x117
103#define HAL_PIXEL_FORMAT_RGBX_1010102 0x118
104#define HAL_PIXEL_FORMAT_XRGB_2101010 0x119
105#define HAL_PIXEL_FORMAT_BGRA_1010102 0x11A
106#define HAL_PIXEL_FORMAT_ABGR_2101010 0x11B
107#define HAL_PIXEL_FORMAT_BGRX_1010102 0x11C
108#define HAL_PIXEL_FORMAT_XBGR_2101010 0x11D
Dhruv Kaushikfcc2e6e2020-05-12 15:00:12 +0530109#define HAL_PIXEL_FORMAT_YCbCr_420_P010 0x36 // HAL_PIXEL_FORMAT_YCBCR_P010
Tharaga Balachandrana069a7e2020-01-08 17:22:12 -0500110#define HAL_PIXEL_FORMAT_YCbCr_420_P010_UBWC 0x124
111#define HAL_PIXEL_FORMAT_YCbCr_420_P010_VENUS 0x7FA30C0A
112
113#define HAL_PIXEL_FORMAT_CbYCrY_422_I 0x120
114#define HAL_PIXEL_FORMAT_BGR_888 0x121
115
116#define HAL_PIXEL_FORMAT_INTERLACE 0x180
117
118// Camera utils format
119#define HAL_PIXEL_FORMAT_NV12_LINEAR_FLEX 0x125
120#define HAL_PIXEL_FORMAT_NV12_UBWC_FLEX 0x126
121#define HAL_PIXEL_FORMAT_MULTIPLANAR_FLEX 0x127
Arun Kumar K.Ra6ab9d12020-04-01 11:10:14 +0530122#define HAL_PIXEL_FORMAT_NV12_UBWC_FLEX_2_BATCH 0x128
123#define HAL_PIXEL_FORMAT_NV12_UBWC_FLEX_4_BATCH 0x129
124#define HAL_PIXEL_FORMAT_NV12_UBWC_FLEX_8_BATCH 0x130
Tharaga Balachandrana069a7e2020-01-08 17:22:12 -0500125
126// v4l2_fourcc('Y', 'U', 'Y', 'L'). 24 bpp YUYV 4:2:2 10 bit per component
127#define HAL_PIXEL_FORMAT_YCbCr_422_I_10BIT 0x4C595559
128
129// v4l2_fourcc('Y', 'B', 'W', 'C'). 10 bit per component. This compressed
130// format reduces the memory access bandwidth
131#define HAL_PIXEL_FORMAT_YCbCr_422_I_10BIT_COMPRESSED 0x43574259
132
133// UBWC aligned Venus format
134#define HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS_UBWC 0x7FA30C06
135#define HAL_PIXEL_FORMAT_YCbCr_420_TP10_UBWC 0x7FA30C09
136
137// Khronos ASTC formats
138#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0
139#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1
140#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2
141#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3
142#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4
143#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5
144#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6
145#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7
146#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8
147#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9
148#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA
149#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB
150#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC
151#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD
152#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0
153#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1
154#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2
155#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3
156#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4
157#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5
158#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6
159#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7
160#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8
161#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9
162#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA
163#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB
164#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC
165#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD
166
167enum { BUFFER_TYPE_UI = 0, BUFFER_TYPE_VIDEO };
168
Arun Kumar K.Ra6ab9d12020-04-01 11:10:14 +0530169#endif //__QTIGRALLOCDEFS_H__