summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEino-Ville Talvala <etalvala@google.com>2012-04-13 15:16:31 -0700
committerEino-Ville Talvala <etalvala@google.com>2012-04-18 10:56:06 -0700
commit85b217668d6840c8e6a109adfb99461313676f8d (patch)
tree2da4657f1fb3a37e1e7ee0b9abbc2aa5e78d5ace
parentaa1667f006b8900c63f9b8de6883f06dc3980b91 (diff)
downloadframeworks_native-85b217668d6840c8e6a109adfb99461313676f8d.zip
frameworks_native-85b217668d6840c8e6a109adfb99461313676f8d.tar.gz
frameworks_native-85b217668d6840c8e6a109adfb99461313676f8d.tar.bz2
Remove fixed USAGE_HW_TEXTURE flag from BufferQueue.
USAGE_HW_TEXTURE applies to SurfaceTexture, not to all uses of BufferQueue. Refactor accordingly. Change-Id: Ic7add5e1f2bbec3d3e796ba7f15eaa0633945d8f
-rw-r--r--include/gui/SurfaceTexture.h6
-rw-r--r--libs/gui/BufferQueue.cpp1
-rw-r--r--libs/gui/SurfaceTexture.cpp2
3 files changed, 8 insertions, 1 deletions
diff --git a/include/gui/SurfaceTexture.h b/include/gui/SurfaceTexture.h
index 1a0d779..3699cdf 100644
--- a/include/gui/SurfaceTexture.h
+++ b/include/gui/SurfaceTexture.h
@@ -257,6 +257,12 @@ private:
// before the outstanding accesses have completed.
status_t syncForReleaseLocked(EGLDisplay dpy);
+ // The default consumer usage flags that SurfaceTexture always sets on its
+ // BufferQueue instance; these will be OR:d with any additional flags passed
+ // from the SurfaceTexture user. In particular, SurfaceTexture will always
+ // consume buffers as hardware textures.
+ static const uint32_t DEFAULT_USAGE_FLAGS = GraphicBuffer::USAGE_HW_TEXTURE;
+
// mCurrentTextureBuf is the graphic buffer of the current texture. It's
// possible that this buffer is not associated with any buffer slot, so we
// must track it separately in order to support the getCurrentBuffer method.
diff --git a/libs/gui/BufferQueue.cpp b/libs/gui/BufferQueue.cpp
index ece0494..c851e86 100644
--- a/libs/gui/BufferQueue.cpp
+++ b/libs/gui/BufferQueue.cpp
@@ -450,7 +450,6 @@ status_t BufferQueue::dequeueBuffer(int *outBuf, uint32_t w, uint32_t h,
(uint32_t(buffer->format) != format) ||
((uint32_t(buffer->usage) & usage) != usage))
{
- usage |= GraphicBuffer::USAGE_HW_TEXTURE;
status_t error;
sp<GraphicBuffer> graphicBuffer(
mGraphicBufferAlloc->createGraphicBuffer(
diff --git a/libs/gui/SurfaceTexture.cpp b/libs/gui/SurfaceTexture.cpp
index a6ee971..a6e8dbf 100644
--- a/libs/gui/SurfaceTexture.cpp
+++ b/libs/gui/SurfaceTexture.cpp
@@ -150,6 +150,7 @@ SurfaceTexture::SurfaceTexture(GLuint tex, bool allowSynchronousMode,
strerror(-err), err);
} else {
mBufferQueue->setConsumerName(mName);
+ mBufferQueue->setConsumerUsageBits(DEFAULT_USAGE_FLAGS);
}
}
@@ -720,6 +721,7 @@ status_t SurfaceTexture::setDefaultBufferFormat(uint32_t defaultFormat) {
status_t SurfaceTexture::setConsumerUsageBits(uint32_t usage) {
Mutex::Autolock lock(mMutex);
+ usage |= DEFAULT_USAGE_FLAGS;
return mBufferQueue->setConsumerUsageBits(usage);
}