display: Switch to QTI allocator and mapper interface.
This reverts commit I3192c912ca790174f6fc6acb37988d6720167b07.
Revert "gralloc: Use default interfaces of allocator/mapper"
CRs-Fixed: 2394922
Change-Id: Ie376edf0ca5545ad327a9d1bacd7b4ffc09e8490
diff --git a/gralloc/Android.mk b/gralloc/Android.mk
index 2ae5778..f1ef11d 100644
--- a/gralloc/Android.mk
+++ b/gralloc/Android.mk
@@ -64,7 +64,7 @@
if [ -d "$(TOP)/vendor/qcom/opensource/interfaces/display/allocator/1.0" ];\
then echo QTI_ALLOCATOR_1_0; fi)
-
+ifeq ($(qti_mapper_version), QTI_MAPPER_1_0)
#mapper
include $(CLEAR_VARS)
LOCAL_MODULE := android.hardware.graphics.mapper@2.0-impl-qti-display
@@ -80,13 +80,17 @@
libgrallocutils \
libgralloccore \
libsync \
+ vendor.qti.hardware.display.mapper@1.0 \
android.hardware.graphics.mapper@2.0 \
android.hardware.graphics.mapper@2.1
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"qdgralloc\" -Wno-sign-conversion
LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps)
LOCAL_SRC_FILES := QtiMapper.cpp
include $(BUILD_SHARED_LIBRARY)
+endif
+ifeq ($(qti_allocator_version), QTI_ALLOCATOR_1_0)
+#allocator
include $(CLEAR_VARS)
LOCAL_MODULE := vendor.qti.hardware.display.allocator@1.0-service
LOCAL_VENDOR_MODULE := true
@@ -99,6 +103,7 @@
libqdMetaData \
libgrallocutils \
libgralloccore \
+ vendor.qti.hardware.display.allocator@1.0 \
android.hardware.graphics.mapper@2.1 \
android.hardware.graphics.allocator@2.0
LOCAL_CFLAGS := -DLOG_TAG=\"qdgralloc\" $(common_flags)
@@ -107,3 +112,4 @@
LOCAL_SRC_FILES := QtiAllocator.cpp service.cpp
LOCAL_INIT_RC := vendor.qti.hardware.display.allocator@1.0-service.rc
include $(BUILD_EXECUTABLE)
+endif
diff --git a/gralloc/QtiAllocator.cpp b/gralloc/QtiAllocator.cpp
index c4d7aef..bdb8ebe 100644
--- a/gralloc/QtiAllocator.cpp
+++ b/gralloc/QtiAllocator.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2018-2019 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
@@ -100,7 +100,7 @@
// Methods from ::android::hidl::base::V1_0::IBase follow.
-IAllocator *HIDL_FETCH_IAllocator(const char * /* name */) {
+IQtiAllocator *HIDL_FETCH_IQtiAllocator(const char * /* name */) {
return new QtiAllocator();
}
diff --git a/gralloc/QtiAllocator.h b/gralloc/QtiAllocator.h
index 1e683e8..2f3add8 100644
--- a/gralloc/QtiAllocator.h
+++ b/gralloc/QtiAllocator.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2018-2019 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
@@ -32,7 +32,7 @@
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
-#include <android/hardware/graphics/allocator/2.0/IAllocator.h>
+#include <vendor/qti/hardware/display/allocator/1.0/IQtiAllocator.h>
#include "gr_buf_mgr.h"
@@ -55,9 +55,10 @@
using ::android::hidl::base::V1_0::DebugInfo;
using ::android::hidl::base::V1_0::IBase;
using ::android::sp;
+using ::vendor::qti::hardware::display::allocator::V1_0::IQtiAllocator;
using gralloc::BufferManager;
-class QtiAllocator : public IAllocator {
+class QtiAllocator : public IQtiAllocator {
public:
QtiAllocator();
// Methods from ::android::hardware::graphics::allocator::V2_0::IAllocator follow.
@@ -70,7 +71,7 @@
BufferManager *buf_mgr_ = nullptr;
};
-extern "C" IAllocator *HIDL_FETCH_IAllocator(const char *name);
+extern "C" IQtiAllocator *HIDL_FETCH_IQtiAllocator(const char *name);
} // namespace implementation
} // namespace V1_0
diff --git a/gralloc/QtiMapper.cpp b/gralloc/QtiMapper.cpp
index 14c788e..a885a7b 100644
--- a/gralloc/QtiMapper.cpp
+++ b/gralloc/QtiMapper.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2018-2019 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
@@ -264,7 +264,6 @@
return Void();
}
-#ifdef ENABLE_QTI_MAPPER_EXTENSION
Return<void> QtiMapper::getMapSecureBufferFlag(void *buffer, getMapSecureBufferFlag_cb hidl_cb) {
auto err = Error::BAD_BUFFER;
auto hnd = static_cast<private_handle_t *>(buffer);
@@ -393,7 +392,6 @@
}
return err;
}
-#endif
// Methods from ::android::hidl::base::V1_0::IBase follow.
@@ -405,6 +403,11 @@
return static_cast<IMapper_2_1 *>(mapper);
}
+IQtiMapper *HIDL_FETCH_IQtiMapper(const char * /* name */) {
+ ALOGD_IF(DEBUG, "Fetching QtiMapper");
+ return new QtiMapper();
+}
+
} // namespace implementation
} // namespace V1_0
} // namespace mapper
diff --git a/gralloc/QtiMapper.h b/gralloc/QtiMapper.h
index a7d0c5c..b132a67 100644
--- a/gralloc/QtiMapper.h
+++ b/gralloc/QtiMapper.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2018-2019 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
@@ -32,6 +32,7 @@
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
+#include <vendor/qti/hardware/display/mapper/1.0/IQtiMapper.h>
#include "gr_buf_mgr.h"
namespace vendor {
@@ -56,6 +57,7 @@
using ::android::hidl::base::V1_0::DebugInfo;
using ::android::hidl::base::V1_0::IBase;
using ::android::sp;
+using ::vendor::qti::hardware::display::mapper::V1_0::IQtiMapper;
using gralloc::BufferManager;
using IMapper_2_1 = android::hardware::graphics::mapper::V2_1::IMapper;
@@ -65,7 +67,7 @@
android::hardware::graphics::mapper::V2_1::IMapper::BufferDescriptorInfo;
using IMapperBufferDescriptor = android::hardware::graphics::mapper::V2_0::BufferDescriptor;
-class QtiMapper : public IMapper_2_1 {
+class QtiMapper : public IQtiMapper {
public:
QtiMapper();
// Methods from ::android::hardware::graphics::mapper::V2_0::IMapper follow.
@@ -86,7 +88,6 @@
Return<void> getTransportSize(void* buffer, IMapper_2_1::getTransportSize_cb hidl_cb) override;
Return<void> createDescriptor_2_1(const BufferDescriptorInfo_2_1& descriptorInfo,
createDescriptor_2_1_cb _hidl_cb) override;
-#ifdef ENABLE_QTI_MAPPER_EXTENSION
Return<void> getMapSecureBufferFlag(void *buffer, getMapSecureBufferFlag_cb _hidl_cb) override;
Return<void> getInterlacedFlag(void *buffer, getInterlacedFlag_cb _hidl_cb) override;
Return<void> getCustomDimensions(void *buffer, getCustomDimensions_cb _hidl_cb) override;
@@ -99,7 +100,6 @@
Return<void> getColorSpace(void *buffer, getColorSpace_cb _hidl_cb) override;
Return<void> getYuvPlaneInfo(void *buffer, getYuvPlaneInfo_cb _hidl_cb) override;
Return<Error> setSingleBufferMode(void *buffer, bool enable) override;
-#endif
private:
BufferManager *buf_mgr_ = nullptr;
@@ -112,6 +112,8 @@
};
extern "C" IMapper_2_1 *HIDL_FETCH_IMapper(const char *name);
+extern "C" IQtiMapper *HIDL_FETCH_IQtiMapper(const char *name);
+
} // namespace implementation
} // namespace V1_0
} // namespace mapper
diff --git a/gralloc/service.cpp b/gralloc/service.cpp
index 5832386..ecc8680 100644
--- a/gralloc/service.cpp
+++ b/gralloc/service.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2018-2019 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
@@ -31,11 +31,11 @@
using android::hardware::configureRpcThreadpool;
using android::hardware::joinRpcThreadpool;
+using vendor::qti::hardware::display::allocator::V1_0::IQtiAllocator;
using vendor::qti::hardware::display::allocator::V1_0::implementation::QtiAllocator;
-using android::hardware::graphics::allocator::V2_0::IAllocator;
int main(int, char **) {
- android::sp<IAllocator> service = new QtiAllocator();
+ android::sp<IQtiAllocator> service = new QtiAllocator();
configureRpcThreadpool(4, true /*callerWillJoin*/);
if (service->registerAsService() != android::OK) {
ALOGE("Cannot register QTI Allocator service");