From 0ae2d417a95d0b163e4ad65941e0b6c34d710408 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Wed, 8 May 2024 09:45:45 -0700 Subject: [PATCH] [Impeller] require and use backpressure for AHB swapchain. --- impeller/toolkit/android/proc_table.h | 1 + impeller/toolkit/android/surface_control.cc | 4 +++- impeller/toolkit/android/surface_transaction.cc | 8 +++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/impeller/toolkit/android/proc_table.h b/impeller/toolkit/android/proc_table.h index 9e639603b9c1b..3f34cfd65999a 100644 --- a/impeller/toolkit/android/proc_table.h +++ b/impeller/toolkit/android/proc_table.h @@ -60,6 +60,7 @@ namespace impeller::android { INVOKE(ASurfaceTransaction_setBuffer, 29) \ INVOKE(ASurfaceTransaction_setColor, 29) \ INVOKE(ASurfaceTransaction_setOnComplete, 29) \ + INVOKE(ASurfaceTransaction_setEnableBackPressure, 31) \ INVOKE(ASurfaceTransactionStats_getPreviousReleaseFenceFd, 29) \ INVOKE(ATrace_isEnabled, 23) \ INVOKE(eglGetNativeClientBufferANDROID, 0) diff --git a/impeller/toolkit/android/surface_control.cc b/impeller/toolkit/android/surface_control.cc index 71282e7ccc981..da6a48b572791 100644 --- a/impeller/toolkit/android/surface_control.cc +++ b/impeller/toolkit/android/surface_control.cc @@ -5,6 +5,7 @@ #include "impeller/toolkit/android/surface_control.h" #include "impeller/base/validation.h" +#include "impeller/toolkit/android/proc_table.h" #include "impeller/toolkit/android/surface_transaction.h" namespace impeller::android { @@ -49,7 +50,8 @@ bool SurfaceControl::RemoveFromParent() const { bool SurfaceControl::IsAvailableOnPlatform() { return GetProcTable().IsValid() && - GetProcTable().ASurfaceControl_createFromWindow.IsAvailable(); + GetProcTable().ASurfaceControl_createFromWindow.IsAvailable() && + GetProcTable().ASurfaceTransaction_setEnableBackPressure.IsAvailable(); } } // namespace impeller::android diff --git a/impeller/toolkit/android/surface_transaction.cc b/impeller/toolkit/android/surface_transaction.cc index 557dedb3cb261..454f62ddb203c 100644 --- a/impeller/toolkit/android/surface_transaction.cc +++ b/impeller/toolkit/android/surface_transaction.cc @@ -58,7 +58,13 @@ bool SurfaceTransaction::SetContents(const SurfaceControl* control, VALIDATION_LOG << "Invalid control or buffer."; return false; } - GetProcTable().ASurfaceTransaction_setBuffer( + + const auto& proc_table = GetProcTable(); + + proc_table.ASurfaceTransaction_setEnableBackPressure( + transaction_.get(), control->GetHandle(), true); + + proc_table.ASurfaceTransaction_setBuffer( transaction_.get(), // control->GetHandle(), // buffer->GetHandle(), //