diff options
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; }; // --------------------------------------------------------------------------- |