diff options
author | koron393 <koron393@gmail.com> | 2019-05-07 02:49:25 +0900 |
---|---|---|
committer | Arian <arian.kulmer@web.de> | 2019-10-25 22:16:13 +0200 |
commit | eb4c130ccf05799fe7c20a4737f21dd63c0dbed5 (patch) | |
tree | 4845e3f7e06d660b0def654c9a294bd489dc2744 /libshims/include/ui/GraphicBufferAllocator.h | |
parent | fd201d3c1df49d4af95d2c48709b5a98b6e6d8e9 (diff) |
shinano-common: libshim_camera: Update GraphicBuffer sources to Pie
* Copy from Pie framework sources.
Change-Id: I903eb0c3c80a752d4a8da44dec47e348c7dd23fc
Signed-off-by: Nikhil Punathil <nikhilpe@gmail.com>
Diffstat (limited to 'libshims/include/ui/GraphicBufferAllocator.h')
-rw-r--r-- | libshims/include/ui/GraphicBufferAllocator.h | 50 |
1 files changed, 20 insertions, 30 deletions
diff --git a/libshims/include/ui/GraphicBufferAllocator.h b/libshims/include/ui/GraphicBufferAllocator.h index b6094a7..14a865e 100644 --- a/libshims/include/ui/GraphicBufferAllocator.h +++ b/libshims/include/ui/GraphicBufferAllocator.h @@ -20,49 +20,36 @@ #include <stdint.h> +#include <memory> +#include <string> + #include <cutils/native_handle.h> +#include <ui/PixelFormat.h> + #include <utils/Errors.h> #include <utils/KeyedVector.h> -#include <utils/threads.h> +#include <utils/Mutex.h> #include <utils/Singleton.h> -#include <ui/PixelFormat.h> - -#include <hardware/gralloc.h> - - namespace android { -// --------------------------------------------------------------------------- +namespace Gralloc2 { +class Allocator; +} + +class GraphicBufferMapper; class String8; class GraphicBufferAllocator : public Singleton<GraphicBufferAllocator> { public: - enum { - USAGE_SW_READ_NEVER = GRALLOC_USAGE_SW_READ_NEVER, - USAGE_SW_READ_RARELY = GRALLOC_USAGE_SW_READ_RARELY, - USAGE_SW_READ_OFTEN = GRALLOC_USAGE_SW_READ_OFTEN, - USAGE_SW_READ_MASK = GRALLOC_USAGE_SW_READ_MASK, - - USAGE_SW_WRITE_NEVER = GRALLOC_USAGE_SW_WRITE_NEVER, - USAGE_SW_WRITE_RARELY = GRALLOC_USAGE_SW_WRITE_RARELY, - USAGE_SW_WRITE_OFTEN = GRALLOC_USAGE_SW_WRITE_OFTEN, - USAGE_SW_WRITE_MASK = GRALLOC_USAGE_SW_WRITE_MASK, - - USAGE_SOFTWARE_MASK = USAGE_SW_READ_MASK|USAGE_SW_WRITE_MASK, - - USAGE_HW_TEXTURE = GRALLOC_USAGE_HW_TEXTURE, - USAGE_HW_RENDER = GRALLOC_USAGE_HW_RENDER, - USAGE_HW_2D = GRALLOC_USAGE_HW_2D, - USAGE_HW_MASK = GRALLOC_USAGE_HW_MASK - }; - static inline GraphicBufferAllocator& get() { return getInstance(); } - status_t alloc(uint32_t w, uint32_t h, PixelFormat format, int usage, - buffer_handle_t* handle, int32_t* stride); + status_t allocate(uint32_t w, uint32_t h, PixelFormat format, + uint32_t layerCount, uint64_t usage, + buffer_handle_t* handle, uint32_t* stride, uint64_t graphicBufferId, + std::string requestorName); status_t free(buffer_handle_t handle); @@ -75,8 +62,10 @@ private: uint32_t height; uint32_t stride; PixelFormat format; - uint32_t usage; + uint32_t layerCount; + uint64_t usage; size_t size; + std::string requestorName; }; static Mutex sLock; @@ -86,7 +75,8 @@ private: GraphicBufferAllocator(); ~GraphicBufferAllocator(); - alloc_device_t *mAllocDev; + GraphicBufferMapper& mMapper; + const std::unique_ptr<const Gralloc2::Allocator> mAllocator; }; // --------------------------------------------------------------------------- |