summaryrefslogtreecommitdiff
path: root/libs/gui/SurfaceControl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/gui/SurfaceControl.cpp')
-rw-r--r--libs/gui/SurfaceControl.cpp56
1 files changed, 24 insertions, 32 deletions
diff --git a/libs/gui/SurfaceControl.cpp b/libs/gui/SurfaceControl.cpp
index 55488dad0b..a332a1f2a8 100644
--- a/libs/gui/SurfaceControl.cpp
+++ b/libs/gui/SurfaceControl.cpp
@@ -45,42 +45,23 @@ namespace android {
// SurfaceControl
// ============================================================================
-SurfaceControl::SurfaceControl(
- const sp<SurfaceComposerClient>& client,
- const sp<IBinder>& handle,
- const sp<IGraphicBufferProducer>& gbp,
- bool owned)
- : mClient(client), mHandle(handle), mGraphicBufferProducer(gbp), mOwned(owned)
-{
-}
+SurfaceControl::SurfaceControl(const sp<SurfaceComposerClient>& client, const sp<IBinder>& handle,
+ const sp<IGraphicBufferProducer>& gbp,
+ uint32_t transform)
+ : mClient(client),
+ mHandle(handle),
+ mGraphicBufferProducer(gbp),
+ mTransformHint(transform) {}
SurfaceControl::SurfaceControl(const sp<SurfaceControl>& other) {
mClient = other->mClient;
mHandle = other->mHandle;
mGraphicBufferProducer = other->mGraphicBufferProducer;
- mOwned = false;
+ mTransformHint = other->mTransformHint;
}
SurfaceControl::~SurfaceControl()
{
- // Avoid reparenting the server-side surface to null if we are not the owner of it,
- // meaning that we retrieved it from another process.
- if (mClient != nullptr && mHandle != nullptr && mOwned) {
- SurfaceComposerClient::doDropReferenceTransaction(mHandle, mClient->getClient());
- }
- release();
-}
-
-void SurfaceControl::destroy()
-{
- if (isValid()) {
- SurfaceComposerClient::Transaction().reparent(this, nullptr).apply();
- }
- release();
-}
-
-void SurfaceControl::release()
-{
// Trigger an IPC now, to make sure things
// happen without delay, since these resources are quite heavy.
mClient.clear();
@@ -164,7 +145,6 @@ sp<Surface> SurfaceControl::createSurface() const
sp<IBinder> SurfaceControl::getHandle() const
{
- Mutex::Autolock lock(mLock);
return mHandle;
}
@@ -179,15 +159,25 @@ sp<SurfaceComposerClient> SurfaceControl::getClient() const
return mClient;
}
+uint32_t SurfaceControl::getTransformHint() const {
+ Mutex::Autolock _l(mLock);
+ return mTransformHint;
+}
+
+void SurfaceControl::setTransformHint(uint32_t hint) {
+ Mutex::Autolock _l(mLock);
+ mTransformHint = hint;
+}
+
void SurfaceControl::writeToParcel(Parcel* parcel)
{
parcel->writeStrongBinder(ISurfaceComposerClient::asBinder(mClient->getClient()));
parcel->writeStrongBinder(mHandle);
parcel->writeStrongBinder(IGraphicBufferProducer::asBinder(mGraphicBufferProducer));
+ parcel->writeUint32(mTransformHint);
}
-sp<SurfaceControl> SurfaceControl::readFromParcel(Parcel* parcel)
-{
+sp<SurfaceControl> SurfaceControl::readFromParcel(const Parcel* parcel) {
sp<IBinder> client = parcel->readStrongBinder();
sp<IBinder> handle = parcel->readStrongBinder();
if (client == nullptr || handle == nullptr)
@@ -198,10 +188,12 @@ sp<SurfaceControl> SurfaceControl::readFromParcel(Parcel* parcel)
sp<IBinder> gbp;
parcel->readNullableStrongBinder(&gbp);
+ uint32_t transformHint = parcel->readUint32();
// We aren't the original owner of the surface.
return new SurfaceControl(new SurfaceComposerClient(
- interface_cast<ISurfaceComposerClient>(client)),
- handle.get(), interface_cast<IGraphicBufferProducer>(gbp), false /* owned */);
+ interface_cast<ISurfaceComposerClient>(client)),
+ handle.get(), interface_cast<IGraphicBufferProducer>(gbp),
+ transformHint);
}
// ----------------------------------------------------------------------------