diff options
author | Rob Carr <racarr@google.com> | 2021-04-02 19:03:09 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2021-04-02 19:03:09 +0000 |
commit | 782102ccd57110b1979af962ea227a8d715e70c2 (patch) | |
tree | 762f2e76fcb7c21fa1331c8c00d650c40f735abf /native | |
parent | 1da23870fd319beba054e17b3a11222ad3d1e3d2 (diff) | |
parent | f57c0163f9c6fe8596a56df52a98f3f912f40ef5 (diff) | |
download | base-782102ccd57110b1979af962ea227a8d715e70c2.tar.gz |
Merge "ASurfaceTransaction: Add setEnableBackpressure" into sc-dev
Diffstat (limited to 'native')
-rw-r--r-- | native/android/libandroid.map.txt | 1 | ||||
-rw-r--r-- | native/android/surface_control.cpp | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/native/android/libandroid.map.txt b/native/android/libandroid.map.txt index a2fde4ecd3a2..4d137e0e1acc 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_setFrameRateWithChangeStrategy; # introduced=31 ASurfaceTransaction_setGeometry; # introduced=29 diff --git a/native/android/surface_control.cpp b/native/android/surface_control.cpp index 80cf663978a9..e0f637959cfb 100644 --- a/native/android/surface_control.cpp +++ b/native/android/surface_control.cpp @@ -656,3 +656,17 @@ void ASurfaceTransaction_setFrameRateWithChangeStrategy(ASurfaceTransaction* aSu sp<SurfaceControl> surfaceControl = ASurfaceControl_to_SurfaceControl(aSurfaceControl); transaction->setFrameRate(surfaceControl, frameRate, compatibility, changeFrameRateStrategy); } + +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); +} |