summaryrefslogtreecommitdiffstats
path: root/services/surfaceflinger/Layer.cpp
diff options
context:
space:
mode:
authorDaniel Lam <dalam@google.com>2012-02-23 14:35:13 -0800
committerDaniel Lam <dalam@google.com>2012-03-13 14:39:07 -0700
commitb267579ba8dfe3f47d2a481c5a3c2254e3d565a1 (patch)
tree479810e091dc94b9c3d51e8bd377496491f369c9 /services/surfaceflinger/Layer.cpp
parentfddc28d87136b55f0d9613e5f8ecd64a6aca018d (diff)
downloadframeworks_native-b267579ba8dfe3f47d2a481c5a3c2254e3d565a1.zip
frameworks_native-b267579ba8dfe3f47d2a481c5a3c2254e3d565a1.tar.gz
frameworks_native-b267579ba8dfe3f47d2a481c5a3c2254e3d565a1.tar.bz2
SurfaceTexture: Fully refactored from BufferQueue
SurfaceTexture and BufferQueue are separate objects. Change-Id: I230bc0ae6f78d0f9b2b5df902f40ab443ed5a055
Diffstat (limited to 'services/surfaceflinger/Layer.cpp')
-rw-r--r--services/surfaceflinger/Layer.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index df7fe5c..4643071 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -97,9 +97,19 @@ void Layer::onFirstRef()
}
}
};
- mSurfaceTexture = new SurfaceTextureLayer(mTextureName, this);
+
+ // Creates a custom BufferQueue for SurfaceTexture to use
+ sp<BufferQueue> bq = new SurfaceTextureLayer();
+ mSurfaceTexture = new SurfaceTexture(mTextureName, true,
+ GL_TEXTURE_EXTERNAL_OES, false,bq);
+
+
+
+ mSurfaceTexture->setTransformHint(getTransformHint());
+ mSurfaceTexture->setConsumerUsageBits(getEffectiveUsage(0));
mSurfaceTexture->setFrameAvailableListener(new FrameQueuedListener(this));
mSurfaceTexture->setSynchronousMode(true);
+
#ifdef USE_TRIPLE_BUFFERING
#warning "using triple buffering"
mSurfaceTexture->setBufferCountServer(3);
@@ -131,6 +141,14 @@ void Layer::setName(const String8& name) {
mSurfaceTexture->setName(name);
}
+void Layer::validateVisibility(const Transform& globalTransform) {
+ LayerBase::validateVisibility(globalTransform);
+
+ // This optimization allows the SurfaceTexture to bake in
+ // the rotation so hardware overlays can be used
+ mSurfaceTexture->setTransformHint(getTransformHint());
+}
+
sp<ISurface> Layer::createSurface()
{
class BSurface : public BnSurface, public LayerCleaner {
@@ -139,7 +157,7 @@ sp<ISurface> Layer::createSurface()
sp<ISurfaceTexture> res;
sp<const Layer> that( mOwner.promote() );
if (that != NULL) {
- res = that->mSurfaceTexture;
+ res = that->mSurfaceTexture->getBufferQueue();
}
return res;
}
@@ -154,7 +172,7 @@ sp<ISurface> Layer::createSurface()
wp<IBinder> Layer::getSurfaceTextureBinder() const
{
- return mSurfaceTexture->asBinder();
+ return mSurfaceTexture->getBufferQueue()->asBinder();
}
status_t Layer::setBuffers( uint32_t w, uint32_t h,
@@ -193,6 +211,7 @@ status_t Layer::setBuffers( uint32_t w, uint32_t h,
mSurfaceTexture->setDefaultBufferSize(w, h);
mSurfaceTexture->setDefaultBufferFormat(format);
+ mSurfaceTexture->setConsumerUsageBits(getEffectiveUsage(0));
// we use the red index
int displayRedSize = displayInfo.getSize(PixelFormatInfo::INDEX_RED);