summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnkit Goyal <layog@google.com>2023-06-16 23:44:21 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-06-16 23:44:21 +0000
commit0c64bd0b8359f9bbcdd68934faffefd47234ebbf (patch)
treea46a4d7711eb08ea4e153553ad7dc9787bfbf246
parent848b59ca5ba68e8f6068566db975398ec2d3c1ca (diff)
parente787b4a1c63e79f172c63ddf0f5a4895fb7c8eab (diff)
downloadgchips-0c64bd0b8359f9bbcdd68934faffefd47234ebbf.tar.gz
gralloc4: Add atrace logs for allocate params and afbc init am: e787b4a1c6
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/google/gchips/+/23731713 Change-Id: I9d863181ce3e3b2bf6e16966faa0401cdd18057c Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--gralloc4/src/allocator/mali_gralloc_ion.cpp54
-rw-r--r--gralloc4/src/core/mali_gralloc_bufferallocation.cpp13
2 files changed, 44 insertions, 23 deletions
diff --git a/gralloc4/src/allocator/mali_gralloc_ion.cpp b/gralloc4/src/allocator/mali_gralloc_ion.cpp
index 5f7fc26..da9aba5 100644
--- a/gralloc4/src/allocator/mali_gralloc_ion.cpp
+++ b/gralloc4/src/allocator/mali_gralloc_ion.cpp
@@ -363,6 +363,7 @@ int mali_gralloc_ion_allocate(const gralloc_buffer_descriptor_t *descriptors,
uint32_t numDescriptors, buffer_handle_t *pHandle,
bool *shared_backend, int ion_fd)
{
+ ATRACE_CALL();
GRALLOC_UNUSED(shared_backend);
unsigned int priv_heap_flag = 0;
@@ -426,6 +427,7 @@ int mali_gralloc_ion_allocate(const gralloc_buffer_descriptor_t *descriptors,
}
#if defined(GRALLOC_INIT_AFBC) && (GRALLOC_INIT_AFBC == 1)
+ ATRACE_NAME("AFBC init block");
unsigned char *cpu_ptr = NULL;
for (i = 0; i < numDescriptors; i++)
{
@@ -437,34 +439,42 @@ int mali_gralloc_ion_allocate(const gralloc_buffer_descriptor_t *descriptors,
if ((bufDescriptor->alloc_format & MALI_GRALLOC_INTFMT_AFBCENABLE_MASK)
&& !(usage & GRALLOC_USAGE_PROTECTED))
{
- /* TODO: only map for AFBC buffers */
- cpu_ptr =
- (unsigned char *)mmap(NULL, bufDescriptor->alloc_sizes[0], PROT_READ | PROT_WRITE, MAP_SHARED, hnd->fds[0], 0);
-
- if (MAP_FAILED == cpu_ptr)
{
- MALI_GRALLOC_LOGE("mmap failed for fd ( %d )", hnd->fds[0]);
- mali_gralloc_ion_free_internal(pHandle, numDescriptors);
- return -1;
- }
+ ATRACE_NAME("mmap");
+ /* TODO: only map for AFBC buffers */
+ cpu_ptr =
+ (unsigned char *)mmap(NULL, bufDescriptor->alloc_sizes[0], PROT_READ | PROT_WRITE, MAP_SHARED, hnd->fds[0], 0);
+
+ if (MAP_FAILED == cpu_ptr)
+ {
+ MALI_GRALLOC_LOGE("mmap failed for fd ( %d )", hnd->fds[0]);
+ mali_gralloc_ion_free_internal(pHandle, numDescriptors);
+ return -1;
+ }
- mali_gralloc_ion_sync_start(hnd, true, true);
+ mali_gralloc_ion_sync_start(hnd, true, true);
+ }
- /* For separated plane YUV, there is a header to initialise per plane. */
- const plane_info_t *plane_info = bufDescriptor->plane_info;
- const bool is_multi_plane = hnd->is_multi_plane();
- for (int i = 0; i < MAX_PLANES && (i == 0 || plane_info[i].byte_stride != 0); i++)
{
- init_afbc(cpu_ptr + plane_info[i].offset,
- bufDescriptor->alloc_format,
- is_multi_plane,
- plane_info[i].alloc_width,
- plane_info[i].alloc_height);
+ ATRACE_NAME("data init");
+ /* For separated plane YUV, there is a header to initialise per plane. */
+ const plane_info_t *plane_info = bufDescriptor->plane_info;
+ const bool is_multi_plane = hnd->is_multi_plane();
+ for (int i = 0; i < MAX_PLANES && (i == 0 || plane_info[i].byte_stride != 0); i++)
+ {
+ init_afbc(cpu_ptr + plane_info[i].offset,
+ bufDescriptor->alloc_format,
+ is_multi_plane,
+ plane_info[i].alloc_width,
+ plane_info[i].alloc_height);
+ }
}
- mali_gralloc_ion_sync_end(hnd, true, true);
-
- munmap(cpu_ptr, bufDescriptor->alloc_sizes[0]);
+ {
+ ATRACE_NAME("munmap");
+ mali_gralloc_ion_sync_end(hnd, true, true);
+ munmap(cpu_ptr, bufDescriptor->alloc_sizes[0]);
+ }
}
}
#endif
diff --git a/gralloc4/src/core/mali_gralloc_bufferallocation.cpp b/gralloc4/src/core/mali_gralloc_bufferallocation.cpp
index 19c2a21..4a0618b 100644
--- a/gralloc4/src/core/mali_gralloc_bufferallocation.cpp
+++ b/gralloc4/src/core/mali_gralloc_bufferallocation.cpp
@@ -247,6 +247,7 @@ void init_afbc(uint8_t *buf, const uint64_t alloc_format,
const bool is_multi_plane,
const int w, const int h)
{
+ ATRACE_CALL();
const bool is_tiled = ((alloc_format & MALI_GRALLOC_INTFMT_AFBC_TILED_HEADERS)
== MALI_GRALLOC_INTFMT_AFBC_TILED_HEADERS);
const uint32_t n_headers = (w * h) / AFBC_PIXELS_PER_BLOCK;
@@ -984,6 +985,7 @@ static int prepare_descriptor_exynos_formats(
int mali_gralloc_derive_format_and_size(buffer_descriptor_t * const bufDescriptor)
{
+ ATRACE_CALL();
alloc_type_t alloc_type{};
int alloc_width = bufDescriptor->width;
@@ -1127,7 +1129,16 @@ int mali_gralloc_buffer_allocate(const gralloc_buffer_descriptor_t *descriptors,
uint32_t numDescriptors, buffer_handle_t *pHandle, bool *shared_backend,
int fd)
{
- ATRACE_CALL();
+ std::string atrace_log = __FUNCTION__;
+ if (ATRACE_ENABLED()) {
+ buffer_descriptor_t * const bufDescriptor = (buffer_descriptor_t *)(descriptors[0]);
+ std::stringstream ss;
+ ss << __FUNCTION__ << "(f=0x" << std::hex << bufDescriptor->hal_format << ", u=0x" <<
+ bufDescriptor->producer_usage << ", w=" << std::dec << bufDescriptor->width << ", h=" << bufDescriptor->height << ")";
+ atrace_log = ss.str();
+ }
+ ATRACE_NAME(atrace_log.c_str());
+
bool shared = false;
uint64_t backing_store_id = 0x0;
int err;