summaryrefslogtreecommitdiff
path: root/gralloc4/src/4.x
diff options
context:
space:
mode:
authorAnkit Goyal <layog@google.com>2021-06-22 15:35:40 +0800
committerAnkit Goyal <layog@google.com>2021-08-02 18:55:14 +0800
commitf2c2a2de658155496ceb36adf6516e9092427dc1 (patch)
tree07a370998e2c96288d7006b0664a0c8363af43ac /gralloc4/src/4.x
parent2cc6407faa4b312558310c0f0fc7749158f8ed7a (diff)
downloadgchips-f2c2a2de658155496ceb36adf6516e9092427dc1.tar.gz
Log the calling process's PID
Bug: 192821955 Test: Logcat Change-Id: Ic93aa915d76f10dac0a9084240df8e403497090e
Diffstat (limited to 'gralloc4/src/4.x')
-rw-r--r--gralloc4/src/4.x/GrallocAllocator.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/gralloc4/src/4.x/GrallocAllocator.cpp b/gralloc4/src/4.x/GrallocAllocator.cpp
index c3c0d4b..22aa189 100644
--- a/gralloc4/src/4.x/GrallocAllocator.cpp
+++ b/gralloc4/src/4.x/GrallocAllocator.cpp
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#include <hwbinder/IPCThreadState.h>
+
#include "GrallocAllocator.h"
#include "hidl_common/BufferDescriptor.h"
#include "hidl_common/Allocator.h"
@@ -31,6 +33,11 @@ using android::hardware::hidl_vec;
using android::hardware::Void;
using android::hardware::hidl_string;
+unsigned long callingPid() {
+ android::hardware::IPCThreadState* ipc = android::hardware::IPCThreadState::self();
+ return static_cast<unsigned long>(ipc->getCallingPid());
+}
+
GrallocAllocator::GrallocAllocator()
{
}
@@ -42,6 +49,8 @@ GrallocAllocator::~GrallocAllocator()
Return<void> GrallocAllocator::allocate(const BufferDescriptor &descriptor, uint32_t count, allocate_cb hidl_cb)
{
+ MALI_GRALLOC_LOGV("Allocation request from process: %lu", callingPid());
+
buffer_descriptor_t bufferDescriptor;
if (!mapper::common::grallocDecodeBufferDescriptor(descriptor, bufferDescriptor))
{
@@ -61,4 +70,4 @@ extern "C" IAllocator *HIDL_FETCH_IAllocator(const char * /* name */)
(HIDL_ALLOCATOR_VERSION_SCALED - (GRALLOC_VERSION_MAJOR * 100)) / 10, getpid(), getppid());
return new arm::allocator::GrallocAllocator();
-} \ No newline at end of file
+}