diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-10-21 03:20:46 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-10-21 03:20:46 +0000 |
commit | 07f990cec3a355d88d93cca93b9368e972a9b244 (patch) | |
tree | 775e93ba9f12424a190167654f96aa6e7a5bfa98 | |
parent | 0ae720253456a97a2faebfc7aa63bda1773aae0d (diff) | |
parent | ab7b4b8606cbd78b1b770493fcd217a0d1afb12c (diff) | |
download | gchips-07f990cec3a355d88d93cca93b9368e972a9b244.tar.gz |
Snap for 10985023 from ab7b4b8606cbd78b1b770493fcd217a0d1afb12c to 24Q1-release
Change-Id: I80b553ad8521c04ffc35bac524e2e4d5fcc6c035
-rw-r--r-- | gralloc4/src/Android.bp | 71 | ||||
-rw-r--r-- | gralloc4/src/aidl/Android.bp | 4 | ||||
-rw-r--r-- | gralloc4/src/allocator/mali_gralloc_ion.cpp | 12 | ||||
-rw-r--r-- | gralloc4/src/allocator/mali_gralloc_ion.h | 2 | ||||
-rw-r--r-- | gralloc4/src/core/mali_gralloc_bufferallocation.cpp | 4 | ||||
-rw-r--r-- | gralloc4/src/core/mali_gralloc_bufferallocation.h | 2 | ||||
-rw-r--r-- | gralloc4/src/hidl_common/Allocator.cpp | 13 | ||||
-rw-r--r-- | gralloc4/src/libGralloc4Wrapper/include/gralloc4/gralloc_vendor_interface.h | 50 | ||||
-rw-r--r-- | gralloc4/src/libGralloc4Wrapper/wrapper.cpp | 218 | ||||
-rw-r--r-- | gralloc4/src/mali_gralloc_buffer.h | 13 | ||||
-rw-r--r-- | gralloc4/src/mali_gralloc_usages.h | 7 |
11 files changed, 50 insertions, 346 deletions
diff --git a/gralloc4/src/Android.bp b/gralloc4/src/Android.bp index 4109439..1f640ea 100644 --- a/gralloc4/src/Android.bp +++ b/gralloc4/src/Android.bp @@ -1,4 +1,3 @@ - /* * Copyright (C) 2020 Arm Limited. * SPDX-License-Identifier: Apache-2.0 @@ -21,62 +20,16 @@ package { } cc_library_headers { - name: "libgralloc_headers", - vendor: true, - host_supported: true, - export_include_dirs: [ - ".", - ], - header_libs: [ - "libsystem_headers", - ], - export_header_lib_headers: [ - "libsystem_headers", - ], -} - -cc_library_shared { - name: "libGralloc4Wrapper", - vendor: true, - defaults: [ - "arm_gralloc_defaults", - "android.hardware.graphics.common-ndk_shared", - ], - srcs: [ - "libGralloc4Wrapper/wrapper.cpp", - "allocator/mali_gralloc_ion.cpp", - "core/format_info.cpp", - "core/mali_gralloc_formats.cpp", - "core/mali_gralloc_bufferallocation.cpp", - "core/mali_gralloc_bufferdescriptor.cpp", - "core/mali_gralloc_reference.cpp", - ":libgralloc_hidl_common_shared_metadata", - ], - cflags: [ - "-DGRALLOC_LIBRARY_BUILD=1", - "-Wthread-safety", - ], - static_libs: [ - "libgralloc_capabilities", - ], - shared_libs: [ - "liblog", - "libcutils", - "libutils", - "libsync", - "libhardware", - "libhidlbase", - "libhidltransport", - "libnativewindow", - "android.hardware.graphics.common@1.2", - "android.hardware.graphics.mapper@4.0", - "libdmabufheap", - "libgralloctypes", - "libdrm", - ], - header_libs: [ - "google_hal_headers", - "device_kernel_headers", - ], - export_include_dirs: ["libGralloc4Wrapper/include"] + name: "libgralloc_headers", + vendor: true, + export_include_dirs: [ + ".", + ], + header_libs: [ + "libsystem_headers", + "//hardware/google/graphics/common:pixel-gralloc-headers", + ], + export_header_lib_headers: [ + "libsystem_headers", + ], } diff --git a/gralloc4/src/aidl/Android.bp b/gralloc4/src/aidl/Android.bp index e2d9d04..71c6a38 100644 --- a/gralloc4/src/aidl/Android.bp +++ b/gralloc4/src/aidl/Android.bp @@ -9,6 +9,9 @@ cc_library_shared { defaults: [ "arm_gralloc_api_4x_defaults", ], + header_libs: [ + "pixel-gralloc-headers", + ], shared_libs: [ "android.hardware.graphics.allocator-V1-ndk", "android.hardware.graphics.allocator@4.0", @@ -27,4 +30,3 @@ cc_library_shared { "hardware/google/gchips/include", ], } - diff --git a/gralloc4/src/allocator/mali_gralloc_ion.cpp b/gralloc4/src/allocator/mali_gralloc_ion.cpp index 85409d7..f4ab5f0 100644 --- a/gralloc4/src/allocator/mali_gralloc_ion.cpp +++ b/gralloc4/src/allocator/mali_gralloc_ion.cpp @@ -352,7 +352,7 @@ int mali_gralloc_ion_allocate_attr(private_handle_t *hnd) */ int mali_gralloc_ion_allocate(const gralloc_buffer_descriptor_t *descriptors, uint32_t numDescriptors, buffer_handle_t *pHandle, - bool *shared_backend, int ion_fd) + bool *shared_backend, bool is_dry) { ATRACE_CALL(); GRALLOC_UNUSED(shared_backend); @@ -375,7 +375,7 @@ int mali_gralloc_ion_allocate(const gralloc_buffer_descriptor_t *descriptors, nullptr, bufDescriptor->fd_count, bufDescriptor->hal_format, bufDescriptor->alloc_format, bufDescriptor->width, bufDescriptor->height, bufDescriptor->pixel_stride, - bufDescriptor->layer_count, bufDescriptor->plane_info); + bufDescriptor->layer_count, bufDescriptor->plane_info, is_dry); /* Reset the number of valid filedescriptors, we will increment * it each time a valid fd is added, so we can rely on the @@ -391,16 +391,13 @@ int mali_gralloc_ion_allocate(const gralloc_buffer_descriptor_t *descriptors, pHandle[i] = hnd; usage = bufDescriptor->consumer_usage | bufDescriptor->producer_usage; + if (is_dry) continue; for (uint32_t fidx = 0; fidx < bufDescriptor->fd_count; fidx++) { int& fd = hnd->fds[fidx]; - if (ion_fd >= 0 && fidx == 0) { - fd = ion_fd; - } else { - fd = alloc_from_dmabuf_heap(usage, bufDescriptor->alloc_sizes[fidx], bufDescriptor->name); - } + fd = alloc_from_dmabuf_heap(usage, bufDescriptor->alloc_sizes[fidx], bufDescriptor->name); if (fd < 0) { @@ -412,6 +409,7 @@ int mali_gralloc_ion_allocate(const gralloc_buffer_descriptor_t *descriptors, hnd->incr_numfds(1); } } + if(is_dry) return 0; #if defined(GRALLOC_INIT_AFBC) && (GRALLOC_INIT_AFBC == 1) ATRACE_NAME("AFBC init block"); diff --git a/gralloc4/src/allocator/mali_gralloc_ion.h b/gralloc4/src/allocator/mali_gralloc_ion.h index d826650..ae1d37b 100644 --- a/gralloc4/src/allocator/mali_gralloc_ion.h +++ b/gralloc4/src/allocator/mali_gralloc_ion.h @@ -24,7 +24,7 @@ int mali_gralloc_ion_allocate_attr(private_handle_t *hnd); int mali_gralloc_ion_allocate(const gralloc_buffer_descriptor_t *descriptors, uint32_t numDescriptors, buffer_handle_t *pHandle, bool *alloc_from_backing_store, - int ion_fd = -1); + bool is_dry=false); void mali_gralloc_ion_free(private_handle_t * const hnd); int mali_gralloc_ion_sync_start(const private_handle_t * const hnd, const bool read, const bool write); diff --git a/gralloc4/src/core/mali_gralloc_bufferallocation.cpp b/gralloc4/src/core/mali_gralloc_bufferallocation.cpp index 29e3092..d25354e 100644 --- a/gralloc4/src/core/mali_gralloc_bufferallocation.cpp +++ b/gralloc4/src/core/mali_gralloc_bufferallocation.cpp @@ -1163,7 +1163,7 @@ int mali_gralloc_derive_format_and_size(buffer_descriptor_t * const bufDescripto int mali_gralloc_buffer_allocate(const gralloc_buffer_descriptor_t *descriptors, uint32_t numDescriptors, buffer_handle_t *pHandle, bool *shared_backend, - int fd) + bool is_dry) { std::string atrace_log = __FUNCTION__; if (ATRACE_ENABLED()) { @@ -1202,7 +1202,7 @@ int mali_gralloc_buffer_allocate(const gralloc_buffer_descriptor_t *descriptors, } /* Allocate ION backing store memory */ - err = mali_gralloc_ion_allocate(descriptors, numDescriptors, pHandle, &shared, fd); + err = mali_gralloc_ion_allocate(descriptors, numDescriptors, pHandle, &shared, is_dry); if (err < 0) { return err; diff --git a/gralloc4/src/core/mali_gralloc_bufferallocation.h b/gralloc4/src/core/mali_gralloc_bufferallocation.h index cfea2cf..a125efc 100644 --- a/gralloc4/src/core/mali_gralloc_bufferallocation.h +++ b/gralloc4/src/core/mali_gralloc_bufferallocation.h @@ -100,7 +100,7 @@ int mali_gralloc_derive_format_and_size(buffer_descriptor_t * const bufDescripto int mali_gralloc_buffer_allocate(const gralloc_buffer_descriptor_t *descriptors, uint32_t numDescriptors, buffer_handle_t *pHandle, bool *shared_backend, - int fd = -1); + bool is_dry = false); int mali_gralloc_buffer_free(buffer_handle_t pHandle); diff --git a/gralloc4/src/hidl_common/Allocator.cpp b/gralloc4/src/hidl_common/Allocator.cpp index 0f7340a..78ef905 100644 --- a/gralloc4/src/hidl_common/Allocator.cpp +++ b/gralloc4/src/hidl_common/Allocator.cpp @@ -80,9 +80,11 @@ void allocate(const buffer_descriptor_t &bufferDescriptor, uint32_t count, IAllo Error error = Error::NONE; int stride = 0; + bool is_dry = bufferDescriptor.producer_usage & GRALLOC_USAGE_ALLOCATE_DRY; + buffer_descriptor_t *bufDesc = const_cast<buffer_descriptor_t*>(&bufferDescriptor); + std::vector<hidl_handle> grallocBuffers; gralloc_buffer_descriptor_t grallocBufferDescriptor[1]; - grallocBufferDescriptor[0] = (gralloc_buffer_descriptor_t)(&bufferDescriptor); grallocBuffers.reserve(count); @@ -101,7 +103,7 @@ void allocate(const buffer_descriptor_t &bufferDescriptor, uint32_t count, IAllo else #endif { - allocResult = mali_gralloc_buffer_allocate(grallocBufferDescriptor, 1, &tmpBuffer, nullptr); + allocResult = mali_gralloc_buffer_allocate(grallocBufferDescriptor, 1, &tmpBuffer, nullptr, is_dry); if (allocResult != 0) { MALI_GRALLOC_LOGE("%s, buffer allocation failed with %d", __func__, allocResult); @@ -179,6 +181,13 @@ void allocate(const buffer_descriptor_t &bufferDescriptor, uint32_t count, IAllo } munmap(metadata_vaddr, hnd->attr_size); + + /* Must set this to false to ensure that when this + * buffer is passed back to mapper, metadata_fd_idx is + * not 0 + */ + hnd->is_dry = false; + } int tmpStride = 0; diff --git a/gralloc4/src/libGralloc4Wrapper/include/gralloc4/gralloc_vendor_interface.h b/gralloc4/src/libGralloc4Wrapper/include/gralloc4/gralloc_vendor_interface.h deleted file mode 100644 index cbd98d9..0000000 --- a/gralloc4/src/libGralloc4Wrapper/include/gralloc4/gralloc_vendor_interface.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2020 Google LLC. All rights reserved. - * - * Copyright (C) 2008 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef GRALLOC_VENDOR_INTERFACE_H -#define GRALLOC_VENDOR_INTERFACE_H - -#include <cutils/native_handle.h> -#include <sys/types.h> -#include <cstdint> -#include <system/graphics-base-v1.0.h> -#include <android/hardware/graphics/mapper/4.0/IMapper.h> - - -namespace android::hardware::graphics::allocator::priv { - -struct Descriptor; -Descriptor *createDescriptor(); -void deleteDescriptor(Descriptor *descriptor); - -void setProducerUsage(Descriptor &descriptor, uint64_t usage); -void setConsumerUsage(Descriptor &descriptor, uint64_t usage); -void setPlaneCount(Descriptor &descriptor, int count); -void setPlane(Descriptor &descriptor, int index, int fd, size_t size, off_t offset, int stride_byte); -void setWidth(Descriptor &descriptor, int width); -void setHeight(Descriptor &descriptor, int height); -void setStridePixel(Descriptor &descriptor, int stride_pixel); -void setFormat(Descriptor &descriptor, int format); - -buffer_handle_t createNativeHandle(const Descriptor &descriptor); - -int freeImportedHandle(void *handle); - -} // namespace android::hardware::graphics::allocator::priv - -#endif diff --git a/gralloc4/src/libGralloc4Wrapper/wrapper.cpp b/gralloc4/src/libGralloc4Wrapper/wrapper.cpp deleted file mode 100644 index f9b1b9c..0000000 --- a/gralloc4/src/libGralloc4Wrapper/wrapper.cpp +++ /dev/null @@ -1,218 +0,0 @@ -#include "gralloc4/gralloc_vendor_interface.h" -#include <vector> -#include <sys/stat.h> - -#include "core/format_info.h" -#include "core/mali_gralloc_bufferdescriptor.h" -#include "core/mali_gralloc_bufferallocation.h" -#include "allocator/mali_gralloc_ion.h" -#include "hidl_common/SharedMetadata.h" -#include "gralloc_priv.h" - -namespace android::hardware::graphics::allocator::priv { - -struct Descriptor { - unsigned int size = 0; - uint64_t producer_usage = 0; - uint64_t consumer_usage = 0; - - struct PlaneDescriptor { - int fd = -1; - size_t size = 0; - off_t offset = 0; - int stride_byte = 0; - }; - std::vector<PlaneDescriptor> planes; - - int width = 0; - int height = 0; - int stride_pixel = 0; - int format = 0; -}; - -Descriptor *createDescriptor() { return new Descriptor(); } -void deleteDescriptor(Descriptor *descriptor) { delete descriptor; } - -void setProducerUsage(Descriptor &descriptor, uint64_t usage) { - descriptor.producer_usage = usage; -} - -void setConsumerUsage(Descriptor &descriptor, uint64_t usage) { - descriptor.consumer_usage = usage; -} - -void setPlaneCount(Descriptor &descriptor, int count) { - descriptor.planes.resize(count); -} - -void setPlane(Descriptor &descriptor, int index, int fd, size_t size, off_t offset, int stride_byte) { - descriptor.planes[index].fd = fd; - descriptor.planes[index].size = size; - descriptor.planes[index].offset = offset; - descriptor.planes[index].stride_byte = stride_byte; -} - -void setWidth(Descriptor &descriptor, int width) { - descriptor.width = width; -} - -void setHeight(Descriptor &descriptor, int height) { - descriptor.height = height; -} - -void setStridePixel(Descriptor &descriptor, int stride_pixel) { - descriptor.stride_pixel = stride_pixel; -} - -void setFormat(Descriptor &descriptor, int format) { - descriptor.format = format; -} - -buffer_handle_t createNativeHandle(const Descriptor &descriptor) { - for (int i = 0; i < descriptor.planes.size(); ++i) { - struct stat st; - fstat(descriptor.planes[i].fd, &st); - off64_t fd_size = st.st_size; - if (fd_size < descriptor.planes[i].size) { - ALOGE("libGralloc4Wrapper: createNativeHandle failed: plane[%d] requested size greater than fd size.", - i); - return nullptr; - } - } - - buffer_descriptor_t buffer_descriptor; - - buffer_descriptor.pixel_stride = descriptor.stride_pixel; - buffer_descriptor.width = descriptor.width; - buffer_descriptor.height = descriptor.height; - buffer_descriptor.layer_count = 1; - buffer_descriptor.hal_format = buffer_descriptor.alloc_format - = descriptor.format; - buffer_descriptor.producer_usage = descriptor.producer_usage; - buffer_descriptor.consumer_usage = descriptor.consumer_usage; - buffer_descriptor.format_type = MALI_GRALLOC_FORMAT_TYPE_USAGE; - buffer_descriptor.signature = sizeof(buffer_descriptor_t); - - buffer_descriptor.fd_count = buffer_descriptor.plane_count - = descriptor.planes.size(); - for (int i = 0; i < descriptor.planes.size(); ++i) { - buffer_descriptor.alloc_sizes[i] = descriptor.planes[i].size; - } - - auto format_index = get_format_index(descriptor.format); - if (format_index == -1) { - ALOGE("libGralloc4Wrapper: invalid format 0x%x", - descriptor.format); - return 0; - } - for (int i = 0; i < descriptor.planes.size(); ++i) { - uint8_t bpp = formats[format_index].bpp[i]; - if (bpp == 0) { - ALOGE("libGralloc4Wrapper: format 0x%x has bpp[%d]=0", - descriptor.format, i); - return nullptr; - } - buffer_descriptor.plane_info[i] = { - .byte_stride = static_cast<uint32_t>((descriptor.planes[i].stride_byte * bpp) / 8), - .alloc_width = buffer_descriptor.width, - .alloc_height = buffer_descriptor.height, - }; - } - - if (mali_gralloc_derive_format_and_size(&buffer_descriptor)) { - ALOGE("libGralloc4Wrapper: mali_gralloc_derive_format_and_size failed"); - return nullptr; - } - - const gralloc_buffer_descriptor_t gralloc_buffer_descriptor = - reinterpret_cast<const gralloc_buffer_descriptor_t>(&buffer_descriptor); - - buffer_handle_t tmp_buffer; - bool shared_backend; - // TODO(modan@, make mali_gralloc_ion_allocate accept multiple fds) - { - int result = mali_gralloc_buffer_allocate(&gralloc_buffer_descriptor, 1, &tmp_buffer, - &shared_backend, descriptor.planes[0].fd); - if (result < 0) { - ALOGE("mali_gralloc_buffer_allocate failed"); - return nullptr; - } - } - - private_handle_t *hnd = const_cast<private_handle_t *>( - static_cast<const private_handle_t *>(tmp_buffer)); - - hnd->imapper_version = HIDL_MAPPER_VERSION_SCALED; - - hnd->reserved_region_size = buffer_descriptor.reserved_size; - hnd->attr_size = arm::mapper::common::shared_metadata_size() + hnd->reserved_region_size; - - { - int result = mali_gralloc_ion_allocate_attr(hnd); - if (result < 0) { - ALOGE("mali_gralloc_ion_allocate_attr failed"); - mali_gralloc_buffer_free(tmp_buffer); - return nullptr; - } - } - - { - auto metadata_vaddr = mmap(nullptr, hnd->attr_size, PROT_READ | PROT_WRITE, - MAP_SHARED, hnd->get_share_attr_fd(), 0); - if (metadata_vaddr == MAP_FAILED) { - ALOGE("mmap hnd->get_share_attr_fd() failed"); - mali_gralloc_buffer_free(tmp_buffer); - return nullptr; - } - - memset(metadata_vaddr, 0, hnd->attr_size); - - arm::mapper::common::shared_metadata_init(metadata_vaddr, buffer_descriptor.name); - - const uint32_t base_format = buffer_descriptor.alloc_format & MALI_GRALLOC_INTFMT_FMT_MASK; - const uint64_t usage = buffer_descriptor.consumer_usage | buffer_descriptor.producer_usage; - android_dataspace_t dataspace; - get_format_dataspace(base_format, usage, hnd->width, hnd->height, &dataspace); - - { - using arm::mapper::common::aligned_optional; - using arm::mapper::common::Dataspace; - using arm::mapper::common::shared_metadata; - (static_cast<shared_metadata *>(metadata_vaddr))->dataspace = - aligned_optional(static_cast<Dataspace>(dataspace)); - } - - munmap(metadata_vaddr, hnd->attr_size); - } - - // TODO(modan@, handle all plane offsets) - hnd->offset = hnd->plane_info[0].offset = descriptor.planes[0].offset; - hnd->layer_count = 1; - - return tmp_buffer; -} - -int freeImportedHandle(void *handle) -{ - using android::hardware::graphics::mapper::V4_0::IMapper; - using android::hardware::graphics::mapper::V4_0::Error; - - const private_handle_t *hnd = static_cast<private_handle_t *>(handle); - - static android::sp<IMapper> mapper = IMapper::getService(); - if (!mapper) - { - ALOGE("libGralloc4Wrapper: %s failed to get a mapper", __func__); - return -1; - } - - if (mapper->freeBuffer(handle) != Error::NONE) - { - ALOGE("libGralloc4Wrapper: %s couldn't freeBuffer(%p\n", __func__, handle); - return -1; - } - - return 0; -} - -} // namespace android::hardware::graphics::allocator::priv diff --git a/gralloc4/src/mali_gralloc_buffer.h b/gralloc4/src/mali_gralloc_buffer.h index 891c507..182518c 100644 --- a/gralloc4/src/mali_gralloc_buffer.h +++ b/gralloc4/src/mali_gralloc_buffer.h @@ -42,6 +42,8 @@ #define SZ_4K 0x00001000 #define SZ_2M 0x00200000 +#define DRY_BUF_SHARE_ATTR_IDX 0 + /* * Maximum number of pixel format planes. * Plane [0]: Single plane formats (inc. RGB, YUV) and Y @@ -257,6 +259,7 @@ struct private_handle_t * to the number of fds. */ static const int sMagic = 0x3141592; + bool is_dry = false; private_handle_t( int _flags, @@ -265,7 +268,7 @@ struct private_handle_t int _fds[MAX_FDS], int _fd_count, int _req_format, uint64_t _alloc_format, int _width, int _height, uint64_t _stride, - uint64_t _layer_count, plane_info_t _plane_info[MAX_PLANES]) + uint64_t _layer_count, plane_info_t _plane_info[MAX_PLANES], bool _is_dry = false) : private_handle_t() { flags = _flags; @@ -279,7 +282,8 @@ struct private_handle_t alloc_format = _alloc_format; layer_count = _layer_count; version = sizeof(native_handle); - set_numfds(fd_count); + is_dry = _is_dry; + set_numfds(is_dry ? 0 : fd_count); memcpy(plane_info, _plane_info, sizeof(plane_info_t) * MAX_PLANES); if (_fds) @@ -350,6 +354,7 @@ struct private_handle_t int get_share_attr_fd_index() const { + if (is_dry) return DRY_BUF_SHARE_ATTR_IDX; /* share_attr can be at idx 1 to MAX_FDS */ if (fd_count <= 0 || fd_count > MAX_FDS) return -1; @@ -359,6 +364,8 @@ struct private_handle_t int get_share_attr_fd() const { + if (is_dry) return fds[DRY_BUF_SHARE_ATTR_IDX]; + int idx = get_share_attr_fd_index(); if (idx <= 0) @@ -444,6 +451,6 @@ struct private_handle_t // The size of private_handle_t is calculated manually. This check ensures that private_handle_t has // the same layout for 32-bit and 64-bit processes. -static_assert(sizeof(private_handle_t) == 328); +static_assert(sizeof(private_handle_t) == 336); #endif /* MALI_GRALLOC_BUFFER_H_ */ diff --git a/gralloc4/src/mali_gralloc_usages.h b/gralloc4/src/mali_gralloc_usages.h index 4bab4d3..4b2669f 100644 --- a/gralloc4/src/mali_gralloc_usages.h +++ b/gralloc4/src/mali_gralloc_usages.h @@ -28,11 +28,12 @@ */ +#include <aidl/android/hardware/graphics/common/BufferUsage.h> #include <android/hardware/graphics/common/1.2/types.h> +#include <pixel-gralloc/usage.h> + /* BufferUsage is not defined in 1.2/types.h as there are no changes from previous version */ namespace hidl_common = android::hardware::graphics::common::V1_1; - -#include <aidl/android/hardware/graphics/common/BufferUsage.h> namespace aidl_common = aidl::android::hardware::graphics::common; /* Local macro definitions to emulate Gralloc 1.0 usage interface */ @@ -78,6 +79,7 @@ typedef enum GRALLOC_USAGE_GOOGLE_IP_BW = GRALLOC_USAGE_PRIVATE_16, /* Alias to BO */ GRALLOC_USAGE_GOOGLE_IP_BIG = GRALLOC_USAGE_PRIVATE_16, /* Alias to BO/BW */ GRALLOC_USAGE_GOOGLE_IP_MFC = GRALLOC_USAGE_PRIVATE_17, + GRALLOC_USAGE_ALLOCATE_DRY = ::pixel::graphics::Usage::ALLOCATE_DRY, /* FaceAuth specific usages. */ GS101_GRALLOC_USAGE_TPU_INPUT = GRALLOC_USAGE_PRIVATE_5, @@ -155,6 +157,7 @@ static const uint64_t VALID_USAGE = GRALLOC_USAGE_ROIINFO | /* 1U << 52 */ MALI_GRALLOC_USAGE_AFBC_PADDING | /* 1U << 53 */ MALI_GRALLOC_USAGE_FORCE_BACKBUFFER | /* 1U << 54 */ + GRALLOC_USAGE_ALLOCATE_DRY | /* 1U << 28 */ MALI_GRALLOC_USAGE_NO_AFBC | /* 1U << 29 */ 0; |