Loading include/gui/GraphicBufferAlloc.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -35,7 +35,7 @@ public: virtual ~GraphicBufferAlloc(); virtual ~GraphicBufferAlloc(); virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t width, virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t width, uint32_t height, PixelFormat format, uint32_t usage, uint32_t height, PixelFormat format, uint32_t usage, status_t* error); std::string requestorName, status_t* error) override; }; }; Loading include/gui/IGraphicBufferAlloc.h +10 −3 Original line number Original line Diff line number Diff line Loading @@ -21,14 +21,15 @@ #include <sys/types.h> #include <sys/types.h> #include <binder/IInterface.h> #include <binder/IInterface.h> #include <ui/GraphicBuffer.h> #include <ui/PixelFormat.h> #include <ui/PixelFormat.h> #include <utils/RefBase.h> #include <utils/RefBase.h> #include <string> namespace android { namespace android { // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- class GraphicBuffer; class IGraphicBufferAlloc : public IInterface class IGraphicBufferAlloc : public IInterface { { public: public: Loading @@ -37,7 +38,13 @@ public: /* Create a new GraphicBuffer for the client to use. /* Create a new GraphicBuffer for the client to use. */ */ virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t w, uint32_t h, virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t w, uint32_t h, PixelFormat format, uint32_t usage, status_t* error) = 0; PixelFormat format, uint32_t usage, std::string requestorName, status_t* error) = 0; sp<GraphicBuffer> createGraphicBuffer(uint32_t w, uint32_t h, PixelFormat format, uint32_t usage, status_t* error) { return createGraphicBuffer(w, h, format, usage, "<Unknown>", error); } }; }; // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- Loading include/ui/GraphicBuffer.h +3 −2 Original line number Original line Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include <utils/Flattenable.h> #include <utils/Flattenable.h> #include <utils/RefBase.h> #include <utils/RefBase.h> #include <string> struct ANativeWindowBuffer; struct ANativeWindowBuffer; Loading Loading @@ -73,7 +74,7 @@ public: // creates w * h buffer // creates w * h buffer GraphicBuffer(uint32_t inWidth, uint32_t inHeight, PixelFormat inFormat, GraphicBuffer(uint32_t inWidth, uint32_t inHeight, PixelFormat inFormat, uint32_t inUsage); uint32_t inUsage, std::string requestorName = "<Unknown>"); // create a buffer from an existing handle // create a buffer from an existing handle GraphicBuffer(uint32_t inWidth, uint32_t inHeight, PixelFormat inFormat, GraphicBuffer(uint32_t inWidth, uint32_t inHeight, PixelFormat inFormat, Loading Loading @@ -159,7 +160,7 @@ private: const GraphicBuffer& operator = (const GraphicBuffer& rhs) const; const GraphicBuffer& operator = (const GraphicBuffer& rhs) const; status_t initSize(uint32_t inWidth, uint32_t inHeight, PixelFormat inFormat, status_t initSize(uint32_t inWidth, uint32_t inHeight, PixelFormat inFormat, uint32_t inUsage); uint32_t inUsage, std::string requestorName); void free_handle(); void free_handle(); Loading include/ui/GraphicBufferAllocator.h +20 −19 Original line number Original line Diff line number Diff line Loading @@ -27,42 +27,41 @@ #include <utils/threads.h> #include <utils/threads.h> #include <utils/Singleton.h> #include <utils/Singleton.h> #include <ui/Gralloc1.h> #include <ui/PixelFormat.h> #include <ui/PixelFormat.h> #include <hardware/gralloc.h> namespace android { namespace android { // --------------------------------------------------------------------------- class Gralloc1Loader; class String8; class String8; class GraphicBufferAllocator : public Singleton<GraphicBufferAllocator> class GraphicBufferAllocator : public Singleton<GraphicBufferAllocator> { { public: public: enum { enum { USAGE_SW_READ_NEVER = GRALLOC_USAGE_SW_READ_NEVER, USAGE_SW_READ_NEVER = GRALLOC1_CONSUMER_USAGE_CPU_READ_NEVER, USAGE_SW_READ_RARELY = GRALLOC_USAGE_SW_READ_RARELY, USAGE_SW_READ_RARELY = GRALLOC1_CONSUMER_USAGE_CPU_READ, USAGE_SW_READ_OFTEN = GRALLOC_USAGE_SW_READ_OFTEN, USAGE_SW_READ_OFTEN = GRALLOC1_CONSUMER_USAGE_CPU_READ_OFTEN, USAGE_SW_READ_MASK = GRALLOC_USAGE_SW_READ_MASK, USAGE_SW_READ_MASK = GRALLOC1_CONSUMER_USAGE_CPU_READ_OFTEN, USAGE_SW_WRITE_NEVER = GRALLOC_USAGE_SW_WRITE_NEVER, USAGE_SW_WRITE_NEVER = GRALLOC1_PRODUCER_USAGE_CPU_WRITE_NEVER, USAGE_SW_WRITE_RARELY = GRALLOC_USAGE_SW_WRITE_RARELY, USAGE_SW_WRITE_RARELY = GRALLOC1_PRODUCER_USAGE_CPU_WRITE, USAGE_SW_WRITE_OFTEN = GRALLOC_USAGE_SW_WRITE_OFTEN, USAGE_SW_WRITE_OFTEN = GRALLOC1_PRODUCER_USAGE_CPU_WRITE_OFTEN, USAGE_SW_WRITE_MASK = GRALLOC_USAGE_SW_WRITE_MASK, USAGE_SW_WRITE_MASK = GRALLOC1_PRODUCER_USAGE_CPU_WRITE_OFTEN, USAGE_SOFTWARE_MASK = USAGE_SW_READ_MASK|USAGE_SW_WRITE_MASK, USAGE_SOFTWARE_MASK = USAGE_SW_READ_MASK|USAGE_SW_WRITE_MASK, USAGE_HW_TEXTURE = GRALLOC_USAGE_HW_TEXTURE, USAGE_HW_TEXTURE = GRALLOC1_CONSUMER_USAGE_GPU_TEXTURE, USAGE_HW_RENDER = GRALLOC_USAGE_HW_RENDER, USAGE_HW_RENDER = GRALLOC1_PRODUCER_USAGE_GPU_RENDER_TARGET, USAGE_HW_2D = GRALLOC_USAGE_HW_2D, USAGE_HW_2D = 0x00000400, // Deprecated USAGE_HW_MASK = GRALLOC_USAGE_HW_MASK USAGE_HW_MASK = 0x00071F00, // Deprecated }; }; static inline GraphicBufferAllocator& get() { return getInstance(); } static inline GraphicBufferAllocator& get() { return getInstance(); } status_t alloc(uint32_t w, uint32_t h, PixelFormat format, uint32_t usage, status_t allocate(uint32_t w, uint32_t h, PixelFormat format, buffer_handle_t* handle, uint32_t* stride); uint32_t usage, buffer_handle_t* handle, uint32_t* stride, uint64_t graphicBufferId, std::string requestorName); status_t free(buffer_handle_t handle); status_t free(buffer_handle_t handle); Loading @@ -77,6 +76,7 @@ private: PixelFormat format; PixelFormat format; uint32_t usage; uint32_t usage; size_t size; size_t size; std::string requestorName; }; }; static Mutex sLock; static Mutex sLock; Loading @@ -86,7 +86,8 @@ private: GraphicBufferAllocator(); GraphicBufferAllocator(); ~GraphicBufferAllocator(); ~GraphicBufferAllocator(); alloc_device_t *mAllocDev; std::unique_ptr<Gralloc1::Loader> mLoader; std::unique_ptr<Gralloc1::Device> mDevice; }; }; // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- Loading include/ui/GraphicBufferMapper.h +7 −9 Original line number Original line Diff line number Diff line Loading @@ -20,12 +20,9 @@ #include <stdint.h> #include <stdint.h> #include <sys/types.h> #include <sys/types.h> #include <utils/Singleton.h> #include <ui/Gralloc1.h> #include <hardware/gralloc.h> #include <utils/Singleton.h> struct gralloc_module_t; namespace android { namespace android { Loading @@ -39,6 +36,7 @@ public: static inline GraphicBufferMapper& get() { return getInstance(); } static inline GraphicBufferMapper& get() { return getInstance(); } status_t registerBuffer(buffer_handle_t handle); status_t registerBuffer(buffer_handle_t handle); status_t registerBuffer(const GraphicBuffer* buffer); status_t unregisterBuffer(buffer_handle_t handle); status_t unregisterBuffer(buffer_handle_t handle); Loading @@ -59,13 +57,13 @@ public: status_t unlockAsync(buffer_handle_t handle, int *fenceFd); status_t unlockAsync(buffer_handle_t handle, int *fenceFd); // dumps information about the mapping of this handle void dump(buffer_handle_t handle); private: private: friend class Singleton<GraphicBufferMapper>; friend class Singleton<GraphicBufferMapper>; GraphicBufferMapper(); GraphicBufferMapper(); gralloc_module_t const *mAllocMod; std::unique_ptr<Gralloc1::Loader> mLoader; std::unique_ptr<Gralloc1::Device> mDevice; }; }; // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- Loading Loading
include/gui/GraphicBufferAlloc.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -35,7 +35,7 @@ public: virtual ~GraphicBufferAlloc(); virtual ~GraphicBufferAlloc(); virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t width, virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t width, uint32_t height, PixelFormat format, uint32_t usage, uint32_t height, PixelFormat format, uint32_t usage, status_t* error); std::string requestorName, status_t* error) override; }; }; Loading
include/gui/IGraphicBufferAlloc.h +10 −3 Original line number Original line Diff line number Diff line Loading @@ -21,14 +21,15 @@ #include <sys/types.h> #include <sys/types.h> #include <binder/IInterface.h> #include <binder/IInterface.h> #include <ui/GraphicBuffer.h> #include <ui/PixelFormat.h> #include <ui/PixelFormat.h> #include <utils/RefBase.h> #include <utils/RefBase.h> #include <string> namespace android { namespace android { // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- class GraphicBuffer; class IGraphicBufferAlloc : public IInterface class IGraphicBufferAlloc : public IInterface { { public: public: Loading @@ -37,7 +38,13 @@ public: /* Create a new GraphicBuffer for the client to use. /* Create a new GraphicBuffer for the client to use. */ */ virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t w, uint32_t h, virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t w, uint32_t h, PixelFormat format, uint32_t usage, status_t* error) = 0; PixelFormat format, uint32_t usage, std::string requestorName, status_t* error) = 0; sp<GraphicBuffer> createGraphicBuffer(uint32_t w, uint32_t h, PixelFormat format, uint32_t usage, status_t* error) { return createGraphicBuffer(w, h, format, usage, "<Unknown>", error); } }; }; // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- Loading
include/ui/GraphicBuffer.h +3 −2 Original line number Original line Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include <utils/Flattenable.h> #include <utils/Flattenable.h> #include <utils/RefBase.h> #include <utils/RefBase.h> #include <string> struct ANativeWindowBuffer; struct ANativeWindowBuffer; Loading Loading @@ -73,7 +74,7 @@ public: // creates w * h buffer // creates w * h buffer GraphicBuffer(uint32_t inWidth, uint32_t inHeight, PixelFormat inFormat, GraphicBuffer(uint32_t inWidth, uint32_t inHeight, PixelFormat inFormat, uint32_t inUsage); uint32_t inUsage, std::string requestorName = "<Unknown>"); // create a buffer from an existing handle // create a buffer from an existing handle GraphicBuffer(uint32_t inWidth, uint32_t inHeight, PixelFormat inFormat, GraphicBuffer(uint32_t inWidth, uint32_t inHeight, PixelFormat inFormat, Loading Loading @@ -159,7 +160,7 @@ private: const GraphicBuffer& operator = (const GraphicBuffer& rhs) const; const GraphicBuffer& operator = (const GraphicBuffer& rhs) const; status_t initSize(uint32_t inWidth, uint32_t inHeight, PixelFormat inFormat, status_t initSize(uint32_t inWidth, uint32_t inHeight, PixelFormat inFormat, uint32_t inUsage); uint32_t inUsage, std::string requestorName); void free_handle(); void free_handle(); Loading
include/ui/GraphicBufferAllocator.h +20 −19 Original line number Original line Diff line number Diff line Loading @@ -27,42 +27,41 @@ #include <utils/threads.h> #include <utils/threads.h> #include <utils/Singleton.h> #include <utils/Singleton.h> #include <ui/Gralloc1.h> #include <ui/PixelFormat.h> #include <ui/PixelFormat.h> #include <hardware/gralloc.h> namespace android { namespace android { // --------------------------------------------------------------------------- class Gralloc1Loader; class String8; class String8; class GraphicBufferAllocator : public Singleton<GraphicBufferAllocator> class GraphicBufferAllocator : public Singleton<GraphicBufferAllocator> { { public: public: enum { enum { USAGE_SW_READ_NEVER = GRALLOC_USAGE_SW_READ_NEVER, USAGE_SW_READ_NEVER = GRALLOC1_CONSUMER_USAGE_CPU_READ_NEVER, USAGE_SW_READ_RARELY = GRALLOC_USAGE_SW_READ_RARELY, USAGE_SW_READ_RARELY = GRALLOC1_CONSUMER_USAGE_CPU_READ, USAGE_SW_READ_OFTEN = GRALLOC_USAGE_SW_READ_OFTEN, USAGE_SW_READ_OFTEN = GRALLOC1_CONSUMER_USAGE_CPU_READ_OFTEN, USAGE_SW_READ_MASK = GRALLOC_USAGE_SW_READ_MASK, USAGE_SW_READ_MASK = GRALLOC1_CONSUMER_USAGE_CPU_READ_OFTEN, USAGE_SW_WRITE_NEVER = GRALLOC_USAGE_SW_WRITE_NEVER, USAGE_SW_WRITE_NEVER = GRALLOC1_PRODUCER_USAGE_CPU_WRITE_NEVER, USAGE_SW_WRITE_RARELY = GRALLOC_USAGE_SW_WRITE_RARELY, USAGE_SW_WRITE_RARELY = GRALLOC1_PRODUCER_USAGE_CPU_WRITE, USAGE_SW_WRITE_OFTEN = GRALLOC_USAGE_SW_WRITE_OFTEN, USAGE_SW_WRITE_OFTEN = GRALLOC1_PRODUCER_USAGE_CPU_WRITE_OFTEN, USAGE_SW_WRITE_MASK = GRALLOC_USAGE_SW_WRITE_MASK, USAGE_SW_WRITE_MASK = GRALLOC1_PRODUCER_USAGE_CPU_WRITE_OFTEN, USAGE_SOFTWARE_MASK = USAGE_SW_READ_MASK|USAGE_SW_WRITE_MASK, USAGE_SOFTWARE_MASK = USAGE_SW_READ_MASK|USAGE_SW_WRITE_MASK, USAGE_HW_TEXTURE = GRALLOC_USAGE_HW_TEXTURE, USAGE_HW_TEXTURE = GRALLOC1_CONSUMER_USAGE_GPU_TEXTURE, USAGE_HW_RENDER = GRALLOC_USAGE_HW_RENDER, USAGE_HW_RENDER = GRALLOC1_PRODUCER_USAGE_GPU_RENDER_TARGET, USAGE_HW_2D = GRALLOC_USAGE_HW_2D, USAGE_HW_2D = 0x00000400, // Deprecated USAGE_HW_MASK = GRALLOC_USAGE_HW_MASK USAGE_HW_MASK = 0x00071F00, // Deprecated }; }; static inline GraphicBufferAllocator& get() { return getInstance(); } static inline GraphicBufferAllocator& get() { return getInstance(); } status_t alloc(uint32_t w, uint32_t h, PixelFormat format, uint32_t usage, status_t allocate(uint32_t w, uint32_t h, PixelFormat format, buffer_handle_t* handle, uint32_t* stride); uint32_t usage, buffer_handle_t* handle, uint32_t* stride, uint64_t graphicBufferId, std::string requestorName); status_t free(buffer_handle_t handle); status_t free(buffer_handle_t handle); Loading @@ -77,6 +76,7 @@ private: PixelFormat format; PixelFormat format; uint32_t usage; uint32_t usage; size_t size; size_t size; std::string requestorName; }; }; static Mutex sLock; static Mutex sLock; Loading @@ -86,7 +86,8 @@ private: GraphicBufferAllocator(); GraphicBufferAllocator(); ~GraphicBufferAllocator(); ~GraphicBufferAllocator(); alloc_device_t *mAllocDev; std::unique_ptr<Gralloc1::Loader> mLoader; std::unique_ptr<Gralloc1::Device> mDevice; }; }; // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- Loading
include/ui/GraphicBufferMapper.h +7 −9 Original line number Original line Diff line number Diff line Loading @@ -20,12 +20,9 @@ #include <stdint.h> #include <stdint.h> #include <sys/types.h> #include <sys/types.h> #include <utils/Singleton.h> #include <ui/Gralloc1.h> #include <hardware/gralloc.h> #include <utils/Singleton.h> struct gralloc_module_t; namespace android { namespace android { Loading @@ -39,6 +36,7 @@ public: static inline GraphicBufferMapper& get() { return getInstance(); } static inline GraphicBufferMapper& get() { return getInstance(); } status_t registerBuffer(buffer_handle_t handle); status_t registerBuffer(buffer_handle_t handle); status_t registerBuffer(const GraphicBuffer* buffer); status_t unregisterBuffer(buffer_handle_t handle); status_t unregisterBuffer(buffer_handle_t handle); Loading @@ -59,13 +57,13 @@ public: status_t unlockAsync(buffer_handle_t handle, int *fenceFd); status_t unlockAsync(buffer_handle_t handle, int *fenceFd); // dumps information about the mapping of this handle void dump(buffer_handle_t handle); private: private: friend class Singleton<GraphicBufferMapper>; friend class Singleton<GraphicBufferMapper>; GraphicBufferMapper(); GraphicBufferMapper(); gralloc_module_t const *mAllocMod; std::unique_ptr<Gralloc1::Loader> mLoader; std::unique_ptr<Gralloc1::Device> mDevice; }; }; // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- Loading