1 // clang-format off 2 /* 3 * (C) COPYRIGHT 2017 ARM Limited. All rights reserved. 4 * Copyright (C) 2008 The Android Open Source Project 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 #ifndef MALI_GRALLOC_USAGES_H_ 20 #define MALI_GRALLOC_USAGES_H_ 21 22 /* 23 * Below usage types overlap, this is intentional. 24 * The reason is that for Gralloc 0.3 there are very 25 * few usage flags we have at our disposal. 26 * 27 * The overlapping is handled by processing the definitions 28 * in a specific order. 29 * 30 * MALI_GRALLOC_USAGE_PRIVATE_FORMAT and MALI_GRALLOC_USAGE_NO_AFBC 31 * don't overlap and are processed first. 32 * 33 * MALI_GRALLOC_USAGE_YUV_CONF are only for YUV formats and clients 34 * using MALI_GRALLOC_USAGE_NO_AFBC must never allocate YUV formats. 35 * The latter is strictly enforced and allocations will fail. 36 * 37 * MALI_GRALLOC_USAGE_AFBC_PADDING is only valid if MALI_GRALLOC_USAGE_NO_AFBC 38 * is not present. 39 */ 40 41 /* 42 * Gralloc private usage 0-3 are the same in 0.3 and 1.0. 43 * We defined based our usages based on what is available. 44 */ 45 #if defined(GRALLOC_MODULE_API_VERSION_1_0) 46 typedef enum 47 { 48 /* The client has specified a private format in the format parameter */ 49 MALI_GRALLOC_USAGE_PRIVATE_FORMAT = (int)GRALLOC1_PRODUCER_USAGE_PRIVATE_3, 50 51 /* Buffer won't be allocated as AFBC */ 52 MALI_GRALLOC_USAGE_NO_AFBC = (int)(GRALLOC1_PRODUCER_USAGE_PRIVATE_1 | GRALLOC1_PRODUCER_USAGE_PRIVATE_2), 53 54 /* Valid only for YUV allocations */ 55 MALI_GRALLOC_USAGE_YUV_CONF_0 = 0, 56 MALI_GRALLOC_USAGE_YUV_CONF_1 = (int)GRALLOC1_PRODUCER_USAGE_PRIVATE_1, 57 MALI_GRALLOC_USAGE_YUV_CONF_2 = (int)GRALLOC1_PRODUCER_USAGE_PRIVATE_0, 58 MALI_GRALLOC_USAGE_YUV_CONF_3 = (int)(GRALLOC1_PRODUCER_USAGE_PRIVATE_0 | GRALLOC1_PRODUCER_USAGE_PRIVATE_1), 59 MALI_GRALLOC_USAGE_YUV_CONF_MASK = MALI_GRALLOC_USAGE_YUV_CONF_3, 60 61 /* A very specific alignment is requested on some buffers */ 62 MALI_GRALLOC_USAGE_AFBC_PADDING = (int)GRALLOC1_PRODUCER_USAGE_PRIVATE_2, 63 64 } mali_gralloc_usage_type; 65 #elif defined(GRALLOC_MODULE_API_VERSION_0_3) 66 typedef enum 67 { 68 /* The client has specified a private format in the format parameter */ 69 MALI_GRALLOC_USAGE_PRIVATE_FORMAT = (int)GRALLOC_USAGE_PRIVATE_3, 70 71 /* Buffer won't be allocated as AFBC */ 72 MALI_GRALLOC_USAGE_NO_AFBC = (int)(GRALLOC_USAGE_PRIVATE_1 | GRALLOC_USAGE_PRIVATE_2), 73 74 /* Valid only for YUV allocations */ 75 MALI_GRALLOC_USAGE_YUV_CONF_0 = 0, 76 MALI_GRALLOC_USAGE_YUV_CONF_1 = (int)GRALLOC_USAGE_PRIVATE_1, 77 MALI_GRALLOC_USAGE_YUV_CONF_2 = (int)GRALLOC_USAGE_PRIVATE_0, 78 MALI_GRALLOC_USAGE_YUV_CONF_3 = (int)(GRALLOC_USAGE_PRIVATE_0 | GRALLOC_USAGE_PRIVATE_1), 79 MALI_GRALLOC_USAGE_YUV_CONF_MASK = MALI_GRALLOC_USAGE_YUV_CONF_3, 80 81 /* A very specific alignment is requested on some buffers */ 82 MALI_GRALLOC_USAGE_AFBC_PADDING = GRALLOC_USAGE_PRIVATE_2, 83 84 } mali_gralloc_usage_type; 85 #else 86 #if defined(GRALLOC_LIBRARY_BUILD) 87 #error "Please include mali_gralloc_module.h before including other gralloc headers when building gralloc itself" 88 #else 89 #error "Please include either gralloc.h or gralloc1.h header before including gralloc_priv.h" 90 #endif 91 #endif 92 93 #endif /*MALI_GRALLOC_USAGES_H_*/ 94 // clang-format on 95