diff options
author | Scott Lobdell <slobdell@google.com> | 2021-04-08 04:27:11 +0000 |
---|---|---|
committer | Scott Lobdell <slobdell@google.com> | 2021-04-09 17:32:37 +0000 |
commit | 5f1da148b08c14445ce83ca151a84f75e489d274 (patch) | |
tree | df59b2056d1fe2dbe09f6c85463ddf1769daf4e6 /native/android/surface_control.cpp | |
parent | 702f04add003ce3e490a2f0bdff083a7e6f5979e (diff) | |
parent | 851218af5f83cdb89c02d680fb22212318150068 (diff) |
Merge SP1A.210407.002
Change-Id: Iaad2b7cc2aeba166f003d0d460bc8ce29d1caab3
Diffstat (limited to 'native/android/surface_control.cpp')
-rw-r--r-- | native/android/surface_control.cpp | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/native/android/surface_control.cpp b/native/android/surface_control.cpp index 195fd5e60295..e0f637959cfb 100644 --- a/native/android/surface_control.cpp +++ b/native/android/surface_control.cpp @@ -634,24 +634,39 @@ void ASurfaceTransaction_setColor(ASurfaceTransaction* aSurfaceTransaction, color.g = g; color.b = b; - transaction->setBackgroundColor(surfaceControl, color, alpha, static_cast<ui::Dataspace>(dataspace)); + transaction->setBackgroundColor(surfaceControl, color, alpha, + static_cast<ui::Dataspace>(dataspace)); } void ASurfaceTransaction_setFrameRate(ASurfaceTransaction* aSurfaceTransaction, ASurfaceControl* aSurfaceControl, float frameRate, int8_t compatibility) { - ASurfaceTransaction_setFrameRateWithSeamlessness(aSurfaceTransaction, aSurfaceControl, - frameRate, compatibility, - /*shouldBeSeamless*/ true); + ASurfaceTransaction_setFrameRateWithChangeStrategy( + aSurfaceTransaction, aSurfaceControl, frameRate, compatibility, + ANATIVEWINDOW_CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS); } -void ASurfaceTransaction_setFrameRateWithSeamlessness(ASurfaceTransaction* aSurfaceTransaction, - ASurfaceControl* aSurfaceControl, - float frameRate, int8_t compatibility, - bool shouldBeSeamless) { +void ASurfaceTransaction_setFrameRateWithChangeStrategy(ASurfaceTransaction* aSurfaceTransaction, + ASurfaceControl* aSurfaceControl, + float frameRate, int8_t compatibility, + int8_t changeFrameRateStrategy) { CHECK_NOT_NULL(aSurfaceTransaction); CHECK_NOT_NULL(aSurfaceControl); Transaction* transaction = ASurfaceTransaction_to_Transaction(aSurfaceTransaction); sp<SurfaceControl> surfaceControl = ASurfaceControl_to_SurfaceControl(aSurfaceControl); - transaction->setFrameRate(surfaceControl, frameRate, compatibility, shouldBeSeamless); + 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); } |