summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-10-24 01:21:05 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-10-24 01:21:05 +0000
commitdff341d8c90305a01b9a56a459672eac4bf7abe5 (patch)
treee3e833176300d9091a7f7262538972ec574e4745
parent07f990cec3a355d88d93cca93b9368e972a9b244 (diff)
parent0fe76ece0e7ccbd1f65b38101545c66707764c87 (diff)
downloadgchips-dff341d8c90305a01b9a56a459672eac4bf7abe5.tar.gz
Snap for 10992821 from 0fe76ece0e7ccbd1f65b38101545c66707764c87 to 24Q1-release
Change-Id: Ia7c57ec7193f22f97629636870fdadb91e202565
-rw-r--r--gralloc4/src/aidl/Android.bp4
-rw-r--r--gralloc4/src/allocator/mali_gralloc_ion.cpp16
-rw-r--r--gralloc4/src/allocator/mali_gralloc_ion.h2
-rw-r--r--gralloc4/src/core/mali_gralloc_bufferallocation.cpp4
-rw-r--r--gralloc4/src/core/mali_gralloc_bufferallocation.h2
-rw-r--r--gralloc4/src/hidl_common/Allocator.cpp14
-rw-r--r--gralloc4/src/mali_gralloc_buffer.h13
-rw-r--r--gralloc4/src/mali_gralloc_usages.h4
8 files changed, 21 insertions, 38 deletions
diff --git a/gralloc4/src/aidl/Android.bp b/gralloc4/src/aidl/Android.bp
index 71c6a38..e2d9d04 100644
--- a/gralloc4/src/aidl/Android.bp
+++ b/gralloc4/src/aidl/Android.bp
@@ -9,9 +9,6 @@ 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",
@@ -30,3 +27,4 @@ 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 f4ab5f0..7d04eb0 100644
--- a/gralloc4/src/allocator/mali_gralloc_ion.cpp
+++ b/gralloc4/src/allocator/mali_gralloc_ion.cpp
@@ -200,12 +200,14 @@ std::string select_dmabuf_heap(uint64_t usage)
return "";
}
-int alloc_from_dmabuf_heap(uint64_t usage, size_t size, const std::string& buffer_name = "")
+int alloc_from_dmabuf_heap(uint64_t usage, size_t size, const std::string& buffer_name = "", bool use_placeholder = false)
{
ATRACE_CALL();
if (size == 0) { return -1; }
- auto heap_name = select_dmabuf_heap(usage);
+ auto heap_name = use_placeholder ? "system" : select_dmabuf_heap(usage);
+ if (use_placeholder) size = 1;
+
if (heap_name.empty()) {
MALI_GRALLOC_LOGW("No heap found for usage: %s (0x%" PRIx64 ")", describe_usage(usage).c_str(), usage);
return -EINVAL;
@@ -352,7 +354,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, bool is_dry)
+ bool *shared_backend, bool use_placeholder)
{
ATRACE_CALL();
GRALLOC_UNUSED(shared_backend);
@@ -375,7 +377,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, is_dry);
+ bufDescriptor->layer_count, bufDescriptor->plane_info);
/* Reset the number of valid filedescriptors, we will increment
* it each time a valid fd is added, so we can rely on the
@@ -391,13 +393,12 @@ 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];
- fd = alloc_from_dmabuf_heap(usage, bufDescriptor->alloc_sizes[fidx], bufDescriptor->name);
+ fd = alloc_from_dmabuf_heap(usage, bufDescriptor->alloc_sizes[fidx], bufDescriptor->name, use_placeholder);
if (fd < 0)
{
@@ -409,7 +410,8 @@ int mali_gralloc_ion_allocate(const gralloc_buffer_descriptor_t *descriptors,
hnd->incr_numfds(1);
}
}
- if(is_dry) return 0;
+
+ if (use_placeholder) 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 ae1d37b..06d240b 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,
- bool is_dry=false);
+ bool use_placeholder = 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 d25354e..54e7f2f 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,
- bool is_dry)
+ bool use_placeholder)
{
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, is_dry);
+ err = mali_gralloc_ion_allocate(descriptors, numDescriptors, pHandle, &shared, use_placeholder);
if (err < 0)
{
return err;
diff --git a/gralloc4/src/core/mali_gralloc_bufferallocation.h b/gralloc4/src/core/mali_gralloc_bufferallocation.h
index a125efc..cc028ff 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,
- bool is_dry = false);
+ bool use_placeholder = 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 78ef905..d854255 100644
--- a/gralloc4/src/hidl_common/Allocator.cpp
+++ b/gralloc4/src/hidl_common/Allocator.cpp
@@ -80,11 +80,10 @@ 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);
-
+ bool use_placeholder = bufferDescriptor.producer_usage & GRALLOC_USAGE_PLACEHOLDER_BUFFER;
std::vector<hidl_handle> grallocBuffers;
gralloc_buffer_descriptor_t grallocBufferDescriptor[1];
+
grallocBufferDescriptor[0] = (gralloc_buffer_descriptor_t)(&bufferDescriptor);
grallocBuffers.reserve(count);
@@ -103,7 +102,7 @@ void allocate(const buffer_descriptor_t &bufferDescriptor, uint32_t count, IAllo
else
#endif
{
- allocResult = mali_gralloc_buffer_allocate(grallocBufferDescriptor, 1, &tmpBuffer, nullptr, is_dry);
+ allocResult = mali_gralloc_buffer_allocate(grallocBufferDescriptor, 1, &tmpBuffer, nullptr, use_placeholder);
if (allocResult != 0)
{
MALI_GRALLOC_LOGE("%s, buffer allocation failed with %d", __func__, allocResult);
@@ -181,13 +180,6 @@ 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/mali_gralloc_buffer.h b/gralloc4/src/mali_gralloc_buffer.h
index 182518c..891c507 100644
--- a/gralloc4/src/mali_gralloc_buffer.h
+++ b/gralloc4/src/mali_gralloc_buffer.h
@@ -42,8 +42,6 @@
#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
@@ -259,7 +257,6 @@ struct private_handle_t
* to the number of fds.
*/
static const int sMagic = 0x3141592;
- bool is_dry = false;
private_handle_t(
int _flags,
@@ -268,7 +265,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], bool _is_dry = false)
+ uint64_t _layer_count, plane_info_t _plane_info[MAX_PLANES])
: private_handle_t()
{
flags = _flags;
@@ -282,8 +279,7 @@ struct private_handle_t
alloc_format = _alloc_format;
layer_count = _layer_count;
version = sizeof(native_handle);
- is_dry = _is_dry;
- set_numfds(is_dry ? 0 : fd_count);
+ set_numfds(fd_count);
memcpy(plane_info, _plane_info, sizeof(plane_info_t) * MAX_PLANES);
if (_fds)
@@ -354,7 +350,6 @@ 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;
@@ -364,8 +359,6 @@ 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)
@@ -451,6 +444,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) == 336);
+static_assert(sizeof(private_handle_t) == 328);
#endif /* MALI_GRALLOC_BUFFER_H_ */
diff --git a/gralloc4/src/mali_gralloc_usages.h b/gralloc4/src/mali_gralloc_usages.h
index 4b2669f..a6dad28 100644
--- a/gralloc4/src/mali_gralloc_usages.h
+++ b/gralloc4/src/mali_gralloc_usages.h
@@ -27,7 +27,6 @@
* is not present.
*/
-
#include <aidl/android/hardware/graphics/common/BufferUsage.h>
#include <android/hardware/graphics/common/1.2/types.h>
#include <pixel-gralloc/usage.h>
@@ -79,7 +78,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,
+ GRALLOC_USAGE_PLACEHOLDER_BUFFER = ::pixel::graphics::Usage::PLACEHOLDER_BUFFER,
/* FaceAuth specific usages. */
GS101_GRALLOC_USAGE_TPU_INPUT = GRALLOC_USAGE_PRIVATE_5,
@@ -157,7 +156,6 @@ 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;