gralloc: create a common gralloc interface
Create gralloc interface for allocator and mapper to hide the
implementation differences between Gralloc2 and Gralloc3.
Bug: 120493579
Test: manual
Change-Id: I21aa1954aa8b79f3e35616f188e15b47dae1f0e7
diff --git a/libs/ui/GraphicBufferAllocator.cpp b/libs/ui/GraphicBufferAllocator.cpp
index 833d321..3fd4e2a 100644
--- a/libs/ui/GraphicBufferAllocator.cpp
+++ b/libs/ui/GraphicBufferAllocator.cpp
@@ -29,6 +29,7 @@
#include <utils/Singleton.h>
#include <utils/Trace.h>
+#include <ui/Gralloc.h>
#include <ui/Gralloc2.h>
#include <ui/GraphicBufferMapper.h>
@@ -44,11 +45,9 @@
GraphicBufferAllocator::alloc_rec_t> GraphicBufferAllocator::sAllocList;
GraphicBufferAllocator::GraphicBufferAllocator()
- : mMapper(GraphicBufferMapper::getInstance()),
- mAllocator(std::make_unique<Gralloc2::Allocator>(
- mMapper.getGrallocMapper()))
-{
-}
+ : mMapper(GraphicBufferMapper::getInstance()),
+ mAllocator(std::make_unique<Gralloc2Allocator>(
+ reinterpret_cast<const Gralloc2Mapper&>(mMapper.getGrallocMapper()))) {}
GraphicBufferAllocator::~GraphicBufferAllocator() {}