summaryrefslogtreecommitdiff
path: root/libs/ui/Gralloc2.cpp
diff options
context:
space:
mode:
author Marissa Wall <marissaw@google.com> 2018-12-29 14:27:11 -0800
committer Marissa Wall <marissaw@google.com> 2019-01-14 14:08:53 -0800
commit925bf7fe6681fe2981522cd9de54ceb2565bc7f4 (patch)
tree0e2a1a63241c4a2c2ddb425080cedbcef6a937f6 /libs/ui/Gralloc2.cpp
parentd380e2c463f461cba82536043c1b2cd573f678ef (diff)
gralloc: add allocator and mapper 3.0 support to SF
Add support for IAllocator and IMapper 3.0 support to SurfaceFlinger. Bug: 120493579 Test: manual Change-Id: I8b7311cfa6b58502b334460d65eb66715ef429e8
Diffstat (limited to 'libs/ui/Gralloc2.cpp')
-rw-r--r--libs/ui/Gralloc2.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/libs/ui/Gralloc2.cpp b/libs/ui/Gralloc2.cpp
index c2f07326a1..ea7321e24c 100644
--- a/libs/ui/Gralloc2.cpp
+++ b/libs/ui/Gralloc2.cpp
@@ -27,11 +27,13 @@
#include <sync/sync.h>
#pragma clang diagnostic pop
+using android::hardware::graphics::allocator::V2_0::IAllocator;
using android::hardware::graphics::common::V1_1::BufferUsage;
using android::hardware::graphics::common::V1_1::PixelFormat;
using android::hardware::graphics::mapper::V2_0::BufferDescriptor;
using android::hardware::graphics::mapper::V2_0::Error;
using android::hardware::graphics::mapper::V2_0::YCbCrLayout;
+using android::hardware::graphics::mapper::V2_1::IMapper;
namespace android {
@@ -81,7 +83,8 @@ void Gralloc2Mapper::preload() {
Gralloc2Mapper::Gralloc2Mapper() {
mMapper = hardware::graphics::mapper::V2_0::IMapper::getService();
if (mMapper == nullptr) {
- LOG_ALWAYS_FATAL("gralloc-mapper is missing");
+ ALOGW("mapper 2.x is not supported");
+ return;
}
if (mMapper->isRemote()) {
LOG_ALWAYS_FATAL("gralloc-mapper must be in passthrough mode");
@@ -91,6 +94,10 @@ Gralloc2Mapper::Gralloc2Mapper() {
mMapperV2_1 = IMapper::castFrom(mMapper);
}
+bool Gralloc2Mapper::isSupported() const {
+ return mMapper != nullptr;
+}
+
status_t Gralloc2Mapper::validateBufferDescriptorInfo(
IMapper::BufferDescriptorInfo* descriptorInfo) const {
uint64_t validUsageBits = getValid10UsageBits();
@@ -340,10 +347,15 @@ int Gralloc2Mapper::unlock(buffer_handle_t bufferHandle) const {
Gralloc2Allocator::Gralloc2Allocator(const Gralloc2Mapper& mapper) : mMapper(mapper) {
mAllocator = IAllocator::getService();
if (mAllocator == nullptr) {
- LOG_ALWAYS_FATAL("gralloc-alloc is missing");
+ ALOGW("allocator 2.x is not supported");
+ return;
}
}
+bool Gralloc2Allocator::isSupported() const {
+ return mAllocator != nullptr;
+}
+
std::string Gralloc2Allocator::dumpDebugInfo() const {
std::string debugInfo;