diff options
Diffstat (limited to 'libshims/include')
-rw-r--r-- | libshims/include/ui/GraphicBuffer.h | 14 | ||||
-rw-r--r-- | libshims/include/ui/GraphicBufferAllocator.h | 4 | ||||
-rw-r--r-- | libshims/include/utils/VectorImpl.h | 38 |
3 files changed, 43 insertions, 13 deletions
diff --git a/libshims/include/ui/GraphicBuffer.h b/libshims/include/ui/GraphicBuffer.h index cc38982..7b4fac8 100644 --- a/libshims/include/ui/GraphicBuffer.h +++ b/libshims/include/ui/GraphicBuffer.h @@ -31,6 +31,7 @@ #include <nativebase/nativebase.h> #include <hardware/gralloc.h> +struct ANativeWindowBuffer; namespace android { @@ -126,14 +127,19 @@ public: // These functions are deprecated because they only take 32 bits of usage GraphicBuffer(const native_handle_t* handle, HandleWrapMethod method, uint32_t width, uint32_t height, - PixelFormat format, uint32_t layerCount, + PixelFormat format, uint32_t usage, uint32_t stride) : GraphicBuffer(handle, method, width, height, format, layerCount, static_cast<uint64_t>(usage), stride) {} GraphicBuffer(uint32_t inWidth, uint32_t inHeight, PixelFormat inFormat, - uint32_t inLayerCount, uint32_t inUsage, uint32_t inStride, + uint32_t inUsage, uint32_t inStride, native_handle_t* inHandle, bool keepOwnership); GraphicBuffer(uint32_t inWidth, uint32_t inHeight, PixelFormat inFormat, + uint32_t inUsage); + // create a buffer from an existing ANativeWindowBuffer + GraphicBuffer(ANativeWindowBuffer* buffer, bool keepOwnership); + + GraphicBuffer(uint32_t inWidth, uint32_t inHeight, PixelFormat inFormat, uint32_t inUsage, std::string requestorName = "<Unknown>"); // return status @@ -236,6 +242,10 @@ private: GraphicBufferMapper& mBufferMapper; ssize_t mInitCheck; + // If we're wrapping another buffer then this reference will make sure it + // doesn't get freed. + sp<ANativeWindowBuffer> mWrappedBuffer; + // numbers of fds/ints in native_handle_t to flatten uint32_t mTransportNumFds; uint32_t mTransportNumInts; diff --git a/libshims/include/ui/GraphicBufferAllocator.h b/libshims/include/ui/GraphicBufferAllocator.h index 14a865e..546fb4b 100644 --- a/libshims/include/ui/GraphicBufferAllocator.h +++ b/libshims/include/ui/GraphicBufferAllocator.h @@ -32,6 +32,8 @@ #include <utils/Mutex.h> #include <utils/Singleton.h> +#include <hardware/gralloc.h> + namespace android { namespace Gralloc2 { @@ -75,7 +77,7 @@ private: GraphicBufferAllocator(); ~GraphicBufferAllocator(); - GraphicBufferMapper& mMapper; + alloc_device_t *mAllocDev; const std::unique_ptr<const Gralloc2::Allocator> mAllocator; }; diff --git a/libshims/include/utils/VectorImpl.h b/libshims/include/utils/VectorImpl.h index 4dd91fd..f5fa742 100644 --- a/libshims/include/utils/VectorImpl.h +++ b/libshims/include/utils/VectorImpl.h @@ -53,12 +53,12 @@ public: /*! must be called from subclasses destructor */ void finish_vector(); - VectorImpl& operator = (const VectorImpl& rhs); - + VectorImpl& operator = (const VectorImpl& rhs); + /*! C-style array access */ inline const void* arrayImpl() const { return mStorage; } void* editArrayImpl(); - + /*! vector stats */ inline size_t size() const { return mCount; } inline bool isEmpty() const { return mCount == 0; } @@ -71,7 +71,7 @@ public: ssize_t appendVector(const VectorImpl& vector); ssize_t insertArrayAt(const void* array, size_t index, size_t length); ssize_t appendArray(const void* array, size_t length); - + /*! add/insert/replace items */ ssize_t insertAt(size_t where, size_t numItems = 1); ssize_t insertAt(const void* item, size_t where, size_t numItems = 1); @@ -105,7 +105,16 @@ protected: virtual void do_splat(void* dest, const void* item, size_t num) const = 0; virtual void do_move_forward(void* dest, const void* from, size_t num) const = 0; virtual void do_move_backward(void* dest, const void* from, size_t num) const = 0; - + + virtual void reservedVectorImpl1(); + virtual void reservedVectorImpl2(); + virtual void reservedVectorImpl3(); + virtual void reservedVectorImpl4(); + virtual void reservedVectorImpl5(); + virtual void reservedVectorImpl6(); + virtual void reservedVectorImpl7(); + virtual void reservedVectorImpl8(); + private: void* _grow(size_t where, size_t amount); void _shrink(size_t where, size_t amount); @@ -132,10 +141,10 @@ class SortedVectorImpl : public VectorImpl { public: SortedVectorImpl(size_t itemSize, uint32_t flags); - explicit SortedVectorImpl(const VectorImpl& rhs); + SortedVectorImpl(const VectorImpl& rhs); virtual ~SortedVectorImpl(); - - SortedVectorImpl& operator = (const SortedVectorImpl& rhs); + + SortedVectorImpl& operator = (const SortedVectorImpl& rhs); //! finds the index of an item ssize_t indexOf(const void* item) const; @@ -149,13 +158,22 @@ public: //! merges a vector into this one ssize_t merge(const VectorImpl& vector); ssize_t merge(const SortedVectorImpl& vector); - + //! removes an item ssize_t remove(const void* item); - + protected: virtual int do_compare(const void* lhs, const void* rhs) const = 0; + virtual void reservedSortedVectorImpl1(); + virtual void reservedSortedVectorImpl2(); + virtual void reservedSortedVectorImpl3(); + virtual void reservedSortedVectorImpl4(); + virtual void reservedSortedVectorImpl5(); + virtual void reservedSortedVectorImpl6(); + virtual void reservedSortedVectorImpl7(); + virtual void reservedSortedVectorImpl8(); + private: ssize_t _indexOrderOf(const void* item, size_t* order = 0) const; |