Loading libs/gui/BLASTBufferQueue.cpp +3 −4 Original line number Diff line number Diff line Loading @@ -468,12 +468,12 @@ void BLASTBufferQueue::processNextBufferLocked(bool useNextTransaction) { std::bind(releaseBufferCallbackThunk, wp<BLASTBufferQueue>(this) /* callbackContext */, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4); t->setBuffer(mSurfaceControl, buffer, releaseCallbackId, releaseBufferCallback); sp<Fence> fence = bufferItem.mFence ? new Fence(bufferItem.mFence->dup()) : Fence::NO_FENCE; t->setBuffer(mSurfaceControl, buffer, fence, bufferItem.mFrameNumber, releaseCallbackId, releaseBufferCallback); t->setDataspace(mSurfaceControl, static_cast<ui::Dataspace>(bufferItem.mDataSpace)); t->setHdrMetadata(mSurfaceControl, bufferItem.mHdrMetadata); t->setSurfaceDamageRegion(mSurfaceControl, bufferItem.mSurfaceDamage); t->setAcquireFence(mSurfaceControl, bufferItem.mFence ? new Fence(bufferItem.mFence->dup()) : Fence::NO_FENCE); t->addTransactionCompletedCallback(transactionCallbackThunk, static_cast<void*>(this)); mSurfaceControlsWithPendingCallback.push(mSurfaceControl); Loading @@ -486,7 +486,6 @@ void BLASTBufferQueue::processNextBufferLocked(bool useNextTransaction) { if (!bufferItem.mIsAutoTimestamp) { t->setDesiredPresentTime(bufferItem.mTimestamp); } t->setFrameNumber(mSurfaceControl, bufferItem.mFrameNumber); if (!mNextFrameTimelineInfoQueue.empty()) { t->setFrameTimelineInfo(mNextFrameTimelineInfoQueue.front()); Loading libs/gui/LayerState.cpp +69 −70 Original line number Diff line number Diff line Loading @@ -64,12 +64,10 @@ layer_state_t::layer_state_t() frameRateCompatibility(ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT), changeFrameRateStrategy(ANATIVEWINDOW_CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS), fixedTransformHint(ui::Transform::ROT_INVALID), frameNumber(0), autoRefresh(false), isTrustedOverlay(false), bufferCrop(Rect::INVALID_RECT), destinationFrame(Rect::INVALID_RECT), releaseBufferListener(nullptr), dropInputMode(gui::DropInputMode::NONE) { matrix.dsdx = matrix.dtdy = 1.0f; matrix.dsdy = matrix.dtdx = 0.0f; Loading Loading @@ -104,20 +102,6 @@ status_t layer_state_t::write(Parcel& output) const SAFE_PARCEL(output.writeBool, transformToDisplayInverse); SAFE_PARCEL(output.write, orientedDisplaySpaceRect); if (buffer) { SAFE_PARCEL(output.writeBool, true); SAFE_PARCEL(output.write, *buffer); } else { SAFE_PARCEL(output.writeBool, false); } if (acquireFence) { SAFE_PARCEL(output.writeBool, true); SAFE_PARCEL(output.write, *acquireFence); } else { SAFE_PARCEL(output.writeBool, false); } SAFE_PARCEL(output.writeUint32, static_cast<uint32_t>(dataspace)); SAFE_PARCEL(output.write, hdrMetadata); SAFE_PARCEL(output.write, surfaceDamageRegion); Loading @@ -133,8 +117,6 @@ status_t layer_state_t::write(Parcel& output) const SAFE_PARCEL(output.write, colorTransform.asArray(), 16 * sizeof(float)); SAFE_PARCEL(output.writeFloat, cornerRadius); SAFE_PARCEL(output.writeUint32, backgroundBlurRadius); SAFE_PARCEL(output.writeStrongBinder, cachedBuffer.token.promote()); SAFE_PARCEL(output.writeUint64, cachedBuffer.id); SAFE_PARCEL(output.writeParcelable, metadata); SAFE_PARCEL(output.writeFloat, bgColorAlpha); SAFE_PARCEL(output.writeUint32, static_cast<uint32_t>(bgColorDataspace)); Loading @@ -151,9 +133,7 @@ status_t layer_state_t::write(Parcel& output) const SAFE_PARCEL(output.writeByte, frameRateCompatibility); SAFE_PARCEL(output.writeByte, changeFrameRateStrategy); SAFE_PARCEL(output.writeUint32, fixedTransformHint); SAFE_PARCEL(output.writeUint64, frameNumber); SAFE_PARCEL(output.writeBool, autoRefresh); SAFE_PARCEL(output.writeStrongBinder, IInterface::asBinder(releaseBufferListener)); SAFE_PARCEL(output.writeUint32, blurRegions.size()); for (auto region : blurRegions) { Loading @@ -174,8 +154,8 @@ status_t layer_state_t::write(Parcel& output) const SAFE_PARCEL(output.write, destinationFrame); SAFE_PARCEL(output.writeBool, isTrustedOverlay); SAFE_PARCEL(output.writeStrongBinder, releaseBufferEndpoint); SAFE_PARCEL(output.writeUint32, static_cast<uint32_t>(dropInputMode)); SAFE_PARCEL(bufferData.write, output); return NO_ERROR; } Loading Loading @@ -217,19 +197,6 @@ status_t layer_state_t::read(const Parcel& input) SAFE_PARCEL(input.readBool, &transformToDisplayInverse); SAFE_PARCEL(input.read, orientedDisplaySpaceRect); bool tmpBool = false; SAFE_PARCEL(input.readBool, &tmpBool); if (tmpBool) { buffer = new GraphicBuffer(); SAFE_PARCEL(input.read, *buffer); } SAFE_PARCEL(input.readBool, &tmpBool); if (tmpBool) { acquireFence = new Fence(); SAFE_PARCEL(input.read, *acquireFence); } uint32_t tmpUint32 = 0; SAFE_PARCEL(input.readUint32, &tmpUint32); dataspace = static_cast<ui::Dataspace>(tmpUint32); Loading @@ -237,6 +204,8 @@ status_t layer_state_t::read(const Parcel& input) SAFE_PARCEL(input.read, hdrMetadata); SAFE_PARCEL(input.read, surfaceDamageRegion); SAFE_PARCEL(input.readInt32, &api); bool tmpBool = false; SAFE_PARCEL(input.readBool, &tmpBool); if (tmpBool) { sidebandStream = NativeHandle::create(input.readNativeHandle(), true); Loading @@ -245,10 +214,6 @@ status_t layer_state_t::read(const Parcel& input) SAFE_PARCEL(input.read, &colorTransform, 16 * sizeof(float)); SAFE_PARCEL(input.readFloat, &cornerRadius); SAFE_PARCEL(input.readUint32, &backgroundBlurRadius); sp<IBinder> tmpBinder; SAFE_PARCEL(input.readNullableStrongBinder, &tmpBinder); cachedBuffer.token = tmpBinder; SAFE_PARCEL(input.readUint64, &cachedBuffer.id); SAFE_PARCEL(input.readParcelable, &metadata); SAFE_PARCEL(input.readFloat, &bgColorAlpha); Loading @@ -273,15 +238,8 @@ status_t layer_state_t::read(const Parcel& input) SAFE_PARCEL(input.readByte, &changeFrameRateStrategy); SAFE_PARCEL(input.readUint32, &tmpUint32); fixedTransformHint = static_cast<ui::Transform::RotationFlags>(tmpUint32); SAFE_PARCEL(input.readUint64, &frameNumber); SAFE_PARCEL(input.readBool, &autoRefresh); tmpBinder = nullptr; SAFE_PARCEL(input.readNullableStrongBinder, &tmpBinder); if (tmpBinder) { releaseBufferListener = checked_interface_cast<ITransactionCompletedListener>(tmpBinder); } uint32_t numRegions = 0; SAFE_PARCEL(input.readUint32, &numRegions); blurRegions.clear(); Loading @@ -305,11 +263,10 @@ status_t layer_state_t::read(const Parcel& input) SAFE_PARCEL(input.read, destinationFrame); SAFE_PARCEL(input.readBool, &isTrustedOverlay); SAFE_PARCEL(input.readNullableStrongBinder, &releaseBufferEndpoint); uint32_t mode; SAFE_PARCEL(input.readUint32, &mode); dropInputMode = static_cast<gui::DropInputMode>(mode); SAFE_PARCEL(bufferData.read, input); return NO_ERROR; } Loading Loading @@ -460,12 +417,7 @@ void layer_state_t::merge(const layer_state_t& other) { } if (other.what & eBufferChanged) { what |= eBufferChanged; buffer = other.buffer; releaseBufferEndpoint = other.releaseBufferEndpoint; } if (other.what & eAcquireFenceChanged) { what |= eAcquireFenceChanged; acquireFence = other.acquireFence; bufferData = other.bufferData; } if (other.what & eDataspaceChanged) { what |= eDataspaceChanged; Loading Loading @@ -498,10 +450,6 @@ void layer_state_t::merge(const layer_state_t& other) { what |= eInputInfoChanged; windowInfoHandle = new WindowInfoHandle(*other.windowInfoHandle); } if (other.what & eCachedBufferChanged) { what |= eCachedBufferChanged; cachedBuffer = other.cachedBuffer; } if (other.what & eBackgroundColorChanged) { what |= eBackgroundColorChanged; color = other.color; Loading Loading @@ -530,10 +478,6 @@ void layer_state_t::merge(const layer_state_t& other) { what |= eFixedTransformHintChanged; fixedTransformHint = other.fixedTransformHint; } if (other.what & eFrameNumberChanged) { what |= eFrameNumberChanged; frameNumber = other.frameNumber; } if (other.what & eAutoRefreshChanged) { what |= eAutoRefreshChanged; autoRefresh = other.autoRefresh; Loading @@ -542,13 +486,6 @@ void layer_state_t::merge(const layer_state_t& other) { what |= eTrustedOverlayChanged; isTrustedOverlay = other.isTrustedOverlay; } if (other.what & eReleaseBufferListenerChanged) { if (releaseBufferListener) { ALOGW("Overriding releaseBufferListener"); } what |= eReleaseBufferListenerChanged; releaseBufferListener = other.releaseBufferListener; } if (other.what & eStretchChanged) { what |= eStretchChanged; stretchEffect = other.stretchEffect; Loading Loading @@ -576,11 +513,11 @@ void layer_state_t::merge(const layer_state_t& other) { } bool layer_state_t::hasBufferChanges() const { return (what & layer_state_t::eBufferChanged) || (what & layer_state_t::eCachedBufferChanged); return what & layer_state_t::eBufferChanged; } bool layer_state_t::hasValidBuffer() const { return buffer || cachedBuffer.isValid(); return bufferData.buffer || bufferData.cachedBuffer.isValid(); } status_t layer_state_t::matrix22_t::write(Parcel& output) const { Loading Loading @@ -741,4 +678,66 @@ status_t LayerCaptureArgs::read(const Parcel& input) { return NO_ERROR; } status_t BufferData::write(Parcel& output) const { SAFE_PARCEL(output.writeInt32, flags.get()); if (buffer) { SAFE_PARCEL(output.writeBool, true); SAFE_PARCEL(output.write, *buffer); } else { SAFE_PARCEL(output.writeBool, false); } if (acquireFence) { SAFE_PARCEL(output.writeBool, true); SAFE_PARCEL(output.write, *acquireFence); } else { SAFE_PARCEL(output.writeBool, false); } SAFE_PARCEL(output.writeUint64, frameNumber); SAFE_PARCEL(output.writeStrongBinder, IInterface::asBinder(releaseBufferListener)); SAFE_PARCEL(output.writeStrongBinder, releaseBufferEndpoint); SAFE_PARCEL(output.writeStrongBinder, cachedBuffer.token.promote()); SAFE_PARCEL(output.writeUint64, cachedBuffer.id); return NO_ERROR; } status_t BufferData::read(const Parcel& input) { int32_t tmpInt32; SAFE_PARCEL(input.readInt32, &tmpInt32); flags = Flags<BufferDataChange>(tmpInt32); bool tmpBool = false; SAFE_PARCEL(input.readBool, &tmpBool); if (tmpBool) { buffer = new GraphicBuffer(); SAFE_PARCEL(input.read, *buffer); } SAFE_PARCEL(input.readBool, &tmpBool); if (tmpBool) { acquireFence = new Fence(); SAFE_PARCEL(input.read, *acquireFence); } SAFE_PARCEL(input.readUint64, &frameNumber); sp<IBinder> tmpBinder = nullptr; SAFE_PARCEL(input.readNullableStrongBinder, &tmpBinder); if (tmpBinder) { releaseBufferListener = checked_interface_cast<ITransactionCompletedListener>(tmpBinder); } SAFE_PARCEL(input.readNullableStrongBinder, &releaseBufferEndpoint); tmpBinder = nullptr; SAFE_PARCEL(input.readNullableStrongBinder, &tmpBinder); cachedBuffer.token = tmpBinder; SAFE_PARCEL(input.readUint64, &cachedBuffer.id); return NO_ERROR; } }; // namespace android libs/gui/SurfaceComposerClient.cpp +32 −54 Original line number Diff line number Diff line Loading @@ -805,7 +805,7 @@ void SurfaceComposerClient::Transaction::cacheBuffers() { layer_state_t* s = &(mComposerStates[handle].state); if (!(s->what & layer_state_t::eBufferChanged)) { continue; } else if (s->what & layer_state_t::eCachedBufferChanged) { } else if (s->bufferData.flags.test(BufferData::BufferDataChange::cachedBufferChanged)) { // If eBufferChanged and eCachedBufferChanged are both trued then that means // we already cached the buffer in a previous call to cacheBuffers, perhaps // from writeToParcel on a Transaction that was merged in to this one. Loading @@ -814,23 +814,22 @@ void SurfaceComposerClient::Transaction::cacheBuffers() { // Don't try to cache a null buffer. Sending null buffers is cheap so we shouldn't waste // time trying to cache them. if (!s->buffer) { if (!s->bufferData.buffer) { continue; } uint64_t cacheId = 0; status_t ret = BufferCache::getInstance().getCacheId(s->buffer, &cacheId); status_t ret = BufferCache::getInstance().getCacheId(s->bufferData.buffer, &cacheId); if (ret == NO_ERROR) { // Cache-hit. Strip the buffer and send only the id. s->what &= ~static_cast<uint64_t>(layer_state_t::eBufferChanged); s->buffer = nullptr; s->bufferData.buffer = nullptr; } else { // Cache-miss. Include the buffer and send the new cacheId. cacheId = BufferCache::getInstance().cache(s->buffer); cacheId = BufferCache::getInstance().cache(s->bufferData.buffer); } s->what |= layer_state_t::eCachedBufferChanged; s->cachedBuffer.token = BufferCache::getInstance().getToken(); s->cachedBuffer.id = cacheId; s->bufferData.flags |= BufferData::BufferDataChange::cachedBufferChanged; s->bufferData.cachedBuffer.token = BufferCache::getInstance().getToken(); s->bufferData.cachedBuffer.id = cacheId; // If we have more buffers than the size of the cache, we should stop caching so we don't // evict other buffers in this transaction Loading Loading @@ -1289,22 +1288,33 @@ SurfaceComposerClient::Transaction::setTransformToDisplayInverse(const sp<Surfac } SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setBuffer( const sp<SurfaceControl>& sc, const sp<GraphicBuffer>& buffer, const ReleaseCallbackId& id, ReleaseBufferCallback callback) { const sp<SurfaceControl>& sc, const sp<GraphicBuffer>& buffer, const std::optional<sp<Fence>>& fence, const std::optional<uint64_t>& frameNumber, const ReleaseCallbackId& id, ReleaseBufferCallback callback) { layer_state_t* s = getLayerState(sc); if (!s) { mStatus = BAD_INDEX; return *this; } removeReleaseBufferCallback(s); s->what |= layer_state_t::eBufferChanged; s->buffer = buffer; s->releaseBufferEndpoint = IInterface::asBinder(TransactionCompletedListener::getIInstance()); BufferData bufferData; bufferData.buffer = buffer; if (frameNumber) { bufferData.frameNumber = *frameNumber; bufferData.flags |= BufferData::BufferDataChange::frameNumberChanged; } if (fence) { bufferData.acquireFence = *fence; bufferData.flags |= BufferData::BufferDataChange::fenceChanged; } bufferData.releaseBufferEndpoint = IInterface::asBinder(TransactionCompletedListener::getIInstance()); if (mIsAutoTimestamp) { mDesiredPresentTime = systemTime(); } setReleaseBufferCallback(s, id, callback); setReleaseBufferCallback(&bufferData, id, callback); s->what |= layer_state_t::eBufferChanged; s->bufferData = bufferData; registerSurfaceControlForCallback(sc); mContainsBuffer = true; Loading @@ -1312,51 +1322,33 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setBuffe } void SurfaceComposerClient::Transaction::removeReleaseBufferCallback(layer_state_t* s) { if (!s->releaseBufferListener) { if (!(s->what & layer_state_t::eBufferChanged)) { return; } s->what &= ~static_cast<uint64_t>(layer_state_t::eReleaseBufferListenerChanged); s->releaseBufferListener = nullptr; auto listener = TransactionCompletedListener::getInstance(); listener->removeReleaseBufferCallback(s->releaseCallbackId); s->releaseCallbackId = ReleaseCallbackId::INVALID_ID; listener->removeReleaseBufferCallback(s->bufferData.releaseCallbackId); } void SurfaceComposerClient::Transaction::setReleaseBufferCallback(layer_state_t* s, void SurfaceComposerClient::Transaction::setReleaseBufferCallback(BufferData* bufferData, const ReleaseCallbackId& id, ReleaseBufferCallback callback) { if (!callback) { return; } if (!s->buffer) { if (!bufferData->buffer) { ALOGW("Transaction::setReleaseBufferCallback" "ignored trying to set a callback on a null buffer."); return; } s->what |= layer_state_t::eReleaseBufferListenerChanged; s->releaseBufferListener = TransactionCompletedListener::getIInstance(); s->releaseCallbackId = id; bufferData->releaseBufferListener = TransactionCompletedListener::getIInstance(); bufferData->releaseCallbackId = id; auto listener = TransactionCompletedListener::getInstance(); listener->setReleaseBufferCallback(id, callback); } SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setAcquireFence( const sp<SurfaceControl>& sc, const sp<Fence>& fence) { layer_state_t* s = getLayerState(sc); if (!s) { mStatus = BAD_INDEX; return *this; } s->what |= layer_state_t::eAcquireFenceChanged; s->acquireFence = fence; registerSurfaceControlForCallback(sc); return *this; } SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setDataspace( const sp<SurfaceControl>& sc, ui::Dataspace dataspace) { layer_state_t* s = getLayerState(sc); Loading Loading @@ -1506,20 +1498,6 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::notifyPr return *this; } SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setFrameNumber( const sp<SurfaceControl>& sc, uint64_t frameNumber) { layer_state_t* s = getLayerState(sc); if (!s) { mStatus = BAD_INDEX; return *this; } s->what |= layer_state_t::eFrameNumberChanged; s->frameNumber = frameNumber; return *this; } SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setInputWindowInfo( const sp<SurfaceControl>& sc, const WindowInfo& info) { layer_state_t* s = getLayerState(sc); Loading libs/gui/include/gui/LayerState.h +43 −28 Original line number Diff line number Diff line Loading @@ -58,6 +58,44 @@ struct client_cache_t { bool isValid() const { return token != nullptr; } }; struct BufferData { enum class BufferDataChange : uint32_t { fenceChanged = 0x01, frameNumberChanged = 0x02, cachedBufferChanged = 0x04, }; sp<GraphicBuffer> buffer; sp<Fence> acquireFence; // Used by BlastBufferQueue to forward the framenumber generated by the // graphics producer. uint64_t frameNumber = 0; // Listens to when the buffer is safe to be released. This is used for blast // layers only. The callback includes a release fence as well as the graphic // buffer id to identify the buffer. sp<ITransactionCompletedListener> releaseBufferListener = nullptr; // Keeps track of the release callback id associated with the listener. This // is not sent to the server since the id can be reconstructed there. This // is used to remove the old callback from the client process map if it is // overwritten by another setBuffer call. ReleaseCallbackId releaseCallbackId = ReleaseCallbackId::INVALID_ID; // Stores which endpoint the release information should be sent to. We don't want to send the // releaseCallbackId and release fence to all listeners so we store which listener the setBuffer // was called with. sp<IBinder> releaseBufferEndpoint; Flags<BufferDataChange> flags; client_cache_t cachedBuffer; status_t write(Parcel& output) const; status_t read(const Parcel& input); }; /* * Used to communicate layer information between SurfaceFlinger and its clients. */ Loading @@ -82,7 +120,7 @@ struct layer_state_t { eTransparentRegionChanged = 0x00000020, eFlagsChanged = 0x00000040, eLayerStackChanged = 0x00000080, eReleaseBufferListenerChanged = 0x00000400, /* unused 0x00000400, */ eShadowRadiusChanged = 0x00000800, eLayerCreated = 0x00001000, eBufferCropChanged = 0x00002000, Loading @@ -94,7 +132,7 @@ struct layer_state_t { eTransformToDisplayInverseChanged = 0x00080000, eCropChanged = 0x00100000, eBufferChanged = 0x00200000, eAcquireFenceChanged = 0x00400000, /* unused 0x00400000, */ eDataspaceChanged = 0x00800000, eHdrMetadataChanged = 0x01000000, eSurfaceDamageRegionChanged = 0x02000000, Loading @@ -105,7 +143,7 @@ struct layer_state_t { eInputInfoChanged = 0x40000000, eCornerRadiusChanged = 0x80000000, eDestinationFrameChanged = 0x1'00000000, eCachedBufferChanged = 0x2'00000000, /* unused = 0x2'00000000, */ eBackgroundColorChanged = 0x4'00000000, eMetadataChanged = 0x8'00000000, eColorSpaceAgnosticChanged = 0x10'00000000, Loading @@ -114,7 +152,7 @@ struct layer_state_t { eBackgroundBlurRadiusChanged = 0x80'00000000, eProducerDisconnect = 0x100'00000000, eFixedTransformHintChanged = 0x200'00000000, eFrameNumberChanged = 0x400'00000000, /* unused 0x400'00000000, */ eBlurRegionsChanged = 0x800'00000000, eAutoRefreshChanged = 0x1000'00000000, eStretchChanged = 0x2000'00000000, Loading Loading @@ -169,8 +207,7 @@ struct layer_state_t { bool transformToDisplayInverse; Rect crop; Rect orientedDisplaySpaceRect; sp<GraphicBuffer> buffer; sp<Fence> acquireFence; BufferData bufferData; ui::Dataspace dataspace; HdrMetadata hdrMetadata; Region surfaceDamageRegion; Loading @@ -181,8 +218,6 @@ struct layer_state_t { sp<gui::WindowInfoHandle> windowInfoHandle = new gui::WindowInfoHandle(); client_cache_t cachedBuffer; LayerMetadata metadata; // The following refer to the alpha, and dataspace, respectively of Loading Loading @@ -216,10 +251,6 @@ struct layer_state_t { // otherwise the value will be a valid ui::Rotation. ui::Transform::RotationFlags fixedTransformHint; // Used by BlastBufferQueue to forward the framenumber generated by the // graphics producer. uint64_t frameNumber; // Indicates that the consumer should acquire the next frame as soon as it // can and not wait for a frame to become available. This is only relevant // in shared buffer mode. Loading @@ -235,22 +266,6 @@ struct layer_state_t { Rect bufferCrop; Rect destinationFrame; // Listens to when the buffer is safe to be released. This is used for blast // layers only. The callback includes a release fence as well as the graphic // buffer id to identify the buffer. sp<ITransactionCompletedListener> releaseBufferListener; // Keeps track of the release callback id associated with the listener. This // is not sent to the server since the id can be reconstructed there. This // is used to remove the old callback from the client process map if it is // overwritten by another setBuffer call. ReleaseCallbackId releaseCallbackId; // Stores which endpoint the release information should be sent to. We don't want to send the // releaseCallbackId and release fence to all listeners so we store which listener the setBuffer // was called with. sp<IBinder> releaseBufferEndpoint; // Force inputflinger to drop all input events for the layer and its children. gui::DropInputMode dropInputMode; }; Loading libs/gui/include/gui/SurfaceComposerClient.h +3 −6 Original line number Diff line number Diff line Loading @@ -399,8 +399,7 @@ public: void cacheBuffers(); void registerSurfaceControlForCallback(const sp<SurfaceControl>& sc); void setReleaseBufferCallback(layer_state_t*, const ReleaseCallbackId&, ReleaseBufferCallback); void setReleaseBufferCallback(BufferData*, const ReleaseCallbackId&, ReleaseBufferCallback); void removeReleaseBufferCallback(layer_state_t*); public: Loading Loading @@ -473,10 +472,10 @@ public: Transaction& setTransformToDisplayInverse(const sp<SurfaceControl>& sc, bool transformToDisplayInverse); Transaction& setBuffer(const sp<SurfaceControl>& sc, const sp<GraphicBuffer>& buffer, const std::optional<sp<Fence>>& fence = std::nullopt, const std::optional<uint64_t>& frameNumber = std::nullopt, const ReleaseCallbackId& id = ReleaseCallbackId::INVALID_ID, ReleaseBufferCallback callback = nullptr); Transaction& setCachedBuffer(const sp<SurfaceControl>& sc, int32_t bufferId); Transaction& setAcquireFence(const sp<SurfaceControl>& sc, const sp<Fence>& fence); Transaction& setDataspace(const sp<SurfaceControl>& sc, ui::Dataspace dataspace); Transaction& setHdrMetadata(const sp<SurfaceControl>& sc, const HdrMetadata& hdrMetadata); Transaction& setSurfaceDamageRegion(const sp<SurfaceControl>& sc, Loading @@ -501,8 +500,6 @@ public: // ONLY FOR BLAST ADAPTER Transaction& notifyProducerDisconnect(const sp<SurfaceControl>& sc); // Set the framenumber generated by the graphics producer to mimic BufferQueue behaviour. Transaction& setFrameNumber(const sp<SurfaceControl>& sc, uint64_t frameNumber); Transaction& setInputWindowInfo(const sp<SurfaceControl>& sc, const gui::WindowInfo& info); Transaction& setFocusedWindow(const gui::FocusRequest& request); Loading Loading
libs/gui/BLASTBufferQueue.cpp +3 −4 Original line number Diff line number Diff line Loading @@ -468,12 +468,12 @@ void BLASTBufferQueue::processNextBufferLocked(bool useNextTransaction) { std::bind(releaseBufferCallbackThunk, wp<BLASTBufferQueue>(this) /* callbackContext */, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4); t->setBuffer(mSurfaceControl, buffer, releaseCallbackId, releaseBufferCallback); sp<Fence> fence = bufferItem.mFence ? new Fence(bufferItem.mFence->dup()) : Fence::NO_FENCE; t->setBuffer(mSurfaceControl, buffer, fence, bufferItem.mFrameNumber, releaseCallbackId, releaseBufferCallback); t->setDataspace(mSurfaceControl, static_cast<ui::Dataspace>(bufferItem.mDataSpace)); t->setHdrMetadata(mSurfaceControl, bufferItem.mHdrMetadata); t->setSurfaceDamageRegion(mSurfaceControl, bufferItem.mSurfaceDamage); t->setAcquireFence(mSurfaceControl, bufferItem.mFence ? new Fence(bufferItem.mFence->dup()) : Fence::NO_FENCE); t->addTransactionCompletedCallback(transactionCallbackThunk, static_cast<void*>(this)); mSurfaceControlsWithPendingCallback.push(mSurfaceControl); Loading @@ -486,7 +486,6 @@ void BLASTBufferQueue::processNextBufferLocked(bool useNextTransaction) { if (!bufferItem.mIsAutoTimestamp) { t->setDesiredPresentTime(bufferItem.mTimestamp); } t->setFrameNumber(mSurfaceControl, bufferItem.mFrameNumber); if (!mNextFrameTimelineInfoQueue.empty()) { t->setFrameTimelineInfo(mNextFrameTimelineInfoQueue.front()); Loading
libs/gui/LayerState.cpp +69 −70 Original line number Diff line number Diff line Loading @@ -64,12 +64,10 @@ layer_state_t::layer_state_t() frameRateCompatibility(ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT), changeFrameRateStrategy(ANATIVEWINDOW_CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS), fixedTransformHint(ui::Transform::ROT_INVALID), frameNumber(0), autoRefresh(false), isTrustedOverlay(false), bufferCrop(Rect::INVALID_RECT), destinationFrame(Rect::INVALID_RECT), releaseBufferListener(nullptr), dropInputMode(gui::DropInputMode::NONE) { matrix.dsdx = matrix.dtdy = 1.0f; matrix.dsdy = matrix.dtdx = 0.0f; Loading Loading @@ -104,20 +102,6 @@ status_t layer_state_t::write(Parcel& output) const SAFE_PARCEL(output.writeBool, transformToDisplayInverse); SAFE_PARCEL(output.write, orientedDisplaySpaceRect); if (buffer) { SAFE_PARCEL(output.writeBool, true); SAFE_PARCEL(output.write, *buffer); } else { SAFE_PARCEL(output.writeBool, false); } if (acquireFence) { SAFE_PARCEL(output.writeBool, true); SAFE_PARCEL(output.write, *acquireFence); } else { SAFE_PARCEL(output.writeBool, false); } SAFE_PARCEL(output.writeUint32, static_cast<uint32_t>(dataspace)); SAFE_PARCEL(output.write, hdrMetadata); SAFE_PARCEL(output.write, surfaceDamageRegion); Loading @@ -133,8 +117,6 @@ status_t layer_state_t::write(Parcel& output) const SAFE_PARCEL(output.write, colorTransform.asArray(), 16 * sizeof(float)); SAFE_PARCEL(output.writeFloat, cornerRadius); SAFE_PARCEL(output.writeUint32, backgroundBlurRadius); SAFE_PARCEL(output.writeStrongBinder, cachedBuffer.token.promote()); SAFE_PARCEL(output.writeUint64, cachedBuffer.id); SAFE_PARCEL(output.writeParcelable, metadata); SAFE_PARCEL(output.writeFloat, bgColorAlpha); SAFE_PARCEL(output.writeUint32, static_cast<uint32_t>(bgColorDataspace)); Loading @@ -151,9 +133,7 @@ status_t layer_state_t::write(Parcel& output) const SAFE_PARCEL(output.writeByte, frameRateCompatibility); SAFE_PARCEL(output.writeByte, changeFrameRateStrategy); SAFE_PARCEL(output.writeUint32, fixedTransformHint); SAFE_PARCEL(output.writeUint64, frameNumber); SAFE_PARCEL(output.writeBool, autoRefresh); SAFE_PARCEL(output.writeStrongBinder, IInterface::asBinder(releaseBufferListener)); SAFE_PARCEL(output.writeUint32, blurRegions.size()); for (auto region : blurRegions) { Loading @@ -174,8 +154,8 @@ status_t layer_state_t::write(Parcel& output) const SAFE_PARCEL(output.write, destinationFrame); SAFE_PARCEL(output.writeBool, isTrustedOverlay); SAFE_PARCEL(output.writeStrongBinder, releaseBufferEndpoint); SAFE_PARCEL(output.writeUint32, static_cast<uint32_t>(dropInputMode)); SAFE_PARCEL(bufferData.write, output); return NO_ERROR; } Loading Loading @@ -217,19 +197,6 @@ status_t layer_state_t::read(const Parcel& input) SAFE_PARCEL(input.readBool, &transformToDisplayInverse); SAFE_PARCEL(input.read, orientedDisplaySpaceRect); bool tmpBool = false; SAFE_PARCEL(input.readBool, &tmpBool); if (tmpBool) { buffer = new GraphicBuffer(); SAFE_PARCEL(input.read, *buffer); } SAFE_PARCEL(input.readBool, &tmpBool); if (tmpBool) { acquireFence = new Fence(); SAFE_PARCEL(input.read, *acquireFence); } uint32_t tmpUint32 = 0; SAFE_PARCEL(input.readUint32, &tmpUint32); dataspace = static_cast<ui::Dataspace>(tmpUint32); Loading @@ -237,6 +204,8 @@ status_t layer_state_t::read(const Parcel& input) SAFE_PARCEL(input.read, hdrMetadata); SAFE_PARCEL(input.read, surfaceDamageRegion); SAFE_PARCEL(input.readInt32, &api); bool tmpBool = false; SAFE_PARCEL(input.readBool, &tmpBool); if (tmpBool) { sidebandStream = NativeHandle::create(input.readNativeHandle(), true); Loading @@ -245,10 +214,6 @@ status_t layer_state_t::read(const Parcel& input) SAFE_PARCEL(input.read, &colorTransform, 16 * sizeof(float)); SAFE_PARCEL(input.readFloat, &cornerRadius); SAFE_PARCEL(input.readUint32, &backgroundBlurRadius); sp<IBinder> tmpBinder; SAFE_PARCEL(input.readNullableStrongBinder, &tmpBinder); cachedBuffer.token = tmpBinder; SAFE_PARCEL(input.readUint64, &cachedBuffer.id); SAFE_PARCEL(input.readParcelable, &metadata); SAFE_PARCEL(input.readFloat, &bgColorAlpha); Loading @@ -273,15 +238,8 @@ status_t layer_state_t::read(const Parcel& input) SAFE_PARCEL(input.readByte, &changeFrameRateStrategy); SAFE_PARCEL(input.readUint32, &tmpUint32); fixedTransformHint = static_cast<ui::Transform::RotationFlags>(tmpUint32); SAFE_PARCEL(input.readUint64, &frameNumber); SAFE_PARCEL(input.readBool, &autoRefresh); tmpBinder = nullptr; SAFE_PARCEL(input.readNullableStrongBinder, &tmpBinder); if (tmpBinder) { releaseBufferListener = checked_interface_cast<ITransactionCompletedListener>(tmpBinder); } uint32_t numRegions = 0; SAFE_PARCEL(input.readUint32, &numRegions); blurRegions.clear(); Loading @@ -305,11 +263,10 @@ status_t layer_state_t::read(const Parcel& input) SAFE_PARCEL(input.read, destinationFrame); SAFE_PARCEL(input.readBool, &isTrustedOverlay); SAFE_PARCEL(input.readNullableStrongBinder, &releaseBufferEndpoint); uint32_t mode; SAFE_PARCEL(input.readUint32, &mode); dropInputMode = static_cast<gui::DropInputMode>(mode); SAFE_PARCEL(bufferData.read, input); return NO_ERROR; } Loading Loading @@ -460,12 +417,7 @@ void layer_state_t::merge(const layer_state_t& other) { } if (other.what & eBufferChanged) { what |= eBufferChanged; buffer = other.buffer; releaseBufferEndpoint = other.releaseBufferEndpoint; } if (other.what & eAcquireFenceChanged) { what |= eAcquireFenceChanged; acquireFence = other.acquireFence; bufferData = other.bufferData; } if (other.what & eDataspaceChanged) { what |= eDataspaceChanged; Loading Loading @@ -498,10 +450,6 @@ void layer_state_t::merge(const layer_state_t& other) { what |= eInputInfoChanged; windowInfoHandle = new WindowInfoHandle(*other.windowInfoHandle); } if (other.what & eCachedBufferChanged) { what |= eCachedBufferChanged; cachedBuffer = other.cachedBuffer; } if (other.what & eBackgroundColorChanged) { what |= eBackgroundColorChanged; color = other.color; Loading Loading @@ -530,10 +478,6 @@ void layer_state_t::merge(const layer_state_t& other) { what |= eFixedTransformHintChanged; fixedTransformHint = other.fixedTransformHint; } if (other.what & eFrameNumberChanged) { what |= eFrameNumberChanged; frameNumber = other.frameNumber; } if (other.what & eAutoRefreshChanged) { what |= eAutoRefreshChanged; autoRefresh = other.autoRefresh; Loading @@ -542,13 +486,6 @@ void layer_state_t::merge(const layer_state_t& other) { what |= eTrustedOverlayChanged; isTrustedOverlay = other.isTrustedOverlay; } if (other.what & eReleaseBufferListenerChanged) { if (releaseBufferListener) { ALOGW("Overriding releaseBufferListener"); } what |= eReleaseBufferListenerChanged; releaseBufferListener = other.releaseBufferListener; } if (other.what & eStretchChanged) { what |= eStretchChanged; stretchEffect = other.stretchEffect; Loading Loading @@ -576,11 +513,11 @@ void layer_state_t::merge(const layer_state_t& other) { } bool layer_state_t::hasBufferChanges() const { return (what & layer_state_t::eBufferChanged) || (what & layer_state_t::eCachedBufferChanged); return what & layer_state_t::eBufferChanged; } bool layer_state_t::hasValidBuffer() const { return buffer || cachedBuffer.isValid(); return bufferData.buffer || bufferData.cachedBuffer.isValid(); } status_t layer_state_t::matrix22_t::write(Parcel& output) const { Loading Loading @@ -741,4 +678,66 @@ status_t LayerCaptureArgs::read(const Parcel& input) { return NO_ERROR; } status_t BufferData::write(Parcel& output) const { SAFE_PARCEL(output.writeInt32, flags.get()); if (buffer) { SAFE_PARCEL(output.writeBool, true); SAFE_PARCEL(output.write, *buffer); } else { SAFE_PARCEL(output.writeBool, false); } if (acquireFence) { SAFE_PARCEL(output.writeBool, true); SAFE_PARCEL(output.write, *acquireFence); } else { SAFE_PARCEL(output.writeBool, false); } SAFE_PARCEL(output.writeUint64, frameNumber); SAFE_PARCEL(output.writeStrongBinder, IInterface::asBinder(releaseBufferListener)); SAFE_PARCEL(output.writeStrongBinder, releaseBufferEndpoint); SAFE_PARCEL(output.writeStrongBinder, cachedBuffer.token.promote()); SAFE_PARCEL(output.writeUint64, cachedBuffer.id); return NO_ERROR; } status_t BufferData::read(const Parcel& input) { int32_t tmpInt32; SAFE_PARCEL(input.readInt32, &tmpInt32); flags = Flags<BufferDataChange>(tmpInt32); bool tmpBool = false; SAFE_PARCEL(input.readBool, &tmpBool); if (tmpBool) { buffer = new GraphicBuffer(); SAFE_PARCEL(input.read, *buffer); } SAFE_PARCEL(input.readBool, &tmpBool); if (tmpBool) { acquireFence = new Fence(); SAFE_PARCEL(input.read, *acquireFence); } SAFE_PARCEL(input.readUint64, &frameNumber); sp<IBinder> tmpBinder = nullptr; SAFE_PARCEL(input.readNullableStrongBinder, &tmpBinder); if (tmpBinder) { releaseBufferListener = checked_interface_cast<ITransactionCompletedListener>(tmpBinder); } SAFE_PARCEL(input.readNullableStrongBinder, &releaseBufferEndpoint); tmpBinder = nullptr; SAFE_PARCEL(input.readNullableStrongBinder, &tmpBinder); cachedBuffer.token = tmpBinder; SAFE_PARCEL(input.readUint64, &cachedBuffer.id); return NO_ERROR; } }; // namespace android
libs/gui/SurfaceComposerClient.cpp +32 −54 Original line number Diff line number Diff line Loading @@ -805,7 +805,7 @@ void SurfaceComposerClient::Transaction::cacheBuffers() { layer_state_t* s = &(mComposerStates[handle].state); if (!(s->what & layer_state_t::eBufferChanged)) { continue; } else if (s->what & layer_state_t::eCachedBufferChanged) { } else if (s->bufferData.flags.test(BufferData::BufferDataChange::cachedBufferChanged)) { // If eBufferChanged and eCachedBufferChanged are both trued then that means // we already cached the buffer in a previous call to cacheBuffers, perhaps // from writeToParcel on a Transaction that was merged in to this one. Loading @@ -814,23 +814,22 @@ void SurfaceComposerClient::Transaction::cacheBuffers() { // Don't try to cache a null buffer. Sending null buffers is cheap so we shouldn't waste // time trying to cache them. if (!s->buffer) { if (!s->bufferData.buffer) { continue; } uint64_t cacheId = 0; status_t ret = BufferCache::getInstance().getCacheId(s->buffer, &cacheId); status_t ret = BufferCache::getInstance().getCacheId(s->bufferData.buffer, &cacheId); if (ret == NO_ERROR) { // Cache-hit. Strip the buffer and send only the id. s->what &= ~static_cast<uint64_t>(layer_state_t::eBufferChanged); s->buffer = nullptr; s->bufferData.buffer = nullptr; } else { // Cache-miss. Include the buffer and send the new cacheId. cacheId = BufferCache::getInstance().cache(s->buffer); cacheId = BufferCache::getInstance().cache(s->bufferData.buffer); } s->what |= layer_state_t::eCachedBufferChanged; s->cachedBuffer.token = BufferCache::getInstance().getToken(); s->cachedBuffer.id = cacheId; s->bufferData.flags |= BufferData::BufferDataChange::cachedBufferChanged; s->bufferData.cachedBuffer.token = BufferCache::getInstance().getToken(); s->bufferData.cachedBuffer.id = cacheId; // If we have more buffers than the size of the cache, we should stop caching so we don't // evict other buffers in this transaction Loading Loading @@ -1289,22 +1288,33 @@ SurfaceComposerClient::Transaction::setTransformToDisplayInverse(const sp<Surfac } SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setBuffer( const sp<SurfaceControl>& sc, const sp<GraphicBuffer>& buffer, const ReleaseCallbackId& id, ReleaseBufferCallback callback) { const sp<SurfaceControl>& sc, const sp<GraphicBuffer>& buffer, const std::optional<sp<Fence>>& fence, const std::optional<uint64_t>& frameNumber, const ReleaseCallbackId& id, ReleaseBufferCallback callback) { layer_state_t* s = getLayerState(sc); if (!s) { mStatus = BAD_INDEX; return *this; } removeReleaseBufferCallback(s); s->what |= layer_state_t::eBufferChanged; s->buffer = buffer; s->releaseBufferEndpoint = IInterface::asBinder(TransactionCompletedListener::getIInstance()); BufferData bufferData; bufferData.buffer = buffer; if (frameNumber) { bufferData.frameNumber = *frameNumber; bufferData.flags |= BufferData::BufferDataChange::frameNumberChanged; } if (fence) { bufferData.acquireFence = *fence; bufferData.flags |= BufferData::BufferDataChange::fenceChanged; } bufferData.releaseBufferEndpoint = IInterface::asBinder(TransactionCompletedListener::getIInstance()); if (mIsAutoTimestamp) { mDesiredPresentTime = systemTime(); } setReleaseBufferCallback(s, id, callback); setReleaseBufferCallback(&bufferData, id, callback); s->what |= layer_state_t::eBufferChanged; s->bufferData = bufferData; registerSurfaceControlForCallback(sc); mContainsBuffer = true; Loading @@ -1312,51 +1322,33 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setBuffe } void SurfaceComposerClient::Transaction::removeReleaseBufferCallback(layer_state_t* s) { if (!s->releaseBufferListener) { if (!(s->what & layer_state_t::eBufferChanged)) { return; } s->what &= ~static_cast<uint64_t>(layer_state_t::eReleaseBufferListenerChanged); s->releaseBufferListener = nullptr; auto listener = TransactionCompletedListener::getInstance(); listener->removeReleaseBufferCallback(s->releaseCallbackId); s->releaseCallbackId = ReleaseCallbackId::INVALID_ID; listener->removeReleaseBufferCallback(s->bufferData.releaseCallbackId); } void SurfaceComposerClient::Transaction::setReleaseBufferCallback(layer_state_t* s, void SurfaceComposerClient::Transaction::setReleaseBufferCallback(BufferData* bufferData, const ReleaseCallbackId& id, ReleaseBufferCallback callback) { if (!callback) { return; } if (!s->buffer) { if (!bufferData->buffer) { ALOGW("Transaction::setReleaseBufferCallback" "ignored trying to set a callback on a null buffer."); return; } s->what |= layer_state_t::eReleaseBufferListenerChanged; s->releaseBufferListener = TransactionCompletedListener::getIInstance(); s->releaseCallbackId = id; bufferData->releaseBufferListener = TransactionCompletedListener::getIInstance(); bufferData->releaseCallbackId = id; auto listener = TransactionCompletedListener::getInstance(); listener->setReleaseBufferCallback(id, callback); } SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setAcquireFence( const sp<SurfaceControl>& sc, const sp<Fence>& fence) { layer_state_t* s = getLayerState(sc); if (!s) { mStatus = BAD_INDEX; return *this; } s->what |= layer_state_t::eAcquireFenceChanged; s->acquireFence = fence; registerSurfaceControlForCallback(sc); return *this; } SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setDataspace( const sp<SurfaceControl>& sc, ui::Dataspace dataspace) { layer_state_t* s = getLayerState(sc); Loading Loading @@ -1506,20 +1498,6 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::notifyPr return *this; } SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setFrameNumber( const sp<SurfaceControl>& sc, uint64_t frameNumber) { layer_state_t* s = getLayerState(sc); if (!s) { mStatus = BAD_INDEX; return *this; } s->what |= layer_state_t::eFrameNumberChanged; s->frameNumber = frameNumber; return *this; } SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setInputWindowInfo( const sp<SurfaceControl>& sc, const WindowInfo& info) { layer_state_t* s = getLayerState(sc); Loading
libs/gui/include/gui/LayerState.h +43 −28 Original line number Diff line number Diff line Loading @@ -58,6 +58,44 @@ struct client_cache_t { bool isValid() const { return token != nullptr; } }; struct BufferData { enum class BufferDataChange : uint32_t { fenceChanged = 0x01, frameNumberChanged = 0x02, cachedBufferChanged = 0x04, }; sp<GraphicBuffer> buffer; sp<Fence> acquireFence; // Used by BlastBufferQueue to forward the framenumber generated by the // graphics producer. uint64_t frameNumber = 0; // Listens to when the buffer is safe to be released. This is used for blast // layers only. The callback includes a release fence as well as the graphic // buffer id to identify the buffer. sp<ITransactionCompletedListener> releaseBufferListener = nullptr; // Keeps track of the release callback id associated with the listener. This // is not sent to the server since the id can be reconstructed there. This // is used to remove the old callback from the client process map if it is // overwritten by another setBuffer call. ReleaseCallbackId releaseCallbackId = ReleaseCallbackId::INVALID_ID; // Stores which endpoint the release information should be sent to. We don't want to send the // releaseCallbackId and release fence to all listeners so we store which listener the setBuffer // was called with. sp<IBinder> releaseBufferEndpoint; Flags<BufferDataChange> flags; client_cache_t cachedBuffer; status_t write(Parcel& output) const; status_t read(const Parcel& input); }; /* * Used to communicate layer information between SurfaceFlinger and its clients. */ Loading @@ -82,7 +120,7 @@ struct layer_state_t { eTransparentRegionChanged = 0x00000020, eFlagsChanged = 0x00000040, eLayerStackChanged = 0x00000080, eReleaseBufferListenerChanged = 0x00000400, /* unused 0x00000400, */ eShadowRadiusChanged = 0x00000800, eLayerCreated = 0x00001000, eBufferCropChanged = 0x00002000, Loading @@ -94,7 +132,7 @@ struct layer_state_t { eTransformToDisplayInverseChanged = 0x00080000, eCropChanged = 0x00100000, eBufferChanged = 0x00200000, eAcquireFenceChanged = 0x00400000, /* unused 0x00400000, */ eDataspaceChanged = 0x00800000, eHdrMetadataChanged = 0x01000000, eSurfaceDamageRegionChanged = 0x02000000, Loading @@ -105,7 +143,7 @@ struct layer_state_t { eInputInfoChanged = 0x40000000, eCornerRadiusChanged = 0x80000000, eDestinationFrameChanged = 0x1'00000000, eCachedBufferChanged = 0x2'00000000, /* unused = 0x2'00000000, */ eBackgroundColorChanged = 0x4'00000000, eMetadataChanged = 0x8'00000000, eColorSpaceAgnosticChanged = 0x10'00000000, Loading @@ -114,7 +152,7 @@ struct layer_state_t { eBackgroundBlurRadiusChanged = 0x80'00000000, eProducerDisconnect = 0x100'00000000, eFixedTransformHintChanged = 0x200'00000000, eFrameNumberChanged = 0x400'00000000, /* unused 0x400'00000000, */ eBlurRegionsChanged = 0x800'00000000, eAutoRefreshChanged = 0x1000'00000000, eStretchChanged = 0x2000'00000000, Loading Loading @@ -169,8 +207,7 @@ struct layer_state_t { bool transformToDisplayInverse; Rect crop; Rect orientedDisplaySpaceRect; sp<GraphicBuffer> buffer; sp<Fence> acquireFence; BufferData bufferData; ui::Dataspace dataspace; HdrMetadata hdrMetadata; Region surfaceDamageRegion; Loading @@ -181,8 +218,6 @@ struct layer_state_t { sp<gui::WindowInfoHandle> windowInfoHandle = new gui::WindowInfoHandle(); client_cache_t cachedBuffer; LayerMetadata metadata; // The following refer to the alpha, and dataspace, respectively of Loading Loading @@ -216,10 +251,6 @@ struct layer_state_t { // otherwise the value will be a valid ui::Rotation. ui::Transform::RotationFlags fixedTransformHint; // Used by BlastBufferQueue to forward the framenumber generated by the // graphics producer. uint64_t frameNumber; // Indicates that the consumer should acquire the next frame as soon as it // can and not wait for a frame to become available. This is only relevant // in shared buffer mode. Loading @@ -235,22 +266,6 @@ struct layer_state_t { Rect bufferCrop; Rect destinationFrame; // Listens to when the buffer is safe to be released. This is used for blast // layers only. The callback includes a release fence as well as the graphic // buffer id to identify the buffer. sp<ITransactionCompletedListener> releaseBufferListener; // Keeps track of the release callback id associated with the listener. This // is not sent to the server since the id can be reconstructed there. This // is used to remove the old callback from the client process map if it is // overwritten by another setBuffer call. ReleaseCallbackId releaseCallbackId; // Stores which endpoint the release information should be sent to. We don't want to send the // releaseCallbackId and release fence to all listeners so we store which listener the setBuffer // was called with. sp<IBinder> releaseBufferEndpoint; // Force inputflinger to drop all input events for the layer and its children. gui::DropInputMode dropInputMode; }; Loading
libs/gui/include/gui/SurfaceComposerClient.h +3 −6 Original line number Diff line number Diff line Loading @@ -399,8 +399,7 @@ public: void cacheBuffers(); void registerSurfaceControlForCallback(const sp<SurfaceControl>& sc); void setReleaseBufferCallback(layer_state_t*, const ReleaseCallbackId&, ReleaseBufferCallback); void setReleaseBufferCallback(BufferData*, const ReleaseCallbackId&, ReleaseBufferCallback); void removeReleaseBufferCallback(layer_state_t*); public: Loading Loading @@ -473,10 +472,10 @@ public: Transaction& setTransformToDisplayInverse(const sp<SurfaceControl>& sc, bool transformToDisplayInverse); Transaction& setBuffer(const sp<SurfaceControl>& sc, const sp<GraphicBuffer>& buffer, const std::optional<sp<Fence>>& fence = std::nullopt, const std::optional<uint64_t>& frameNumber = std::nullopt, const ReleaseCallbackId& id = ReleaseCallbackId::INVALID_ID, ReleaseBufferCallback callback = nullptr); Transaction& setCachedBuffer(const sp<SurfaceControl>& sc, int32_t bufferId); Transaction& setAcquireFence(const sp<SurfaceControl>& sc, const sp<Fence>& fence); Transaction& setDataspace(const sp<SurfaceControl>& sc, ui::Dataspace dataspace); Transaction& setHdrMetadata(const sp<SurfaceControl>& sc, const HdrMetadata& hdrMetadata); Transaction& setSurfaceDamageRegion(const sp<SurfaceControl>& sc, Loading @@ -501,8 +500,6 @@ public: // ONLY FOR BLAST ADAPTER Transaction& notifyProducerDisconnect(const sp<SurfaceControl>& sc); // Set the framenumber generated by the graphics producer to mimic BufferQueue behaviour. Transaction& setFrameNumber(const sp<SurfaceControl>& sc, uint64_t frameNumber); Transaction& setInputWindowInfo(const sp<SurfaceControl>& sc, const gui::WindowInfo& info); Transaction& setFocusedWindow(const gui::FocusRequest& request); Loading