From 0ff95c9b2f9d85cac2015aa4de5731c6d5e1a060 Mon Sep 17 00:00:00 2001 From: John Reck Date: Thu, 8 Dec 2022 11:45:29 -0500 Subject: Add IMapper 5 implementation Fixes: 205761028 Test: boots on CF w/ mapper4 removed Change-Id: I062ba3160fae972757669241fedcaf6ac3c6c12b --- libs/ui/Gralloc4.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libs/ui/Gralloc4.cpp') diff --git a/libs/ui/Gralloc4.cpp b/libs/ui/Gralloc4.cpp index f6ab7b2a5e..7459466d31 100644 --- a/libs/ui/Gralloc4.cpp +++ b/libs/ui/Gralloc4.cpp @@ -196,7 +196,7 @@ status_t Gralloc4Mapper::createDescriptor(void* bufferDescriptorInfo, return static_cast((ret.isOk()) ? error : kTransactionError); } -status_t Gralloc4Mapper::importBuffer(const hardware::hidl_handle& rawHandle, +status_t Gralloc4Mapper::importBuffer(const native_handle_t* rawHandle, buffer_handle_t* outBufferHandle) const { Error error; auto ret = mMapper->importBuffer(rawHandle, [&](const auto& tmpError, const auto& tmpBuffer) { @@ -1233,7 +1233,10 @@ status_t Gralloc4Allocator::allocate(std::string requestorName, uint32_t width, if (mAidlAllocator) { AllocationResult result; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" auto status = mAidlAllocator->allocate(descriptor, bufferCount, &result); +#pragma clang diagnostic pop // deprecation if (!status.isOk()) { error = status.getExceptionCode(); if (error == EX_SERVICE_SPECIFIC) { -- cgit v1.2.3-59-g8ed1b From 788b58be62b36e52714f705f5abd658cf94156f7 Mon Sep 17 00:00:00 2001 From: Charles Chen Date: Mon, 13 Feb 2023 18:02:10 +0000 Subject: Enable isolated process to use graphics allocator Add an LLNDK API for isolated process usage. Bug: 268016157 Test: Manual - Service can be added with allowIsolated set to true. Change-Id: I9d3c39e313978ccd6b01574b5533530d4f959904 --- .../ndk/include_platform/android/binder_manager.h | 17 ++++++++++++++--- libs/binder/ndk/libbinder_ndk.map.txt | 2 +- libs/binder/ndk/service_manager.cpp | 7 ++++--- libs/ui/Gralloc4.cpp | 13 +++++++++++-- 4 files changed, 30 insertions(+), 9 deletions(-) (limited to 'libs/ui/Gralloc4.cpp') diff --git a/libs/binder/ndk/include_platform/android/binder_manager.h b/libs/binder/ndk/include_platform/android/binder_manager.h index 86d5ed27b8..43159d8ba2 100644 --- a/libs/binder/ndk/include_platform/android/binder_manager.h +++ b/libs/binder/ndk/include_platform/android/binder_manager.h @@ -22,6 +22,16 @@ __BEGIN_DECLS +enum AServiceManager_AddServiceFlag : uint32_t { + /** + * This allows processes with AID_ISOLATED to get the binder of the service added. + * + * Services with methods that perform file IO, web socket creation or ways to egress data must + * not be added with this flag for privacy concerns. + */ + ADD_SERVICE_ALLOW_ISOLATED = 1, +}; + /** * This registers the service with the default service manager under this instance name. This does * not take ownership of binder. @@ -46,12 +56,13 @@ __attribute__((warn_unused_result)) binder_exception_t AServiceManager_addServic * * \param binder object to register globally with the service manager. * \param instance identifier of the service. This will be used to lookup the service. - * \param allowIsolated allows if this service can be isolated. + * \param flag an AServiceManager_AddServiceFlag enum to denote how the service should be added. * * \return EX_NONE on success. */ -__attribute__((warn_unused_result)) binder_exception_t AServiceManager_addServiceWithAllowIsolated( - AIBinder* binder, const char* instance, bool allowIsolated) __INTRODUCED_IN(34); +__attribute__((warn_unused_result)) binder_exception_t AServiceManager_addServiceWithFlag( + AIBinder* binder, const char* instance, const AServiceManager_AddServiceFlag flag) + __INTRODUCED_IN(34); /** * Gets a binder object with this specific instance name. Will return nullptr immediately if the diff --git a/libs/binder/ndk/libbinder_ndk.map.txt b/libs/binder/ndk/libbinder_ndk.map.txt index 5f2f617946..1078fb2b16 100644 --- a/libs/binder/ndk/libbinder_ndk.map.txt +++ b/libs/binder/ndk/libbinder_ndk.map.txt @@ -158,12 +158,12 @@ LIBBINDER_NDK34 { # introduced=UpsideDownCake AServiceManager_getUpdatableApexName; # systemapi AServiceManager_registerForServiceNotifications; # systemapi llndk AServiceManager_NotificationRegistration_delete; # systemapi llndk + AServiceManager_addServiceWithFlag; # systemapi llndk }; LIBBINDER_NDK_PLATFORM { global: AParcel_getAllowFds; - AServiceManager_addServiceWithAllowIsolated; extern "C++" { AIBinder_fromPlatformBinder*; AIBinder_toPlatformBinder*; diff --git a/libs/binder/ndk/service_manager.cpp b/libs/binder/ndk/service_manager.cpp index 2763ddb622..84da459454 100644 --- a/libs/binder/ndk/service_manager.cpp +++ b/libs/binder/ndk/service_manager.cpp @@ -42,14 +42,15 @@ binder_exception_t AServiceManager_addService(AIBinder* binder, const char* inst return PruneException(exception); } -binder_exception_t AServiceManager_addServiceWithAllowIsolated(AIBinder* binder, - const char* instance, - bool allowIsolated) { +binder_exception_t AServiceManager_addServiceWithFlag(AIBinder* binder, const char* instance, + const AServiceManager_AddServiceFlag flag) { if (binder == nullptr || instance == nullptr) { return EX_ILLEGAL_ARGUMENT; } sp sm = defaultServiceManager(); + + bool allowIsolated = flag & AServiceManager_AddServiceFlag::ADD_SERVICE_ALLOW_ISOLATED; status_t exception = sm->addService(String16(instance), binder->getBinder(), allowIsolated); return PruneException(exception); } diff --git a/libs/ui/Gralloc4.cpp b/libs/ui/Gralloc4.cpp index 7459466d31..c3af996b13 100644 --- a/libs/ui/Gralloc4.cpp +++ b/libs/ui/Gralloc4.cpp @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include #include #include @@ -1195,8 +1197,15 @@ Gralloc4Allocator::Gralloc4Allocator(const Gralloc4Mapper& mapper) : mMapper(map mAllocator = IAllocator::getService(); if (__builtin_available(android 31, *)) { if (hasIAllocatorAidl()) { - mAidlAllocator = AidlIAllocator::fromBinder(ndk::SpAIBinder( - AServiceManager_waitForService(kAidlAllocatorServiceName.c_str()))); + // TODO(b/269517338): Perform the isolated checking for this in service manager instead. + uid_t aid = multiuser_get_app_id(getuid()); + if (aid >= AID_ISOLATED_START && aid <= AID_ISOLATED_END) { + mAidlAllocator = AidlIAllocator::fromBinder(ndk::SpAIBinder( + AServiceManager_getService(kAidlAllocatorServiceName.c_str()))); + } else { + mAidlAllocator = AidlIAllocator::fromBinder(ndk::SpAIBinder( + AServiceManager_waitForService(kAidlAllocatorServiceName.c_str()))); + } ALOGE_IF(!mAidlAllocator, "AIDL IAllocator declared but failed to get service"); } } -- cgit v1.2.3-59-g8ed1b From 9c1238df67d4b8619523e35f14e4f45d0d714687 Mon Sep 17 00:00:00 2001 From: John Reck Date: Tue, 21 Mar 2023 11:27:40 -0400 Subject: Remove unused code not implemented in gralloc5 Fixes: 261857910 Test: make Change-Id: If567ea91a9881c18f2d068ab1e0c9a37969d6a8a --- libs/ui/Gralloc4.cpp | 156 ------------------------------- libs/ui/Gralloc5.cpp | 69 -------------- libs/ui/GraphicBufferMapper.cpp | 79 ---------------- libs/ui/include/ui/Gralloc.h | 66 ------------- libs/ui/include/ui/Gralloc4.h | 36 ------- libs/ui/include/ui/Gralloc5.h | 54 ----------- libs/ui/include/ui/GraphicBufferMapper.h | 42 --------- 7 files changed, 502 deletions(-) (limited to 'libs/ui/Gralloc4.cpp') diff --git a/libs/ui/Gralloc4.cpp b/libs/ui/Gralloc4.cpp index c3af996b13..b6274ab9c0 100644 --- a/libs/ui/Gralloc4.cpp +++ b/libs/ui/Gralloc4.cpp @@ -766,162 +766,6 @@ status_t Gralloc4Mapper::setSmpte2094_10(buffer_handle_t bufferHandle, gralloc4::encodeSmpte2094_10); } -template -status_t Gralloc4Mapper::getDefault(uint32_t width, uint32_t height, PixelFormat format, - uint32_t layerCount, uint64_t usage, - const MetadataType& metadataType, - DecodeFunction decodeFunction, T* outMetadata) const { - if (!outMetadata) { - return BAD_VALUE; - } - - IMapper::BufferDescriptorInfo descriptorInfo; - if (auto error = sBufferDescriptorInfo("getDefault", width, height, format, layerCount, usage, - &descriptorInfo) != OK) { - return error; - } - - hidl_vec vec; - Error error; - auto ret = mMapper->getFromBufferDescriptorInfo(descriptorInfo, metadataType, - [&](const auto& tmpError, - const hidl_vec& tmpVec) { - error = tmpError; - vec = tmpVec; - }); - - if (!ret.isOk()) { - error = kTransactionError; - } - - if (error != Error::NONE) { - ALOGE("getDefault(%s, %" PRIu64 ", ...) failed with %d", metadataType.name.c_str(), - metadataType.value, error); - return static_cast(error); - } - - return decodeFunction(vec, outMetadata); -} - -status_t Gralloc4Mapper::getDefaultPixelFormatFourCC(uint32_t width, uint32_t height, - PixelFormat format, uint32_t layerCount, - uint64_t usage, - uint32_t* outPixelFormatFourCC) const { - return getDefault(width, height, format, layerCount, usage, - gralloc4::MetadataType_PixelFormatFourCC, gralloc4::decodePixelFormatFourCC, - outPixelFormatFourCC); -} - -status_t Gralloc4Mapper::getDefaultPixelFormatModifier(uint32_t width, uint32_t height, - PixelFormat format, uint32_t layerCount, - uint64_t usage, - uint64_t* outPixelFormatModifier) const { - return getDefault(width, height, format, layerCount, usage, - gralloc4::MetadataType_PixelFormatModifier, - gralloc4::decodePixelFormatModifier, outPixelFormatModifier); -} - -status_t Gralloc4Mapper::getDefaultAllocationSize(uint32_t width, uint32_t height, - PixelFormat format, uint32_t layerCount, - uint64_t usage, - uint64_t* outAllocationSize) const { - return getDefault(width, height, format, layerCount, usage, - gralloc4::MetadataType_AllocationSize, gralloc4::decodeAllocationSize, - outAllocationSize); -} - -status_t Gralloc4Mapper::getDefaultProtectedContent(uint32_t width, uint32_t height, - PixelFormat format, uint32_t layerCount, - uint64_t usage, - uint64_t* outProtectedContent) const { - return getDefault(width, height, format, layerCount, usage, - gralloc4::MetadataType_ProtectedContent, gralloc4::decodeProtectedContent, - outProtectedContent); -} - -status_t Gralloc4Mapper::getDefaultCompression(uint32_t width, uint32_t height, PixelFormat format, - uint32_t layerCount, uint64_t usage, - ExtendableType* outCompression) const { - return getDefault(width, height, format, layerCount, usage, gralloc4::MetadataType_Compression, - gralloc4::decodeCompression, outCompression); -} - -status_t Gralloc4Mapper::getDefaultCompression(uint32_t width, uint32_t height, PixelFormat format, - uint32_t layerCount, uint64_t usage, - ui::Compression* outCompression) const { - if (!outCompression) { - return BAD_VALUE; - } - ExtendableType compression; - status_t error = getDefaultCompression(width, height, format, layerCount, usage, &compression); - if (error) { - return error; - } - if (!gralloc4::isStandardCompression(compression)) { - return BAD_TYPE; - } - *outCompression = gralloc4::getStandardCompressionValue(compression); - return NO_ERROR; -} - -status_t Gralloc4Mapper::getDefaultInterlaced(uint32_t width, uint32_t height, PixelFormat format, - uint32_t layerCount, uint64_t usage, - ExtendableType* outInterlaced) const { - return getDefault(width, height, format, layerCount, usage, gralloc4::MetadataType_Interlaced, - gralloc4::decodeInterlaced, outInterlaced); -} - -status_t Gralloc4Mapper::getDefaultInterlaced(uint32_t width, uint32_t height, PixelFormat format, - uint32_t layerCount, uint64_t usage, - ui::Interlaced* outInterlaced) const { - if (!outInterlaced) { - return BAD_VALUE; - } - ExtendableType interlaced; - status_t error = getDefaultInterlaced(width, height, format, layerCount, usage, &interlaced); - if (error) { - return error; - } - if (!gralloc4::isStandardInterlaced(interlaced)) { - return BAD_TYPE; - } - *outInterlaced = gralloc4::getStandardInterlacedValue(interlaced); - return NO_ERROR; -} - -status_t Gralloc4Mapper::getDefaultChromaSiting(uint32_t width, uint32_t height, PixelFormat format, - uint32_t layerCount, uint64_t usage, - ExtendableType* outChromaSiting) const { - return getDefault(width, height, format, layerCount, usage, gralloc4::MetadataType_ChromaSiting, - gralloc4::decodeChromaSiting, outChromaSiting); -} - -status_t Gralloc4Mapper::getDefaultChromaSiting(uint32_t width, uint32_t height, PixelFormat format, - uint32_t layerCount, uint64_t usage, - ui::ChromaSiting* outChromaSiting) const { - if (!outChromaSiting) { - return BAD_VALUE; - } - ExtendableType chromaSiting; - status_t error = - getDefaultChromaSiting(width, height, format, layerCount, usage, &chromaSiting); - if (error) { - return error; - } - if (!gralloc4::isStandardChromaSiting(chromaSiting)) { - return BAD_TYPE; - } - *outChromaSiting = gralloc4::getStandardChromaSitingValue(chromaSiting); - return NO_ERROR; -} - -status_t Gralloc4Mapper::getDefaultPlaneLayouts( - uint32_t width, uint32_t height, PixelFormat format, uint32_t layerCount, uint64_t usage, - std::vector* outPlaneLayouts) const { - return getDefault(width, height, format, layerCount, usage, gralloc4::MetadataType_PlaneLayouts, - gralloc4::decodePlaneLayouts, outPlaneLayouts); -} - std::vector Gralloc4Mapper::listSupportedMetadataTypes() const { hidl_vec descriptions; Error error; diff --git a/libs/ui/Gralloc5.cpp b/libs/ui/Gralloc5.cpp index 6f196b86d5..514b45f0a5 100644 --- a/libs/ui/Gralloc5.cpp +++ b/libs/ui/Gralloc5.cpp @@ -831,73 +831,4 @@ status_t Gralloc5Mapper::setSmpte2094_10(buffer_handle_t bufferHandle, smpte2094_10); } -status_t Gralloc5Mapper::getDefaultPixelFormatFourCC(uint32_t, uint32_t, PixelFormat, uint32_t, - uint64_t, uint32_t *) const { - // TODO(b/261857910): Remove - return UNKNOWN_TRANSACTION; -} - -status_t Gralloc5Mapper::getDefaultPixelFormatModifier(uint32_t, uint32_t, PixelFormat, uint32_t, - uint64_t, uint64_t *) const { - // TODO(b/261857910): Remove - return UNKNOWN_TRANSACTION; -} - -status_t Gralloc5Mapper::getDefaultAllocationSize(uint32_t, uint32_t, PixelFormat, uint32_t, - uint64_t, uint64_t *) const { - // TODO(b/261857910): Remove - return UNKNOWN_TRANSACTION; -} - -status_t Gralloc5Mapper::getDefaultProtectedContent(uint32_t, uint32_t, PixelFormat, uint32_t, - uint64_t, uint64_t *) const { - // TODO(b/261857910): Remove - return UNKNOWN_TRANSACTION; -} - -status_t Gralloc5Mapper::getDefaultCompression( - uint32_t, uint32_t, PixelFormat, uint32_t, uint64_t, - aidl::android::hardware::graphics::common::ExtendableType *) const { - // TODO(b/261857910): Remove - return UNKNOWN_TRANSACTION; -} - -status_t Gralloc5Mapper::getDefaultCompression(uint32_t, uint32_t, PixelFormat, uint32_t, uint64_t, - ui::Compression *) const { - // TODO(b/261857910): Remove - return UNKNOWN_TRANSACTION; -} - -status_t Gralloc5Mapper::getDefaultInterlaced( - uint32_t, uint32_t, PixelFormat, uint32_t, uint64_t, - aidl::android::hardware::graphics::common::ExtendableType *) const { - // TODO(b/261857910): Remove - return UNKNOWN_TRANSACTION; -} - -status_t Gralloc5Mapper::getDefaultInterlaced(uint32_t, uint32_t, PixelFormat, uint32_t, uint64_t, - ui::Interlaced *) const { - // TODO(b/261857910): Remove - return UNKNOWN_TRANSACTION; -} - -status_t Gralloc5Mapper::getDefaultChromaSiting( - uint32_t, uint32_t, PixelFormat, uint32_t, uint64_t, - aidl::android::hardware::graphics::common::ExtendableType *) const { - // TODO(b/261857910): Remove - return UNKNOWN_TRANSACTION; -} - -status_t Gralloc5Mapper::getDefaultChromaSiting(uint32_t, uint32_t, PixelFormat, uint32_t, uint64_t, - ui::ChromaSiting *) const { - // TODO(b/261857910): Remove - return UNKNOWN_TRANSACTION; -} - -status_t Gralloc5Mapper::getDefaultPlaneLayouts(uint32_t, uint32_t, PixelFormat, uint32_t, uint64_t, - std::vector *) const { - // TODO(b/261857910): Remove - return UNKNOWN_TRANSACTION; -} - } // namespace android \ No newline at end of file diff --git a/libs/ui/GraphicBufferMapper.cpp b/libs/ui/GraphicBufferMapper.cpp index 6002a6d29e..7086e0470c 100644 --- a/libs/ui/GraphicBufferMapper.cpp +++ b/libs/ui/GraphicBufferMapper.cpp @@ -341,84 +341,5 @@ status_t GraphicBufferMapper::setSmpte2094_10(buffer_handle_t bufferHandle, return mMapper->setSmpte2094_10(bufferHandle, smpte2094_10); } -status_t GraphicBufferMapper::getDefaultPixelFormatFourCC(uint32_t width, uint32_t height, - PixelFormat format, uint32_t layerCount, - uint64_t usage, - uint32_t* outPixelFormatFourCC) { - return mMapper->getDefaultPixelFormatFourCC(width, height, format, layerCount, usage, - outPixelFormatFourCC); -} - -status_t GraphicBufferMapper::getDefaultPixelFormatModifier(uint32_t width, uint32_t height, - PixelFormat format, uint32_t layerCount, - uint64_t usage, - uint64_t* outPixelFormatModifier) { - return mMapper->getDefaultPixelFormatModifier(width, height, format, layerCount, usage, - outPixelFormatModifier); -} - -status_t GraphicBufferMapper::getDefaultAllocationSize(uint32_t width, uint32_t height, - PixelFormat format, uint32_t layerCount, - uint64_t usage, - uint64_t* outAllocationSize) { - return mMapper->getDefaultAllocationSize(width, height, format, layerCount, usage, - outAllocationSize); -} - -status_t GraphicBufferMapper::getDefaultProtectedContent(uint32_t width, uint32_t height, - PixelFormat format, uint32_t layerCount, - uint64_t usage, - uint64_t* outProtectedContent) { - return mMapper->getDefaultProtectedContent(width, height, format, layerCount, usage, - outProtectedContent); -} - -status_t GraphicBufferMapper::getDefaultCompression( - uint32_t width, uint32_t height, PixelFormat format, uint32_t layerCount, uint64_t usage, - aidl::android::hardware::graphics::common::ExtendableType* outCompression) { - return mMapper->getDefaultCompression(width, height, format, layerCount, usage, outCompression); -} - -status_t GraphicBufferMapper::getDefaultCompression(uint32_t width, uint32_t height, - PixelFormat format, uint32_t layerCount, - uint64_t usage, - ui::Compression* outCompression) { - return mMapper->getDefaultCompression(width, height, format, layerCount, usage, outCompression); -} - -status_t GraphicBufferMapper::getDefaultInterlaced( - uint32_t width, uint32_t height, PixelFormat format, uint32_t layerCount, uint64_t usage, - aidl::android::hardware::graphics::common::ExtendableType* outInterlaced) { - return mMapper->getDefaultInterlaced(width, height, format, layerCount, usage, outInterlaced); -} - -status_t GraphicBufferMapper::getDefaultInterlaced(uint32_t width, uint32_t height, - PixelFormat format, uint32_t layerCount, - uint64_t usage, ui::Interlaced* outInterlaced) { - return mMapper->getDefaultInterlaced(width, height, format, layerCount, usage, outInterlaced); -} - -status_t GraphicBufferMapper::getDefaultChromaSiting( - uint32_t width, uint32_t height, PixelFormat format, uint32_t layerCount, uint64_t usage, - aidl::android::hardware::graphics::common::ExtendableType* outChromaSiting) { - return mMapper->getDefaultChromaSiting(width, height, format, layerCount, usage, - outChromaSiting); -} - -status_t GraphicBufferMapper::getDefaultChromaSiting(uint32_t width, uint32_t height, - PixelFormat format, uint32_t layerCount, - uint64_t usage, - ui::ChromaSiting* outChromaSiting) { - return mMapper->getDefaultChromaSiting(width, height, format, layerCount, usage, - outChromaSiting); -} - -status_t GraphicBufferMapper::getDefaultPlaneLayouts( - uint32_t width, uint32_t height, PixelFormat format, uint32_t layerCount, uint64_t usage, - std::vector* outPlaneLayouts) { - return mMapper->getDefaultPlaneLayouts(width, height, format, layerCount, usage, - outPlaneLayouts); -} - // --------------------------------------------------------------------------- }; // namespace android diff --git a/libs/ui/include/ui/Gralloc.h b/libs/ui/include/ui/Gralloc.h index b494cbe4fa..496ba57789 100644 --- a/libs/ui/include/ui/Gralloc.h +++ b/libs/ui/include/ui/Gralloc.h @@ -200,72 +200,6 @@ public: std::optional> /*smpte2094_10*/) const { return INVALID_OPERATION; } - virtual status_t getDefaultPixelFormatFourCC(uint32_t /*width*/, uint32_t /*height*/, - PixelFormat /*format*/, uint32_t /*layerCount*/, - uint64_t /*usage*/, - uint32_t* /*outPixelFormatFourCC*/) const { - return INVALID_OPERATION; - } - virtual status_t getDefaultPixelFormatModifier(uint32_t /*width*/, uint32_t /*height*/, - PixelFormat /*format*/, uint32_t /*layerCount*/, - uint64_t /*usage*/, - uint64_t* /*outPixelFormatModifier*/) const { - return INVALID_OPERATION; - } - virtual status_t getDefaultAllocationSize(uint32_t /*width*/, uint32_t /*height*/, - PixelFormat /*format*/, uint32_t /*layerCount*/, - uint64_t /*usage*/, - uint64_t* /*outAllocationSize*/) const { - return INVALID_OPERATION; - } - virtual status_t getDefaultProtectedContent(uint32_t /*width*/, uint32_t /*height*/, - PixelFormat /*format*/, uint32_t /*layerCount*/, - uint64_t /*usage*/, - uint64_t* /*outProtectedContent*/) const { - return INVALID_OPERATION; - } - virtual status_t getDefaultCompression( - uint32_t /*width*/, uint32_t /*height*/, PixelFormat /*format*/, - uint32_t /*layerCount*/, uint64_t /*usage*/, - aidl::android::hardware::graphics::common::ExtendableType* /*outCompression*/) const { - return INVALID_OPERATION; - } - virtual status_t getDefaultCompression(uint32_t /*width*/, uint32_t /*height*/, - PixelFormat /*format*/, uint32_t /*layerCount*/, - uint64_t /*usage*/, - ui::Compression* /*outCompression*/) const { - return INVALID_OPERATION; - } - virtual status_t getDefaultInterlaced( - uint32_t /*width*/, uint32_t /*height*/, PixelFormat /*format*/, - uint32_t /*layerCount*/, uint64_t /*usage*/, - aidl::android::hardware::graphics::common::ExtendableType* /*outInterlaced*/) const { - return INVALID_OPERATION; - } - virtual status_t getDefaultInterlaced(uint32_t /*width*/, uint32_t /*height*/, - PixelFormat /*format*/, uint32_t /*layerCount*/, - uint64_t /*usage*/, - ui::Interlaced* /*outInterlaced*/) const { - return INVALID_OPERATION; - } - virtual status_t getDefaultChromaSiting( - uint32_t /*width*/, uint32_t /*height*/, PixelFormat /*format*/, - uint32_t /*layerCount*/, uint64_t /*usage*/, - aidl::android::hardware::graphics::common::ExtendableType* /*outChromaSiting*/) const { - return INVALID_OPERATION; - } - virtual status_t getDefaultChromaSiting(uint32_t /*width*/, uint32_t /*height*/, - PixelFormat /*format*/, uint32_t /*layerCount*/, - uint64_t /*usage*/, - ui::ChromaSiting* /*outChromaSiting*/) const { - return INVALID_OPERATION; - } - virtual status_t getDefaultPlaneLayouts( - uint32_t /*width*/, uint32_t /*height*/, PixelFormat /*format*/, - uint32_t /*layerCount*/, uint64_t /*usage*/, - std::vector* /*outPlaneLayouts*/) const { - return INVALID_OPERATION; - } }; // A wrapper to IAllocator diff --git a/libs/ui/include/ui/Gralloc4.h b/libs/ui/include/ui/Gralloc4.h index 6bc5ce5296..df43be87cd 100644 --- a/libs/ui/include/ui/Gralloc4.h +++ b/libs/ui/include/ui/Gralloc4.h @@ -120,42 +120,6 @@ public: std::optional>* outSmpte2094_10) const override; status_t setSmpte2094_10(buffer_handle_t bufferHandle, std::optional> smpte2094_10) const override; - status_t getDefaultPixelFormatFourCC(uint32_t width, uint32_t height, PixelFormat format, - uint32_t layerCount, uint64_t usage, - uint32_t* outPixelFormatFourCC) const override; - status_t getDefaultPixelFormatModifier(uint32_t width, uint32_t height, PixelFormat format, - uint32_t layerCount, uint64_t usage, - uint64_t* outPixelFormatModifier) const override; - status_t getDefaultAllocationSize(uint32_t width, uint32_t height, PixelFormat format, - uint32_t layerCount, uint64_t usage, - uint64_t* outAllocationSize) const override; - status_t getDefaultProtectedContent(uint32_t width, uint32_t height, PixelFormat format, - uint32_t layerCount, uint64_t usage, - uint64_t* outProtectedContent) const override; - status_t getDefaultCompression(uint32_t width, uint32_t height, PixelFormat format, - uint32_t layerCount, uint64_t usage, - aidl::android::hardware::graphics::common::ExtendableType* - outCompression) const override; - status_t getDefaultCompression(uint32_t width, uint32_t height, PixelFormat format, - uint32_t layerCount, uint64_t usage, - ui::Compression* outCompression) const override; - status_t getDefaultInterlaced(uint32_t width, uint32_t height, PixelFormat format, - uint32_t layerCount, uint64_t usage, - aidl::android::hardware::graphics::common::ExtendableType* - outInterlaced) const override; - status_t getDefaultInterlaced(uint32_t width, uint32_t height, PixelFormat format, - uint32_t layerCount, uint64_t usage, - ui::Interlaced* outInterlaced) const override; - status_t getDefaultChromaSiting(uint32_t width, uint32_t height, PixelFormat format, - uint32_t layerCount, uint64_t usage, - aidl::android::hardware::graphics::common::ExtendableType* - outChromaSiting) const override; - status_t getDefaultChromaSiting(uint32_t width, uint32_t height, PixelFormat format, - uint32_t layerCount, uint64_t usage, - ui::ChromaSiting* outChromaSiting) const override; - status_t getDefaultPlaneLayouts(uint32_t width, uint32_t height, PixelFormat format, - uint32_t layerCount, uint64_t usage, - std::vector* outPlaneLayouts) const override; std::vector listSupportedMetadataTypes() const; diff --git a/libs/ui/include/ui/Gralloc5.h b/libs/ui/include/ui/Gralloc5.h index bc1016944a..44b97d1a6f 100644 --- a/libs/ui/include/ui/Gralloc5.h +++ b/libs/ui/include/ui/Gralloc5.h @@ -156,60 +156,6 @@ public: buffer_handle_t bufferHandle, std::optional> smpte2094_10) const override; - [[nodiscard]] status_t getDefaultPixelFormatFourCC( - uint32_t width, uint32_t height, PixelFormat format, uint32_t layerCount, - uint64_t usage, uint32_t *outPixelFormatFourCC) const override; - - [[nodiscard]] status_t getDefaultPixelFormatModifier( - uint32_t width, uint32_t height, PixelFormat format, uint32_t layerCount, - uint64_t usage, uint64_t *outPixelFormatModifier) const override; - - [[nodiscard]] status_t getDefaultAllocationSize(uint32_t width, uint32_t height, - PixelFormat format, uint32_t layerCount, - uint64_t usage, - uint64_t *outAllocationSize) const override; - - [[nodiscard]] status_t getDefaultProtectedContent(uint32_t width, uint32_t height, - PixelFormat format, uint32_t layerCount, - uint64_t usage, - uint64_t *outProtectedContent) const override; - - [[nodiscard]] status_t getDefaultCompression( - uint32_t width, uint32_t height, PixelFormat format, uint32_t layerCount, - uint64_t usage, - aidl::android::hardware::graphics::common::ExtendableType *outCompression) - const override; - - [[nodiscard]] status_t getDefaultCompression(uint32_t width, uint32_t height, - PixelFormat format, uint32_t layerCount, - uint64_t usage, - ui::Compression *outCompression) const override; - - [[nodiscard]] status_t getDefaultInterlaced( - uint32_t width, uint32_t height, PixelFormat format, uint32_t layerCount, - uint64_t usage, - aidl::android::hardware::graphics::common::ExtendableType *outInterlaced) - const override; - - [[nodiscard]] status_t getDefaultInterlaced(uint32_t width, uint32_t height, PixelFormat format, - uint32_t layerCount, uint64_t usage, - ui::Interlaced *outInterlaced) const override; - - [[nodiscard]] status_t getDefaultChromaSiting( - uint32_t width, uint32_t height, PixelFormat format, uint32_t layerCount, - uint64_t usage, - aidl::android::hardware::graphics::common::ExtendableType *outChromaSiting) - const override; - - [[nodiscard]] status_t getDefaultChromaSiting(uint32_t width, uint32_t height, - PixelFormat format, uint32_t layerCount, - uint64_t usage, - ui::ChromaSiting *outChromaSiting) const override; - - [[nodiscard]] status_t getDefaultPlaneLayouts( - uint32_t width, uint32_t height, PixelFormat format, uint32_t layerCount, - uint64_t usage, std::vector *outPlaneLayouts) const override; - private: void unlockBlocking(buffer_handle_t bufferHandle) const; diff --git a/libs/ui/include/ui/GraphicBufferMapper.h b/libs/ui/include/ui/GraphicBufferMapper.h index 51c6e92f43..3a5167ab25 100644 --- a/libs/ui/include/ui/GraphicBufferMapper.h +++ b/libs/ui/include/ui/GraphicBufferMapper.h @@ -138,48 +138,6 @@ public: status_t setSmpte2094_10(buffer_handle_t bufferHandle, std::optional> smpte2094_10); - /** - * Gets the default metadata for a gralloc buffer allocated with the given parameters. - * - * These functions are supported by gralloc 4.0+. - */ - status_t getDefaultPixelFormatFourCC(uint32_t width, uint32_t height, PixelFormat format, - uint32_t layerCount, uint64_t usage, - uint32_t* outPixelFormatFourCC); - status_t getDefaultPixelFormatModifier(uint32_t width, uint32_t height, PixelFormat format, - uint32_t layerCount, uint64_t usage, - uint64_t* outPixelFormatModifier); - status_t getDefaultAllocationSize(uint32_t width, uint32_t height, PixelFormat format, - uint32_t layerCount, uint64_t usage, - uint64_t* outAllocationSize); - status_t getDefaultProtectedContent(uint32_t width, uint32_t height, PixelFormat format, - uint32_t layerCount, uint64_t usage, - uint64_t* outProtectedContent); - status_t getDefaultCompression( - uint32_t width, uint32_t height, PixelFormat format, uint32_t layerCount, - uint64_t usage, - aidl::android::hardware::graphics::common::ExtendableType* outCompression); - status_t getDefaultCompression(uint32_t width, uint32_t height, PixelFormat format, - uint32_t layerCount, uint64_t usage, - ui::Compression* outCompression); - status_t getDefaultInterlaced( - uint32_t width, uint32_t height, PixelFormat format, uint32_t layerCount, - uint64_t usage, - aidl::android::hardware::graphics::common::ExtendableType* outInterlaced); - status_t getDefaultInterlaced(uint32_t width, uint32_t height, PixelFormat format, - uint32_t layerCount, uint64_t usage, - ui::Interlaced* outInterlaced); - status_t getDefaultChromaSiting( - uint32_t width, uint32_t height, PixelFormat format, uint32_t layerCount, - uint64_t usage, - aidl::android::hardware::graphics::common::ExtendableType* outChromaSiting); - status_t getDefaultChromaSiting(uint32_t width, uint32_t height, PixelFormat format, - uint32_t layerCount, uint64_t usage, - ui::ChromaSiting* outChromaSiting); - status_t getDefaultPlaneLayouts(uint32_t width, uint32_t height, PixelFormat format, - uint32_t layerCount, uint64_t usage, - std::vector* outPlaneLayouts); - const GrallocMapper& getGrallocMapper() const { return reinterpret_cast(*mMapper); } -- cgit v1.2.3-59-g8ed1b