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/GraphicBufferMapper.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/GraphicBufferMapper.h')
-rw-r--r-- | libshims/include/ui/GraphicBufferMapper.h | 52 |
1 files changed, 43 insertions, 9 deletions
diff --git a/libshims/include/ui/GraphicBufferMapper.h b/libshims/include/ui/GraphicBufferMapper.h index fbfdfc3..7cf003d 100644 --- a/libshims/include/ui/GraphicBufferMapper.h +++ b/libshims/include/ui/GraphicBufferMapper.h @@ -20,43 +20,77 @@ #include <stdint.h> #include <sys/types.h> +#include <memory> + +#include <ui/PixelFormat.h> #include <utils/Singleton.h> -#include <hardware/gralloc.h> +// Needed by code that still uses the GRALLOC_USAGE_* constants. +// when/if we get rid of gralloc, we should provide aliases or fix call sites. +#include <hardware/gralloc.h> -struct gralloc_module_t; namespace android { // --------------------------------------------------------------------------- +namespace Gralloc2 { +class Mapper; +} + class Rect; class GraphicBufferMapper : public Singleton<GraphicBufferMapper> { public: + static void preloadHal(); static inline GraphicBufferMapper& get() { return getInstance(); } - status_t registerBuffer(buffer_handle_t handle); + // The imported outHandle must be freed with freeBuffer when no longer + // needed. rawHandle is owned by the caller. + status_t 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 freeBuffer(buffer_handle_t handle); - status_t unregisterBuffer(buffer_handle_t handle); + void getTransportSize(buffer_handle_t handle, + uint32_t* outTransportNumFds, uint32_t* outTransportNumInts); status_t lock(buffer_handle_t handle, - int usage, const Rect& bounds, void** vaddr); + uint32_t usage, const Rect& bounds, void** vaddr); status_t lockYCbCr(buffer_handle_t handle, - int usage, const Rect& bounds, android_ycbcr *ycbcr); + uint32_t usage, const Rect& bounds, android_ycbcr *ycbcr); status_t unlock(buffer_handle_t handle); - // dumps information about the mapping of this handle - void dump(buffer_handle_t handle); + status_t lockAsync(buffer_handle_t handle, + uint32_t usage, const Rect& bounds, void** vaddr, int fenceFd); + + status_t lockAsync(buffer_handle_t handle, + uint64_t producerUsage, uint64_t consumerUsage, const Rect& bounds, + void** vaddr, int fenceFd); + + status_t lockAsyncYCbCr(buffer_handle_t handle, + uint32_t usage, const Rect& bounds, android_ycbcr *ycbcr, + int fenceFd); + + status_t unlockAsync(buffer_handle_t handle, int *fenceFd); + + const Gralloc2::Mapper& getGrallocMapper() const + { + return *mMapper; + } private: friend class Singleton<GraphicBufferMapper>; + GraphicBufferMapper(); - gralloc_module_t const *mAllocMod; + + const std::unique_ptr<const Gralloc2::Mapper> mMapper; }; // --------------------------------------------------------------------------- |