aboutsummaryrefslogtreecommitdiff
path: root/libshims/include/ui
diff options
context:
space:
mode:
authorkoron393 <koron393@gmail.com>2019-09-16 01:32:35 +0900
committerArian <arian.kulmer@web.de>2020-02-07 20:09:45 +0100
commitde5416ca15c27aa1b204e540a5510f54b67cb3f6 (patch)
tree3300830b4fd0ee739afb124603bf8bb633f7f5e5 /libshims/include/ui
parent4d957a736845635f75cc8281d850c49d82b41275 (diff)
shinano-common: libshim_camera: Add pre N method to GraphicBuffer
* Add Marshmallow method to GraphicBuffer and Mapper. * Apply module loading changes to Allocator. Signed-off-by: koron393 <koron393@gmail.com> Change-Id: I906fa4f123afd9b9e1b62f6e53c1a2f753a027c3
Diffstat (limited to 'libshims/include/ui')
-rw-r--r--libshims/include/ui/GraphicBuffer.h18
-rw-r--r--libshims/include/ui/GraphicBufferAllocator.h4
-rw-r--r--libshims/include/ui/GraphicBufferMapper.h3
3 files changed, 24 insertions, 1 deletions
diff --git a/libshims/include/ui/GraphicBuffer.h b/libshims/include/ui/GraphicBuffer.h
index bc820b0..fbf0af0 100644
--- a/libshims/include/ui/GraphicBuffer.h
+++ b/libshims/include/ui/GraphicBuffer.h
@@ -35,6 +35,7 @@
#include <nativebase/nativebase.h>
#include <hardware/gralloc.h>
+struct ANativeWindowBuffer;
namespace android {
@@ -140,6 +141,18 @@ public:
GraphicBuffer(uint32_t inWidth, uint32_t inHeight, PixelFormat inFormat,
uint32_t inLayerCount, uint32_t inUsage, uint32_t inStride,
native_handle_t* inHandle, bool keepOwnership);
+
+ GraphicBuffer(const native_handle_t* inHandle, HandleWrapMethod method, uint32_t inWidth,
+ uint32_t inHeight, PixelFormat inFormat, uint32_t inUsage, uint32_t inStride);
+
+ GraphicBuffer(uint32_t inWidth, uint32_t inHeight, PixelFormat inFormat, 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>");
@@ -255,6 +268,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;
@@ -285,6 +302,7 @@ private:
// and informs SurfaceFlinger that it should drop its strong pointer reference to the buffer.
std::vector<std::pair<GraphicBufferDeathCallback, void* /*mDeathCallbackContext*/>>
mDeathCallbacks;
+
};
}; // namespace android
diff --git a/libshims/include/ui/GraphicBufferAllocator.h b/libshims/include/ui/GraphicBufferAllocator.h
index 25d4512..9804bea 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 {
class GrallocAllocator;
@@ -73,7 +75,7 @@ private:
GraphicBufferAllocator();
~GraphicBufferAllocator();
- GraphicBufferMapper& mMapper;
+ alloc_device_t *mAllocDev;
std::unique_ptr<const GrallocAllocator> mAllocator;
};
diff --git a/libshims/include/ui/GraphicBufferMapper.h b/libshims/include/ui/GraphicBufferMapper.h
index 2461454..45f615a 100644
--- a/libshims/include/ui/GraphicBufferMapper.h
+++ b/libshims/include/ui/GraphicBufferMapper.h
@@ -63,6 +63,9 @@ public:
status_t lock(buffer_handle_t handle, uint32_t usage, const Rect& bounds, void** vaddr,
int32_t* outBytesPerPixel = nullptr, int32_t* outBytesPerStride = nullptr);
+ status_t lock(buffer_handle_t handle,
+ uint32_t usage, const Rect& bounds, void** vaddr);
+
status_t lockYCbCr(buffer_handle_t handle,
uint32_t usage, const Rect& bounds, android_ycbcr *ycbcr);