diff options
| author | 2019-06-20 14:20:52 -0700 | |
|---|---|---|
| committer | 2019-08-19 15:07:05 -0700 | |
| commit | 87c8ba767a25a4ee054d6c274405de89aae968c4 (patch) | |
| tree | 331d055b96ffd8fc18c6afa1e2b5e68b50f37292 /libs/ui/GraphicBufferMapper.cpp | |
| parent | 1b397ddcdaa01911580a8a26445afa4e844328b9 (diff) | |
gralloc: add IAllocator/IMapper 4.0 to frameworks/native
Add support for gralloc 4.0 to the framework.
Bug: 136016160
Test: Compiles and boots
Change-Id: I26408e984308fa557e102efabb60302907310308
Diffstat (limited to 'libs/ui/GraphicBufferMapper.cpp')
| -rw-r--r-- | libs/ui/GraphicBufferMapper.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/libs/ui/GraphicBufferMapper.cpp b/libs/ui/GraphicBufferMapper.cpp index 25b7247b1b..4d087d151c 100644 --- a/libs/ui/GraphicBufferMapper.cpp +++ b/libs/ui/GraphicBufferMapper.cpp @@ -35,6 +35,7 @@ #include <ui/Gralloc.h> #include <ui/Gralloc2.h> #include <ui/Gralloc3.h> +#include <ui/Gralloc4.h> #include <ui/GraphicBuffer.h> #include <system/graphics.h> @@ -47,20 +48,27 @@ ANDROID_SINGLETON_STATIC_INSTANCE( GraphicBufferMapper ) void GraphicBufferMapper::preloadHal() { Gralloc2Mapper::preload(); Gralloc3Mapper::preload(); + Gralloc4Mapper::preload(); } GraphicBufferMapper::GraphicBufferMapper() { + mMapper = std::make_unique<const Gralloc4Mapper>(); + if (mMapper->isLoaded()) { + mMapperVersion = Version::GRALLOC_4; + return; + } mMapper = std::make_unique<const Gralloc3Mapper>(); - if (!mMapper->isLoaded()) { - mMapper = std::make_unique<const Gralloc2Mapper>(); - mMapperVersion = Version::GRALLOC_2; - } else { + if (mMapper->isLoaded()) { mMapperVersion = Version::GRALLOC_3; + return; } - - if (!mMapper->isLoaded()) { - LOG_ALWAYS_FATAL("gralloc-mapper is missing"); + mMapper = std::make_unique<const Gralloc2Mapper>(); + if (mMapper->isLoaded()) { + mMapperVersion = Version::GRALLOC_2; + return; } + + LOG_ALWAYS_FATAL("gralloc-mapper is missing"); } status_t GraphicBufferMapper::importBuffer(buffer_handle_t rawHandle, |