Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9691b9c0 authored by baocheng sun's avatar baocheng sun Committed by Alec Mouri
Browse files

sf: send sideband frame to hwc when recieve a buffer

Bug: 186383891
Test: tunnel and nontunnel playback switch in netflix

Change-Id: Ic6ee886503639e8c6652589217e0aec893ffd681
parent fb2f9cf8
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -287,7 +287,7 @@ void BufferLayer::preparePerFrameCompositionState() {

    // Sideband layers
    auto* compositionState = editCompositionState();
    if (compositionState->sidebandStream.get()) {
    if (compositionState->sidebandStream.get() && !compositionState->sidebandStreamHasFrame) {
        compositionState->compositionType = Hwc2::IComposerClient::Composition::SIDEBAND;
        return;
    } else {
@@ -303,6 +303,7 @@ void BufferLayer::preparePerFrameCompositionState() {
            ? 0
            : mBufferInfo.mBufferSlot;
    compositionState->acquireFence = mBufferInfo.mFence;
    compositionState->sidebandStreamHasFrame = false;
}

bool BufferLayer::onPreComposition(nsecs_t refreshStartTime) {
+2 −3
Original line number Diff line number Diff line
@@ -197,11 +197,10 @@ uint64_t BufferQueueLayer::getFrameNumber(nsecs_t expectedPresentTime) const {

bool BufferQueueLayer::latchSidebandStream(bool& recomputeVisibleRegions) {
    // We need to update the sideband stream if the layer has both a buffer and a sideband stream.
    const bool updateSidebandStream = hasFrameUpdate() && mSidebandStream.get();
    editCompositionState()->sidebandStreamHasFrame = hasFrameUpdate() && mSidebandStream.get();

    bool sidebandStreamChanged = true;
    if (mSidebandStreamChanged.compare_exchange_strong(sidebandStreamChanged, false) ||
        updateSidebandStream) {
    if (mSidebandStreamChanged.compare_exchange_strong(sidebandStreamChanged, false)) {
        // mSidebandStreamChanged was changed to false
        mSidebandStream = mConsumer->getSidebandStream();
        auto* layerCompositionState = editCompositionState();
+2 −2
Original line number Diff line number Diff line
@@ -703,9 +703,9 @@ void BufferStateLayer::setAutoRefresh(bool autoRefresh) {

bool BufferStateLayer::latchSidebandStream(bool& recomputeVisibleRegions) {
    // We need to update the sideband stream if the layer has both a buffer and a sideband stream.
    const bool updateSidebandStream = hasFrameUpdate() && mSidebandStream.get();
    editCompositionState()->sidebandStreamHasFrame = hasFrameUpdate() && mSidebandStream.get();

    if (mSidebandStreamChanged.exchange(false) || updateSidebandStream) {
    if (mSidebandStreamChanged.exchange(false)) {
        const State& s(getDrawingState());
        // mSidebandStreamChanged was true
        mSidebandStream = s.sidebandStream;
+2 −0
Original line number Diff line number Diff line
@@ -167,6 +167,8 @@ struct LayerFECompositionState {

    // The handle to use for a sideband stream for this layer
    sp<NativeHandle> sidebandStream;
    // If true, this sideband layer has a frame update
    bool sidebandStreamHasFrame{false};

    // The color for this layer
    half4 color;