gralloc: Use default interfaces of allocator/mapper

Use default interfaces until BOARD_VNDK_VERSION is enabled

Change-Id: I3192c912ca790174f6fc6acb37988d6720167b07
This commit is contained in:
Naseer Ahmed
2018-03-02 15:42:45 -05:00
committed by Gerrit - the friendly Code Review server
parent 7dab1c1e76
commit 62dd96c7a7
6 changed files with 12 additions and 23 deletions

View File

@@ -59,7 +59,6 @@ qti_allocator_version := $(shell \
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
@@ -75,16 +74,12 @@ LOCAL_SHARED_LIBRARIES := $(common_libs) \
libgrallocutils \
libgralloccore \
libsync \
vendor.qti.hardware.display.mapper@1.0 \
android.hardware.graphics.mapper@2.0
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 # QTI_MAPPER_1_0
ifeq ($(qti_allocator_version), QTI_ALLOCATOR_1_0)
#allocator service
include $(CLEAR_VARS)
LOCAL_MODULE := vendor.qti.hardware.display.allocator@1.0-service
LOCAL_VENDOR_MODULE := true
@@ -97,7 +92,6 @@ LOCAL_SHARED_LIBRARIES := $(common_libs) \
libqdMetaData \
libgrallocutils \
libgralloccore \
vendor.qti.hardware.display.allocator@1.0 \
android.hardware.graphics.allocator@2.0
LOCAL_CFLAGS := -DLOG_TAG=\"qdgralloc\" $(common_flags)
LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps)
@@ -105,4 +99,3 @@ LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes)
LOCAL_SRC_FILES := QtiAllocator.cpp service.cpp
LOCAL_INIT_RC := vendor.qti.hardware.display.allocator@1.0-service.rc
include $(BUILD_EXECUTABLE)
endif # QTI_ALLOCATOR_1_0

View File

@@ -100,7 +100,7 @@ Return<void> QtiAllocator::allocate(const hidl_vec<uint32_t> &descriptor, uint32
// Methods from ::android::hidl::base::V1_0::IBase follow.
IQtiAllocator *HIDL_FETCH_IQtiAllocator(const char * /* name */) {
IAllocator *HIDL_FETCH_IAllocator(const char * /* name */) {
return new QtiAllocator();
}

View File

@@ -32,7 +32,7 @@
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
#include <vendor/qti/hardware/display/allocator/1.0/IQtiAllocator.h>
#include <android/hardware/graphics/allocator/2.0/IAllocator.h>
#include "gr_buf_mgr.h"
@@ -55,10 +55,9 @@ using ::android::hardware::hidl_vec;
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 IQtiAllocator {
class QtiAllocator : public IAllocator {
public:
QtiAllocator();
// Methods from ::android::hardware::graphics::allocator::V2_0::IAllocator follow.
@@ -71,7 +70,7 @@ class QtiAllocator : public IQtiAllocator {
BufferManager *buf_mgr_ = nullptr;
};
extern "C" IQtiAllocator *HIDL_FETCH_IQtiAllocator(const char *name);
extern "C" IAllocator *HIDL_FETCH_IAllocator(const char *name);
} // namespace implementation
} // namespace V1_0

View File

@@ -207,6 +207,7 @@ Return<void> QtiMapper::unlock(void *buffer, unlock_cb hidl_cb) {
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);
@@ -323,6 +324,7 @@ Return<Error> QtiMapper::setSingleBufferMode(void *buffer, bool enable) {
}
return err;
}
#endif
// Methods from ::android::hidl::base::V1_0::IBase follow.
@@ -334,10 +336,6 @@ IMapper *HIDL_FETCH_IMapper(const char * /* name */) {
return static_cast<IMapper *>(mapper);
}
IQtiMapper *HIDL_FETCH_IQtiMapper(const char * /* name */) {
ALOGD_IF(DEBUG, "Fetching QtiMapper");
return new QtiMapper();
}
} // namespace implementation
} // namespace V1_0
} // namespace mapper

View File

@@ -32,7 +32,6 @@
#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,10 +55,9 @@ using ::android::hardware::hidl_vec;
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;
class QtiMapper : public IQtiMapper {
class QtiMapper : public IMapper {
public:
QtiMapper();
// Methods from ::android::hardware::graphics::mapper::V2_0::IMapper follow.
@@ -72,6 +70,8 @@ class QtiMapper : public IQtiMapper {
Return<void> lockYCbCr(void *buffer, uint64_t cpu_usage, const IMapper::Rect &access_region,
const hidl_handle &acquire_fence, lockYCbCr_cb hidl_cb) override;
Return<void> unlock(void *buffer, unlock_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;
@@ -82,6 +82,7 @@ class QtiMapper : public IQtiMapper {
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;
@@ -92,8 +93,6 @@ class QtiMapper : public IQtiMapper {
};
extern "C" IMapper *HIDL_FETCH_IMapper(const char *name);
extern "C" IQtiMapper *HIDL_FETCH_IQtiMapper(const char *name);
} // namespace implementation
} // namespace V1_0
} // namespace mapper

View File

@@ -32,11 +32,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<IQtiAllocator> service = new QtiAllocator();
android::sp<IAllocator> service = new QtiAllocator();
configureRpcThreadpool(1, true /*callerWillJoin*/);
if (service->registerAsService() != android::OK) {
ALOGE("Cannot register QTI Allocator service");