blob: 77c8787e52ba65b6b784ef560448232b2de13838 [file] [log] [blame]
Prabhanjan Kandula96e92342016-03-24 21:03:35 +05301/*
Tharaga Balachandraned245fe2020-01-21 18:20:02 -05002 * Copyright (c) 2011-2020, The Linux Foundation. All rights reserved.
Prabhanjan Kandula96e92342016-03-24 21:03:35 +05303 * Not a Contribution
4 *
5 * Copyright (C) 2008 The Android Open Source Project
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19
20#ifndef __GRALLOC_PRIV_H__
21#define __GRALLOC_PRIV_H__
22
Soumil Shah345ae292018-02-02 10:37:24 -080023#include <errno.h>
Dileep Marchya5b4eaed2016-09-22 12:31:11 +053024#include <unistd.h>
Tharaga Balachandrana069a7e2020-01-08 17:22:12 -050025
26#include "QtiGrallocDefs.h"
Prabhanjan Kandula96e92342016-03-24 21:03:35 +053027#include "gr_priv_handle.h"
28
Tharaga Balachandrana069a7e2020-01-08 17:22:12 -050029#pragma message "Warning: gralloc_priv.h is deprecated"
30
Uday Kiran Pichika89c36f42018-03-08 20:57:56 +053031#define GRALLOC_PROP_PREFIX "vendor.gralloc."
32#define GRALLOC_PROP(prop_name) GRALLOC_PROP_PREFIX prop_name
33
34#define DISABLE_UBWC_PROP GRALLOC_PROP("disable_ubwc")
Mohan Pallakaeb982e52018-09-14 12:10:57 -070035#define DISABLE_AHARDWAREBUFFER_PROP GRALLOC_PROP("disable_ahardware_buffer")
Uday Kiran Pichika89c36f42018-03-08 20:57:56 +053036#define ENABLE_FB_UBWC_PROP GRALLOC_PROP("enable_fb_ubwc")
37#define MAP_FB_MEMORY_PROP GRALLOC_PROP("map_fb_memory")
Subash Chander001bc792018-07-09 18:48:08 +053038#define USE_SYSTEM_HEAP_FOR_SENSORS GRALLOC_PROP("use_system_heap_for_sensors")
Uday Kiran Pichika89c36f42018-03-08 20:57:56 +053039
Dileep Marchya5b4eaed2016-09-22 12:31:11 +053040#define ROUND_UP_PAGESIZE(x) roundUpToPageSize(x)
Naseer Ahmede69031e2016-11-22 20:05:16 -050041inline int roundUpToPageSize(int x) {
Naseer Ahmeda422f352017-12-01 15:33:56 -050042 return (x + (getpagesize() - 1)) & ~(getpagesize() - 1);
Dileep Marchya5b4eaed2016-09-22 12:31:11 +053043}
Prabhanjan Kandula96e92342016-03-24 21:03:35 +053044
Naseer Ahmeda422f352017-12-01 15:33:56 -050045/* Legacy gralloc1 definitions */
Naseer Ahmede69031e2016-11-22 20:05:16 -050046/* Some clients may still be using the old flags */
Naseer Ahmeda422f352017-12-01 15:33:56 -050047#define GRALLOC1_PRODUCER_USAGE_PRIVATE_ADSP_HEAP GRALLOC_USAGE_PRIVATE_ADSP_HEAP
48#define GRALLOC1_PRODUCER_USAGE_PRIVATE_ALLOC_UBWC GRALLOC_USAGE_PRIVATE_ALLOC_UBWC
49#define GRALLOC1_PRODUCER_USAGE_PRIVATE_UNCACHED GRALLOC_USAGE_PRIVATE_UNCACHED
50#define GRALLOC1_CONSUMER_USAGE_PRIVATE_SECURE_DISPLAY GRALLOC_USAGE_PRIVATE_SECURE_DISPLAY
51#define GRALLOC1_PRODUCER_USAGE_PRIVATE_MM_HEAP GRALLOC_USAGE_PRIVATE_MM_HEAP
52#define GRALLOC1_PRODUCER_USAGE_PRIVATE_10BIT GRALLOC_USAGE_PRIVATE_10BIT
53#define GRALLOC1_PRODUCER_USAGE_PRIVATE_10BIT_TP GRALLOC_USAGE_PRIVATE_10BIT_TP
54#define GRALLOC1_CONSUMER_USAGE_PRIVATE_10BIT_TP GRALLOC_USAGE_PRIVATE_10BIT_TP
Mohan Pallaka5d814432018-08-01 10:40:13 -070055#define GRALLOC1_PRODUCER_USAGE_PRIVATE_VIDEO_NV21_ENCODER GRALLOC_USAGE_PRIVATE_VIDEO_NV21_ENCODER
Prabhanjan Kandula96e92342016-03-24 21:03:35 +053056
57// for PERFORM API :
Prabhanjan Kandula96e92342016-03-24 21:03:35 +053058#define GRALLOC_MODULE_PERFORM_CREATE_HANDLE_FROM_BUFFER 1
59#define GRALLOC_MODULE_PERFORM_GET_STRIDE 2
60#define GRALLOC_MODULE_PERFORM_GET_CUSTOM_STRIDE_FROM_HANDLE 3
61#define GRALLOC_MODULE_PERFORM_GET_CUSTOM_STRIDE_AND_HEIGHT_FROM_HANDLE 4
62#define GRALLOC_MODULE_PERFORM_GET_ATTRIBUTES 5
63#define GRALLOC_MODULE_PERFORM_GET_COLOR_SPACE_FROM_HANDLE 6
64#define GRALLOC_MODULE_PERFORM_GET_YUV_PLANE_INFO 7
65#define GRALLOC_MODULE_PERFORM_GET_MAP_SECURE_BUFFER_INFO 8
66#define GRALLOC_MODULE_PERFORM_GET_UBWC_FLAG 9
67#define GRALLOC_MODULE_PERFORM_GET_RGB_DATA_ADDRESS 10
68#define GRALLOC_MODULE_PERFORM_GET_IGC 11
69#define GRALLOC_MODULE_PERFORM_SET_IGC 12
70#define GRALLOC_MODULE_PERFORM_SET_SINGLE_BUFFER_MODE 13
Naseer Ahmede69031e2016-11-22 20:05:16 -050071#define GRALLOC1_MODULE_PERFORM_GET_BUFFER_SIZE_AND_DIMENSIONS 14
Ramkumar Radhakrishnan4f12b502017-09-22 17:13:37 -070072#define GRALLOC1_MODULE_PERFORM_GET_INTERLACE_FLAG 15
Mohan Pallaka5d814432018-08-01 10:40:13 -070073#define GRALLOC_MODULE_PERFORM_GET_GRAPHICS_METADATA 16
Prabhanjan Kandula96e92342016-03-24 21:03:35 +053074
Prabhanjan Kandula96e92342016-03-24 21:03:35 +053075/* possible values for inverse gamma correction */
76#define HAL_IGC_NOT_SPECIFIED 0
77#define HAL_IGC_s_RGB 1
78
Arun Kumar K.Rc18263e2016-10-03 21:26:10 -070079/* Color Space: Values maps to ColorSpace_t in qdMetadata.h */
Naseer Ahmeda422f352017-12-01 15:33:56 -050080#define HAL_CSC_ITU_R_601 0
81#define HAL_CSC_ITU_R_601_FR 1
82#define HAL_CSC_ITU_R_709 2
83#define HAL_CSC_ITU_R_2020 3
84#define HAL_CSC_ITU_R_2020_FR 4
Arun Kumar K.Rc18263e2016-10-03 21:26:10 -070085
Prabhanjan Kandula96e92342016-03-24 21:03:35 +053086/* possible formats for 3D content*/
87enum {
88 HAL_NO_3D = 0x0,
89 HAL_3D_SIDE_BY_SIDE_L_R = 0x1,
90 HAL_3D_SIDE_BY_SIDE_R_L = 0x2,
91 HAL_3D_TOP_BOTTOM = 0x4,
92 HAL_3D_IN_SIDE_BY_SIDE_L_R = 0x10000, // unused legacy format
93};
94
Ashish Kumar453ab5c2019-05-27 22:43:03 +053095/* Flag to determine interlaced content
96 * Value maps to Flags presents in types.hal of QtiMapperextensions
97 */
98enum {
99 LAYOUT_INTERLACED_FLAG = 1 << 0,
100};
101
Prabhanjan Kandula96e92342016-03-24 21:03:35 +0530102#endif // __GRALLOC_PRIV_H__