Remove mapper from composer2.1 VTS
Bug: 292584923
Test: make VtsHalGraphicsComposerV2_3TargetTest VtsHalGraphicsComposerV2_4TargetTest VtsHalGraphicsComposerV2_2TargetTest VtsHalGraphicsComposerV2_1TargetTest
Change-Id: I3642995e7236a3b9b08ad5419c9d02b67243b24a
diff --git a/graphics/composer/2.1/utils/vts/Android.bp b/graphics/composer/2.1/utils/vts/Android.bp
index 7b6a0e6..0e0081d 100644
--- a/graphics/composer/2.1/utils/vts/Android.bp
+++ b/graphics/composer/2.1/utils/vts/Android.bp
@@ -34,18 +34,15 @@
"GraphicsComposerCallback.cpp",
"TestCommandReader.cpp",
],
+ shared_libs: [
+ "libui",
+ ],
static_libs: [
"android.hardware.graphics.composer@2.1",
- "android.hardware.graphics.mapper@2.0-vts",
- "android.hardware.graphics.mapper@3.0-vts",
- "android.hardware.graphics.mapper@4.0-vts",
"libgtest",
],
export_static_lib_headers: [
"android.hardware.graphics.composer@2.1",
- "android.hardware.graphics.mapper@2.0-vts",
- "android.hardware.graphics.mapper@3.0-vts",
- "android.hardware.graphics.mapper@4.0-vts",
],
header_libs: [
"android.hardware.graphics.composer@2.1-command-buffer",
diff --git a/graphics/composer/2.1/utils/vts/ComposerVts.cpp b/graphics/composer/2.1/utils/vts/ComposerVts.cpp
index 4603dd1..8b89784 100644
--- a/graphics/composer/2.1/utils/vts/ComposerVts.cpp
+++ b/graphics/composer/2.1/utils/vts/ComposerVts.cpp
@@ -308,113 +308,6 @@
writer->reset();
}
-NativeHandleWrapper::~NativeHandleWrapper() {
- if (mHandle) {
- mGralloc.freeBuffer(mHandle);
- }
-}
-
-Gralloc::Gralloc() {
- [this] {
- ASSERT_NO_FATAL_FAILURE(mGralloc4 = std::make_shared<Gralloc4>(
- /*aidlAllocatorServiceName*/ IAllocator::descriptor +
- std::string("/default"),
- /*hidlAllocatorServiceName*/ "default",
- /*mapperServiceName*/ "default",
- /*errOnFailure=*/false));
- if (!mGralloc4->hasAllocator() || mGralloc4->getMapper() == nullptr) {
- mGralloc4 = nullptr;
- ASSERT_NO_FATAL_FAILURE(mGralloc3 = std::make_shared<Gralloc3>("default", "default",
- /*errOnFailure=*/false));
- if (mGralloc3->getAllocator() == nullptr || mGralloc3->getMapper() == nullptr) {
- mGralloc3 = nullptr;
- ASSERT_NO_FATAL_FAILURE(mGralloc2 = std::make_shared<Gralloc2>());
- }
- }
- }();
-}
-
-const NativeHandleWrapper Gralloc::allocate(uint32_t width, uint32_t height, uint32_t layerCount,
- PixelFormat format, uint64_t usage, bool import,
- uint32_t* outStride) {
- const native_handle_t* handle;
- if (mGralloc4) {
- IMapper4::BufferDescriptorInfo info{};
- info.width = width;
- info.height = height;
- info.layerCount = layerCount;
- info.format = static_cast<android::hardware::graphics::common::V1_2::PixelFormat>(format);
- info.usage = usage;
- handle = mGralloc4->allocate(info, import, outStride);
- } else if (mGralloc3) {
- IMapper3::BufferDescriptorInfo info{};
- info.width = width;
- info.height = height;
- info.layerCount = layerCount;
- info.format = static_cast<android::hardware::graphics::common::V1_2::PixelFormat>(format);
- info.usage = usage;
- handle = mGralloc3->allocate(info, import, outStride);
- } else {
- IMapper2::BufferDescriptorInfo info{};
- info.width = width;
- info.height = height;
- info.layerCount = layerCount;
- info.format = format;
- info.usage = usage;
- handle = mGralloc2->allocate(info, import, outStride);
- }
- return NativeHandleWrapper(*this, handle);
-}
-
-void* Gralloc::lock(const native_handle_t* bufferHandle, uint64_t cpuUsage,
- const AccessRegion& accessRegionRect, int acquireFence) {
- if (mGralloc4) {
- IMapper4::Rect accessRegion;
- accessRegion.left = accessRegionRect.left;
- accessRegion.top = accessRegionRect.top;
- accessRegion.width = accessRegionRect.width;
- accessRegion.height = accessRegionRect.height;
- return mGralloc4->lock(bufferHandle, cpuUsage, accessRegion, acquireFence);
- } else if (mGralloc3) {
- IMapper3::Rect accessRegion;
- accessRegion.left = accessRegionRect.left;
- accessRegion.top = accessRegionRect.top;
- accessRegion.width = accessRegionRect.width;
- accessRegion.height = accessRegionRect.height;
- int32_t bytesPerPixel;
- int32_t bytesPerStride;
- return mGralloc3->lock(bufferHandle, cpuUsage, accessRegion, acquireFence, &bytesPerPixel,
- &bytesPerStride);
- } else {
- IMapper2::Rect accessRegion;
- accessRegion.left = accessRegionRect.left;
- accessRegion.top = accessRegionRect.top;
- accessRegion.width = accessRegionRect.width;
- accessRegion.height = accessRegionRect.height;
- return mGralloc2->lock(bufferHandle, cpuUsage, accessRegion, acquireFence);
- }
-}
-
-int Gralloc::unlock(const native_handle_t* bufferHandle) {
- if (mGralloc4) {
- return mGralloc4->unlock(bufferHandle);
- } else if (mGralloc3) {
- return mGralloc3->unlock(bufferHandle);
- } else {
- return mGralloc2->unlock(bufferHandle);
- }
-}
-
-void Gralloc::freeBuffer(const native_handle_t* bufferHandle) {
- if (mGralloc4) {
- mGralloc4->freeBuffer(bufferHandle);
- } else if (mGralloc3) {
- mGralloc3->freeBuffer(bufferHandle);
- } else {
- mGralloc2->freeBuffer(bufferHandle);
- }
-}
-
} // namespace vts
} // namespace V2_1
} // namespace composer
diff --git a/graphics/composer/2.1/utils/vts/include/composer-vts/2.1/ComposerVts.h b/graphics/composer/2.1/utils/vts/include/composer-vts/2.1/ComposerVts.h
index f8ea661..c0aacb5 100644
--- a/graphics/composer/2.1/utils/vts/include/composer-vts/2.1/ComposerVts.h
+++ b/graphics/composer/2.1/utils/vts/include/composer-vts/2.1/ComposerVts.h
@@ -25,9 +25,6 @@
#include <android/hardware/graphics/composer/2.1/IComposer.h>
#include <composer-command-buffer/2.1/ComposerCommandBuffer.h>
#include <composer-vts/2.1/TestCommandReader.h>
-#include <mapper-vts/2.0/MapperVts.h>
-#include <mapper-vts/3.0/MapperVts.h>
-#include <mapper-vts/4.0/MapperVts.h>
#include <utils/StrongPointer.h>
#include "gtest/gtest.h"
@@ -43,13 +40,6 @@
using android::hardware::graphics::common::V1_0::Dataspace;
using android::hardware::graphics::common::V1_0::Hdr;
using android::hardware::graphics::common::V1_0::PixelFormat;
-using IMapper2 = android::hardware::graphics::mapper::V2_0::IMapper;
-using IMapper3 = android::hardware::graphics::mapper::V3_0::IMapper;
-using IMapper4 = android::hardware::graphics::mapper::V4_0::IMapper;
-using Gralloc2 = android::hardware::graphics::mapper::V2_0::vts::Gralloc;
-using Gralloc3 = android::hardware::graphics::mapper::V3_0::vts::Gralloc;
-using Gralloc4 = android::hardware::graphics::mapper::V4_0::vts::Gralloc;
-using IAllocator = aidl::android::hardware::graphics::allocator::IAllocator;
class ComposerClient;
@@ -129,52 +119,6 @@
const sp<IComposerClient> mClient;
};
-class AccessRegion {
- public:
- int32_t left;
- int32_t top;
- int32_t width;
- int32_t height;
-};
-
-class Gralloc;
-
-// RAII wrapper around native_handle_t*
-class NativeHandleWrapper {
- public:
- NativeHandleWrapper(Gralloc& gralloc, const native_handle_t* handle)
- : mGralloc(gralloc), mHandle(handle) {}
-
- ~NativeHandleWrapper();
-
- const native_handle_t* get() { return mHandle; }
-
- private:
- Gralloc& mGralloc;
- const native_handle_t* mHandle;
-};
-
-class Gralloc {
- public:
- explicit Gralloc();
-
- const NativeHandleWrapper allocate(uint32_t width, uint32_t height, uint32_t layerCount,
- PixelFormat format, uint64_t usage, bool import = true,
- uint32_t* outStride = nullptr);
-
- void* lock(const native_handle_t* bufferHandle, uint64_t cpuUsage,
- const AccessRegion& accessRegionRect, int acquireFence);
-
- int unlock(const native_handle_t* bufferHandle);
-
- void freeBuffer(const native_handle_t* bufferHandle);
-
- protected:
- std::shared_ptr<Gralloc2> mGralloc2 = nullptr;
- std::shared_ptr<Gralloc3> mGralloc3 = nullptr;
- std::shared_ptr<Gralloc4> mGralloc4 = nullptr;
-};
-
} // namespace vts
} // namespace V2_1
} // namespace composer