From 44444f9f592a99466e75be2d328083cc6b4c3edb Mon Sep 17 00:00:00 2001 From: Craig Donner Date: Mon, 22 Jan 2018 17:48:06 +0000 Subject: Revert "Add new AHardwareBuffer formats and usages with latest HAL change." This reverts commit b3899e5147fcff81be43469d9d6e8e56fc5aaac8. Reason for revert: breaks video rendering due to the use of an invalid flag Bug: 72299511 Test: build Change-Id: I7ab62b6aae03e813180fabd86f0570aba97beef0 --- libs/ui/Gralloc2.cpp | 58 ---------------------------------------------------- 1 file changed, 58 deletions(-) (limited to 'libs/ui/Gralloc2.cpp') diff --git a/libs/ui/Gralloc2.cpp b/libs/ui/Gralloc2.cpp index deaf8d3024..1f746a2ed1 100644 --- a/libs/ui/Gralloc2.cpp +++ b/libs/ui/Gralloc2.cpp @@ -20,7 +20,6 @@ #include #include -#include #include #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wzero-length-array" @@ -31,37 +30,8 @@ namespace android { namespace Gralloc2 { -namespace { - static constexpr Error kTransactionError = Error::NO_RESOURCES; -uint64_t getValid10UsageBits() { - static const uint64_t valid10UsageBits = []() -> uint64_t { - using hardware::graphics::common::V1_0::BufferUsage; - uint64_t bits = 0; - for (const auto bit : hardware::hidl_enum_iterator()) { - bits = bits | bit; - } - return bits; - }(); - return valid10UsageBits; -} - -uint64_t getValid11UsageBits() { - static const uint64_t valid11UsageBits = []() -> uint64_t { - using hardware::graphics::common::V1_1::BufferUsage; - uint64_t bits = 0; - for (const auto bit : hardware::hidl_enum_iterator()) { - bits = bits | bit; - } - // Return only the overlapping bits. - return bits & ~getValid10UsageBits(); - }(); - return valid11UsageBits; -} - -} // anonymous namespace - void Mapper::preload() { android::hardware::preloadPassthroughService(); } @@ -80,39 +50,11 @@ Mapper::Mapper() mMapperV2_1 = hardware::graphics::mapper::V2_1::IMapper::castFrom(mMapper); } -Gralloc2::Error Mapper::validateBufferDescriptorInfo( - const IMapper::BufferDescriptorInfo& descriptorInfo) const { - uint64_t validUsageBits = getValid10UsageBits(); - if (mMapperV2_1 != nullptr) { - validUsageBits = validUsageBits | getValid11UsageBits(); - } - - if (descriptorInfo.usage & ~validUsageBits) { - ALOGE("buffer descriptor contains invalid usage bits 0x%" PRIx64, - descriptorInfo.usage & ~validUsageBits); - return Error::BAD_VALUE; - } - return Error::NONE; -} - Error Mapper::createDescriptor( const IMapper::BufferDescriptorInfo& descriptorInfo, BufferDescriptor* outDescriptor) const { Error error; - - if (descriptorInfo.usage & getValid11UsageBits()) { - // TODO(b/66900669): Use mMapperV2_1->createDescriptorV2_1(). - ALOGW("full support for new usage bits is unimplemented 0x%" PRIx64, - descriptorInfo.usage & getValid11UsageBits()); - return Error::BAD_VALUE; - } - - error = validateBufferDescriptorInfo(descriptorInfo); - if (error != Error::NONE) { - return error; - } - auto ret = mMapper->createDescriptor(descriptorInfo, [&](const auto& tmpError, const auto& tmpDescriptor) { -- cgit v1.2.3-59-g8ed1b