1 /* 2 * Copyright (c) 2011-2016, The Linux Foundation. All rights reserved. 3 * 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 23 #include "gr_priv_handle.h" 24 25 #define ROUND_UP_PAGESIZE(x) ((((unsigned int)(x)) + PAGE_SIZE - 1) & (~(PAGE_SIZE - 1))) 26 27 /* Gralloc usage bits indicating the type of allocation that should be used */ 28 /* Refer gralloc1_producer_usage_t & gralloc1_consumer_usage-t in gralloc1.h */ 29 30 /* GRALLOC_USAGE_PRIVATE_0 is unused */ 31 32 /* Non linear, Universal Bandwidth Compression */ 33 #define GRALLOC1_PRODUCER_USAGE_PRIVATE_ALLOC_UBWC GRALLOC1_PRODUCER_USAGE_PRIVATE_1 34 35 /* IOMMU heap comes from manually allocated pages, can be cached/uncached, is not secured */ 36 #define GRALLOC1_PRODUCER_USAGE_PRIVATE_IOMMU_HEAP GRALLOC1_PRODUCER_USAGE_PRIVATE_2 37 38 /* MM heap is a carveout heap for video, can be secured */ 39 #define GRALLOC1_PRODUCER_USAGE_PRIVATE_MM_HEAP GRALLOC1_PRODUCER_USAGE_PRIVATE_3 40 41 /* ADSP heap is a carveout heap, is not secured */ 42 #define GRALLOC1_PRODUCER_USAGE_PRIVATE_ADSP_HEAP GRALLOC1_PRODUCER_USAGE_PRIVATE_4 43 44 /* CAMERA heap is a carveout heap for camera, is not secured */ 45 #define GRALLOC1_PRODUCER_USAGE_PRIVATE_CAMERA_HEAP GRALLOC1_PRODUCER_USAGE_PRIVATE_5 46 47 /* Set this for allocating uncached memory (using O_DSYNC), 48 * cannot be used with noncontiguous heaps */ 49 #define GRALLOC1_PRODUCER_USAGE_PRIVATE_UNCACHED GRALLOC1_PRODUCER_USAGE_PRIVATE_6 50 51 #define GRALLOC1_PRODUCER_USAGE_PRIVATE_CAMERA_ZSL GRALLOC1_PRODUCER_USAGE_PRIVATE_7 52 53 /* Buffer content should be displayed on a primary display only */ 54 #define GRALLOC1_CONSUMER_USAGE_PRIVATE_INTERNAL_ONLY GRALLOC1_CONSUMER_USAGE_PRIVATE_1 55 56 /* Buffer content should be displayed on an external display only */ 57 #define GRALLOC1_CONSUMER_USAGE_PRIVATE_EXTERNAL_ONLY GRALLOC1_CONSUMER_USAGE_PRIVATE_2 58 59 /* This flag is set for WFD usecase */ 60 #define GRALLOC1_CONSUMER_USAGE_PRIVATE_WFD GRALLOC1_CONSUMER_USAGE_PRIVATE_3 61 62 /* This flag is used for SECURE display usecase */ 63 #define GRALLOC1_CONSUMER_USAGE_PRIVATE_SECURE_DISPLAY GRALLOC1_CONSUMER_USAGE_PRIVATE_4 64 65 // for PERFORM API : 66 // TODO(user): Move it to enum if it's ookay for gfx 67 #define GRALLOC_MODULE_PERFORM_CREATE_HANDLE_FROM_BUFFER 1 68 #define GRALLOC_MODULE_PERFORM_GET_STRIDE 2 69 #define GRALLOC_MODULE_PERFORM_GET_CUSTOM_STRIDE_FROM_HANDLE 3 70 #define GRALLOC_MODULE_PERFORM_GET_CUSTOM_STRIDE_AND_HEIGHT_FROM_HANDLE 4 71 #define GRALLOC_MODULE_PERFORM_GET_ATTRIBUTES 5 72 #define GRALLOC_MODULE_PERFORM_GET_COLOR_SPACE_FROM_HANDLE 6 73 #define GRALLOC_MODULE_PERFORM_GET_YUV_PLANE_INFO 7 74 #define GRALLOC_MODULE_PERFORM_GET_MAP_SECURE_BUFFER_INFO 8 75 #define GRALLOC_MODULE_PERFORM_GET_UBWC_FLAG 9 76 #define GRALLOC_MODULE_PERFORM_GET_RGB_DATA_ADDRESS 10 77 #define GRALLOC_MODULE_PERFORM_GET_IGC 11 78 #define GRALLOC_MODULE_PERFORM_SET_IGC 12 79 #define GRALLOC_MODULE_PERFORM_SET_SINGLE_BUFFER_MODE 13 80 81 // OEM specific HAL formats 82 #define HAL_PIXEL_FORMAT_RGBA_5551 6 83 #define HAL_PIXEL_FORMAT_RGBA_4444 7 84 #define HAL_PIXEL_FORMAT_NV12_ENCODEABLE 0x102 85 #define HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS 0x7FA30C04 86 #define HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED 0x7FA30C03 87 #define HAL_PIXEL_FORMAT_YCbCr_420_SP 0x109 88 #define HAL_PIXEL_FORMAT_YCrCb_420_SP_ADRENO 0x7FA30C01 89 #define HAL_PIXEL_FORMAT_YCrCb_422_SP 0x10B 90 #define HAL_PIXEL_FORMAT_R_8 0x10D 91 #define HAL_PIXEL_FORMAT_RG_88 0x10E 92 #define HAL_PIXEL_FORMAT_YCbCr_444_SP 0x10F 93 #define HAL_PIXEL_FORMAT_YCrCb_444_SP 0x110 94 #define HAL_PIXEL_FORMAT_YCrCb_422_I 0x111 95 #define HAL_PIXEL_FORMAT_BGRX_8888 0x112 96 #define HAL_PIXEL_FORMAT_NV21_ZSL 0x113 97 #define HAL_PIXEL_FORMAT_YCrCb_420_SP_VENUS 0x114 98 #define HAL_PIXEL_FORMAT_BGR_565 0x115 99 100 // 10 bit 101 #define HAL_PIXEL_FORMAT_RGBA_1010102 0x116 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 109 #define HAL_PIXEL_FORMAT_YCbCr_420_P010 0x11F 110 #define HAL_PIXEL_FORMAT_YCbCr_420_TP10_UBWC 0x120 111 112 #define HAL_PIXEL_FORMAT_INTERLACE 0x180 113 114 // v4l2_fourcc('Y', 'U', 'Y', 'L'). 24 bpp YUYV 4:2:2 10 bit per component 115 #define HAL_PIXEL_FORMAT_YCbCr_422_I_10BIT 0x4C595559 116 117 // v4l2_fourcc('Y', 'B', 'W', 'C'). 10 bit per component. This compressed 118 // format reduces the memory access bandwidth 119 #define HAL_PIXEL_FORMAT_YCbCr_422_I_10BIT_COMPRESSED 0x43574259 120 121 // UBWC aligned Venus format 122 #define HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS_UBWC 0x7FA30C06 123 124 // Khronos ASTC formats 125 #define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 126 #define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1 127 #define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2 128 #define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3 129 #define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4 130 #define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5 131 #define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6 132 #define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7 133 #define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8 134 #define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9 135 #define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA 136 #define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB 137 #define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC 138 #define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD 139 #define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0 140 #define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1 141 #define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2 142 #define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3 143 #define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4 144 #define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5 145 #define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6 146 #define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7 147 #define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8 148 #define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9 149 #define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA 150 #define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB 151 #define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC 152 #define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD 153 154 /* possible values for inverse gamma correction */ 155 #define HAL_IGC_NOT_SPECIFIED 0 156 #define HAL_IGC_s_RGB 1 157 158 /* possible formats for 3D content*/ 159 enum { 160 HAL_NO_3D = 0x0, 161 HAL_3D_SIDE_BY_SIDE_L_R = 0x1, 162 HAL_3D_SIDE_BY_SIDE_R_L = 0x2, 163 HAL_3D_TOP_BOTTOM = 0x4, 164 HAL_3D_IN_SIDE_BY_SIDE_L_R = 0x10000, // unused legacy format 165 }; 166 167 enum { BUFFER_TYPE_UI = 0, BUFFER_TYPE_VIDEO }; 168 169 #endif // __GRALLOC_PRIV_H__ 170