gralloc: Add support for IMapper/IAllocator 4.0
* Add QtiMapper and QtiAllocator 4.0
* Implement IMapper 4.0 APIs: get, set,
getFromBufferDescriptorInfo, flushLockedBuffer,
rereadLockedBuffer, listSupportedMetadataTypes,
dumpBuffer, dumpBuffers, and getReservedRegion
CRs-Fixed: 2633272
Change-Id: Ica42e485e426b366ffb41f30f1ea2cf395901356
Signed-off-by: Baldev Sahu <bsahu@codeaurora.org>
diff --git a/gralloc/QtiAllocator.h b/gralloc/QtiAllocator.h
index 7bf1705..918c6b9 100644
--- a/gralloc/QtiAllocator.h
+++ b/gralloc/QtiAllocator.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -33,8 +33,10 @@
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
#include <vendor/qti/hardware/display/allocator/3.0/IQtiAllocator.h>
+#include <vendor/qti/hardware/display/allocator/4.0/IQtiAllocator.h>
#include "gr_buf_mgr.h"
+#include "gr_utils.h"
namespace vendor {
namespace qti {
@@ -51,16 +53,16 @@
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
-using ::android::hardware::graphics::allocator::V3_0::IAllocator;
-using ::android::hardware::graphics::mapper::V3_0::Error;
+using android::hardware::graphics::allocator::V3_0::IAllocator;
using ::android::hidl::base::V1_0::DebugInfo;
using ::android::hidl::base::V1_0::IBase;
using gralloc::BufferManager;
-using ::vendor::qti::hardware::display::allocator::V3_0::IQtiAllocator;
+using vendor::qti::hardware::display::allocator::V3_0::IQtiAllocator;
class QtiAllocator : public IQtiAllocator {
public:
QtiAllocator();
+
// Methods from ::android::hardware::graphics::allocator::V2_0::IAllocator follow.
Return<void> dumpDebugInfo(dumpDebugInfo_cb _hidl_cb) override;
Return<void> allocate(const hidl_vec<uint32_t> &descriptor, uint32_t count,
@@ -71,8 +73,6 @@
BufferManager *buf_mgr_ = nullptr;
};
-extern "C" IQtiAllocator *HIDL_FETCH_IQtiAllocator(const char *name);
-
} // namespace implementation
} // namespace V3_0
} // namespace allocator
@@ -81,4 +81,46 @@
} // namespace qti
} // namespace vendor
+namespace vendor {
+namespace qti {
+namespace hardware {
+namespace display {
+namespace allocator {
+namespace V4_0 {
+namespace implementation {
+
+using ::android::sp;
+using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_memory;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using android::hardware::graphics::allocator::V4_0::IAllocator;
+using ::android::hidl::base::V1_0::DebugInfo;
+using ::android::hidl::base::V1_0::IBase;
+using gralloc::BufferManager;
+using vendor::qti::hardware::display::allocator::V4_0::IQtiAllocator;
+
+class QtiAllocator : public IQtiAllocator {
+ public:
+ QtiAllocator();
+
+ // Methods from ::android::hardware::graphics::allocator::V4_0::IAllocator follow.
+ Return<void> allocate(const hidl_vec<uint8_t> &descriptor, uint32_t count,
+ allocate_cb _hidl_cb) override;
+
+ // Methods from ::android::hidl::base::V1_0::IBase follow.
+ private:
+ BufferManager *buf_mgr_ = nullptr;
+};
+
+} // namespace implementation
+} // namespace V4_0
+} // namespace allocator
+} // namespace display
+} // namespace hardware
+} // namespace qti
+} // namespace vendor
+
#endif // __QTIALLOCATOR_H__