summaryrefslogtreecommitdiff
path: root/native
diff options
context:
space:
mode:
authorRobert Carr <racarr@google.com>2021-03-24 15:48:25 -0700
committerRob Carr <racarr@google.com>2021-04-01 19:41:40 +0000
commitf57c0163f9c6fe8596a56df52a98f3f912f40ef5 (patch)
tree8896745119a8484825f1e9e0d972f29058d85daf /native
parent0f97905040606c3bba2f90d9dba33c16cb76873a (diff)
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
Diffstat (limited to 'native')
-rw-r--r--native/android/libandroid.map.txt1
-rw-r--r--native/android/surface_control.cpp14
2 files changed, 15 insertions, 0 deletions
diff --git a/native/android/libandroid.map.txt b/native/android/libandroid.map.txt
index 35249f615e6b..d2358b705fc0 100644
--- a/native/android/libandroid.map.txt
+++ b/native/android/libandroid.map.txt
@@ -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
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> 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);
+}