diff options
Diffstat (limited to 'libs/ui/GraphicBufferMapper.cpp')
-rw-r--r-- | libs/ui/GraphicBufferMapper.cpp | 97 |
1 files changed, 12 insertions, 85 deletions
diff --git a/libs/ui/GraphicBufferMapper.cpp b/libs/ui/GraphicBufferMapper.cpp index f5824233e9..7086e0470c 100644 --- a/libs/ui/GraphicBufferMapper.cpp +++ b/libs/ui/GraphicBufferMapper.cpp @@ -36,6 +36,7 @@ #include <ui/Gralloc2.h> #include <ui/Gralloc3.h> #include <ui/Gralloc4.h> +#include <ui/Gralloc5.h> #include <ui/GraphicBuffer.h> #include <system/graphics.h> @@ -49,9 +50,15 @@ void GraphicBufferMapper::preloadHal() { Gralloc2Mapper::preload(); Gralloc3Mapper::preload(); Gralloc4Mapper::preload(); + Gralloc5Mapper::preload(); } GraphicBufferMapper::GraphicBufferMapper() { + mMapper = std::make_unique<const Gralloc5Mapper>(); + if (mMapper->isLoaded()) { + mMapperVersion = Version::GRALLOC_5; + return; + } mMapper = std::make_unique<const Gralloc4Mapper>(); if (mMapper->isLoaded()) { mMapperVersion = Version::GRALLOC_4; @@ -82,15 +89,14 @@ void GraphicBufferMapper::dumpBufferToSystemLog(buffer_handle_t bufferHandle, bo ALOGD("%s", s.c_str()); } -status_t GraphicBufferMapper::importBuffer(buffer_handle_t rawHandle, - uint32_t width, uint32_t height, uint32_t layerCount, - PixelFormat format, uint64_t usage, uint32_t stride, - buffer_handle_t* outHandle) -{ +status_t GraphicBufferMapper::importBuffer(const native_handle_t* rawHandle, uint32_t width, + uint32_t height, uint32_t layerCount, PixelFormat format, + uint64_t usage, uint32_t stride, + buffer_handle_t* outHandle) { ATRACE_CALL(); buffer_handle_t bufferHandle; - status_t error = mMapper->importBuffer(hardware::hidl_handle(rawHandle), &bufferHandle); + status_t error = mMapper->importBuffer(rawHandle, &bufferHandle); if (error != NO_ERROR) { ALOGW("importBuffer(%p) failed: %d", rawHandle, error); return error; @@ -335,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<ui::PlaneLayout>* outPlaneLayouts) { - return mMapper->getDefaultPlaneLayouts(width, height, format, layerCount, usage, - outPlaneLayouts); -} - // --------------------------------------------------------------------------- }; // namespace android |