From 925bf7fe6681fe2981522cd9de54ceb2565bc7f4 Mon Sep 17 00:00:00 2001 From: Marissa Wall Date: Sat, 29 Dec 2018 14:27:11 -0800 Subject: 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 --- libs/ui/Gralloc2.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'libs/ui/Gralloc2.cpp') 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 #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; -- cgit v1.2.3-59-g8ed1b