summaryrefslogtreecommitdiffstats
path: root/libs/ui
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2009-10-26 20:12:37 -0700
committerMathias Agopian <mathias@google.com>2009-10-27 13:13:29 -0700
commit54ba51dff21de666c5ae3bf3abd4f0634ebb0676 (patch)
tree58a69dccdbfd227b9de3c58a416de45d2a8d3513 /libs/ui
parent36bc94173c957f33f70bcd16c369951f5b2dc3f6 (diff)
downloadframeworks_native-54ba51dff21de666c5ae3bf3abd4f0634ebb0676.zip
frameworks_native-54ba51dff21de666c5ae3bf3abd4f0634ebb0676.tar.gz
frameworks_native-54ba51dff21de666c5ae3bf3abd4f0634ebb0676.tar.bz2
fix [2143798] Need to figure out how to do video
Use EGLImageKHR instead of copybit directly. We now have the basis to use streaming YUV textures (well, in fact we already are). When/if we use the GPU instead of the MDP we'll need to make sure it supports the appropriate YUV format. Also make sure we compile if EGL_ANDROID_image_native_buffer is not supported
Diffstat (limited to 'libs/ui')
-rw-r--r--libs/ui/GraphicBuffer.cpp28
1 files changed, 23 insertions, 5 deletions
diff --git a/libs/ui/GraphicBuffer.cpp b/libs/ui/GraphicBuffer.cpp
index 1cf20d7..efe2d78 100644
--- a/libs/ui/GraphicBuffer.cpp
+++ b/libs/ui/GraphicBuffer.cpp
@@ -37,7 +37,7 @@ namespace android {
// ===========================================================================
GraphicBuffer::GraphicBuffer()
- : BASE(), mOwner(false), mBufferMapper(GraphicBufferMapper::get()),
+ : BASE(), mOwner(ownData), mBufferMapper(GraphicBufferMapper::get()),
mInitCheck(NO_ERROR), mVStride(0), mIndex(-1)
{
width =
@@ -50,7 +50,7 @@ GraphicBuffer::GraphicBuffer()
GraphicBuffer::GraphicBuffer(uint32_t w, uint32_t h,
PixelFormat reqFormat, uint32_t reqUsage)
- : BASE(), mOwner(false), mBufferMapper(GraphicBufferMapper::get()),
+ : BASE(), mOwner(ownData), mBufferMapper(GraphicBufferMapper::get()),
mInitCheck(NO_ERROR), mVStride(0), mIndex(-1)
{
width =
@@ -62,8 +62,23 @@ GraphicBuffer::GraphicBuffer(uint32_t w, uint32_t h,
mInitCheck = initSize(w, h, reqFormat, reqUsage);
}
+GraphicBuffer::GraphicBuffer(uint32_t w, uint32_t h,
+ PixelFormat inFormat, uint32_t inUsage,
+ uint32_t inStride, native_handle_t* inHandle, bool keepOwnership)
+ : BASE(), mOwner(keepOwnership ? ownHandle : ownNone),
+ mBufferMapper(GraphicBufferMapper::get()),
+ mInitCheck(NO_ERROR), mVStride(0), mIndex(-1)
+{
+ width = w;
+ height = h;
+ stride = inStride;
+ format = inFormat;
+ usage = inUsage;
+ handle = inHandle;
+}
+
GraphicBuffer::GraphicBuffer(const Parcel& data)
- : BASE(), mOwner(true), mBufferMapper(GraphicBufferMapper::get()),
+ : BASE(), mOwner(ownHandle), mBufferMapper(GraphicBufferMapper::get()),
mInitCheck(NO_ERROR), mVStride(0), mIndex(-1)
{
// we own the handle in this case
@@ -83,10 +98,10 @@ GraphicBuffer::GraphicBuffer(const Parcel& data)
GraphicBuffer::~GraphicBuffer()
{
if (handle) {
- if (mOwner) {
+ if (mOwner == ownHandle) {
native_handle_close(handle);
native_handle_delete(const_cast<native_handle*>(handle));
- } else {
+ } else if (mOwner == ownData) {
GraphicBufferAllocator& allocator(GraphicBufferAllocator::get());
allocator.free(handle);
}
@@ -106,6 +121,9 @@ android_native_buffer_t* GraphicBuffer::getNativeBuffer() const
status_t GraphicBuffer::reallocate(uint32_t w, uint32_t h, PixelFormat f,
uint32_t reqUsage)
{
+ if (mOwner != ownData)
+ return INVALID_OPERATION;
+
if (handle) {
GraphicBufferAllocator& allocator(GraphicBufferAllocator::get());
allocator.free(handle);