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

Commit f57c0163 authored by Robert Carr's avatar Robert Carr Committed by Rob Carr
Browse files

ASurfaceTransaction: Add setEnableBackpressure

Expose the backpressure flag to NDK. See comment in
header file for extensive discussion.

Bug: 177458703
Test: Need new CTS
Change-Id: I97cdaef5d499f57a270972f001517b8a520aa2fe
parent 0f979050
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -252,6 +252,7 @@ LIBANDROID {
    ASurfaceTransaction_setColor; # introduced=29
    ASurfaceTransaction_setDamageRegion; # introduced=29
    ASurfaceTransaction_setDesiredPresentTime; # introduced=29
    ASurfaceTransaction_setEnableBackPressure; # introduced=31
    ASurfaceTransaction_setFrameRate; # introduced=30
    ASurfaceTransaction_setFrameRateWithSeamlessness; # introduced=31
    ASurfaceTransaction_setGeometry; # introduced=29
+14 −0
Original line number Diff line number Diff line
@@ -655,3 +655,17 @@ void ASurfaceTransaction_setFrameRateWithSeamlessness(ASurfaceTransaction* aSurf
    sp<SurfaceControl> surfaceControl = ASurfaceControl_to_SurfaceControl(aSurfaceControl);
    transaction->setFrameRate(surfaceControl, frameRate, compatibility, shouldBeSeamless);
}

void ASurfaceTransaction_setEnableBackPressure(ASurfaceTransaction* aSurfaceTransaction,
                                               ASurfaceControl* aSurfaceControl,
                                               bool enableBackpressure) {
    CHECK_NOT_NULL(aSurfaceControl);
    CHECK_NOT_NULL(aSurfaceTransaction);

    sp<SurfaceControl> surfaceControl = ASurfaceControl_to_SurfaceControl(aSurfaceControl);
    Transaction* transaction = ASurfaceTransaction_to_Transaction(aSurfaceTransaction);

    const uint32_t flags = enableBackpressure ?
                      layer_state_t::eEnableBackpressure : 0;
    transaction->setFlags(surfaceControl, flags, layer_state_t::eEnableBackpressure);
}