From f57c0163f9c6fe8596a56df52a98f3f912f40ef5 Mon Sep 17 00:00:00 2001 From: Robert Carr Date: Wed, 24 Mar 2021 15:48:25 -0700 Subject: 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 --- native/android/surface_control.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'native/android/surface_control.cpp') diff --git a/native/android/surface_control.cpp b/native/android/surface_control.cpp index 195fd5e60295..8b60480bfe73 100644 --- a/native/android/surface_control.cpp +++ b/native/android/surface_control.cpp @@ -655,3 +655,17 @@ void ASurfaceTransaction_setFrameRateWithSeamlessness(ASurfaceTransaction* aSurf sp 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 = 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); +} -- cgit v1.2.3