summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevika Krishnadas <kdevika@google.com>2022-04-22 01:40:40 +0000
committerDevika Krishnadas <kdevika@google.com>2022-04-22 22:10:36 +0000
commitff01c8eef98fc804ae02857b38dfbbb8f51784bc (patch)
treeda7c32bdbcc40450fa0f78c0ef93193327ab9467
parent0a6200f15ff328b1ae52a0a537a69ba72f0a735c (diff)
downloadgchips-ff01c8eef98fc804ae02857b38dfbbb8f51784bc.tar.gz
Gralloc: add tracing
Bug: 230063328 Test: perfetto traces Signed-off-by: Devika Krishnadas <kdevika@google.com> Change-Id: Iaee45ac15e604ea3c8f786e9bb76786bab14b15c
-rw-r--r--gralloc4/src/allocator/mali_gralloc_ion.cpp7
-rw-r--r--gralloc4/src/core/mali_gralloc_bufferallocation.cpp4
-rw-r--r--gralloc4/src/hidl_common/Allocator.cpp5
3 files changed, 16 insertions, 0 deletions
diff --git a/gralloc4/src/allocator/mali_gralloc_ion.cpp b/gralloc4/src/allocator/mali_gralloc_ion.cpp
index 58790a3..8ac63af 100644
--- a/gralloc4/src/allocator/mali_gralloc_ion.cpp
+++ b/gralloc4/src/allocator/mali_gralloc_ion.cpp
@@ -16,6 +16,8 @@
* limitations under the License.
*/
+#define ATRACE_TAG ATRACE_TAG_GRAPHICS
+
#include <string.h>
#include <errno.h>
#include <inttypes.h>
@@ -25,6 +27,8 @@
#include <log/log.h>
#include <cutils/atomic.h>
+#include <utils/Trace.h>
+
#include <linux/dma-buf.h>
#include <vector>
@@ -342,6 +346,7 @@ static std::string select_dmabuf_heap(unsigned int heap_mask)
int ion_device::alloc_from_dmabuf_heap(const std::string& heap_name, size_t size,
unsigned int flags)
{
+ ATRACE_NAME(("alloc_from_dmabuf_heap " + heap_name).c_str());
if (!buffer_allocator)
{
return -1;
@@ -358,6 +363,7 @@ int ion_device::alloc_from_dmabuf_heap(const std::string& heap_name, size_t size
int ion_device::alloc_from_ion_heap(uint64_t usage, size_t size, unsigned int flags, int *min_pgsz)
{
+ ATRACE_CALL();
/* TODO: remove min_pgsz? I don't think this is useful on Exynos */
if (size == 0 || min_pgsz == NULL)
{
@@ -541,6 +547,7 @@ static void mali_gralloc_ion_free_internal(buffer_handle_t * const pHandle,
int mali_gralloc_ion_allocate_attr(private_handle_t *hnd)
{
+ ATRACE_CALL();
ion_device *dev = ion_device::get();
if (!dev)
{
diff --git a/gralloc4/src/core/mali_gralloc_bufferallocation.cpp b/gralloc4/src/core/mali_gralloc_bufferallocation.cpp
index f81a10c..12e4494 100644
--- a/gralloc4/src/core/mali_gralloc_bufferallocation.cpp
+++ b/gralloc4/src/core/mali_gralloc_bufferallocation.cpp
@@ -16,10 +16,13 @@
* limitations under the License.
*/
+#define ATRACE_TAG ATRACE_TAG_GRAPHICS
+
#include <inttypes.h>
#include <assert.h>
#include <atomic>
#include <algorithm>
+#include <utils/Trace.h>
#include <hardware/hardware.h>
#include <hardware/gralloc1.h>
@@ -1097,6 +1100,7 @@ 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();
bool shared = false;
uint64_t backing_store_id = 0x0;
int err;
diff --git a/gralloc4/src/hidl_common/Allocator.cpp b/gralloc4/src/hidl_common/Allocator.cpp
index 8174f05..6ca758a 100644
--- a/gralloc4/src/hidl_common/Allocator.cpp
+++ b/gralloc4/src/hidl_common/Allocator.cpp
@@ -16,6 +16,10 @@
* limitations under the License.
*/
+#define ATRACE_TAG ATRACE_TAG_GRAPHICS
+
+#include <utils/Trace.h>
+
#include "SharedMetadata.h"
#include "Allocator.h"
#include "core/mali_gralloc_bufferallocation.h"
@@ -38,6 +42,7 @@ void allocate(const buffer_descriptor_t &bufferDescriptor, uint32_t count, IAllo
#if DISABLE_FRAMEBUFFER_HAL
GRALLOC_UNUSED(fb_allocator);
#endif
+ ATRACE_CALL();
Error error = Error::NONE;
int stride = 0;