From dd7bf2fea566be919c7807b14833c3d3c1fa8458 Mon Sep 17 00:00:00 2001 From: Steven Thomas Date: Fri, 31 Jan 2020 18:50:02 -0800 Subject: Add compatibility param to setFrameRate() api Add a compatiblity param to the setFrameRate() api, so the system has more info to decide the device frame rate when there are multiple competing preferences. I also changed the plumbing for setFrameRate() to go directly to surface flinger, instead of through buffer queue. We're trying to avoid changes to buffer queue code, to avoid disturbing the prebuilts. Bug: 137287430 Test: Added new cts tests to verify behavior of the compatibility param. cts-tradefed run commandAndExit cts-dev --module CtsGraphicsTestCases --test android.graphics.cts.SetFrameRateTest Test: /data/nativetest64/SurfaceFlinger_test/SurfaceFlinger_test --gtest_filter='SetFrameRateTest.*' Change-Id: I9123afee2ba63d01ff35fb2b257a1ee0e4928ddd --- native/android/surface_control.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'native') diff --git a/native/android/surface_control.cpp b/native/android/surface_control.cpp index ba793e83f1fb..0af6cbf3cb40 100644 --- a/native/android/surface_control.cpp +++ b/native/android/surface_control.cpp @@ -547,16 +547,11 @@ void ASurfaceTransaction_setColor(ASurfaceTransaction* aSurfaceTransaction, } void ASurfaceTransaction_setFrameRate(ASurfaceTransaction* aSurfaceTransaction, - ASurfaceControl* aSurfaceControl, float frameRate) { + ASurfaceControl* aSurfaceControl, float frameRate, + int8_t compatibility) { CHECK_NOT_NULL(aSurfaceTransaction); CHECK_NOT_NULL(aSurfaceControl); - - sp surfaceControl = ASurfaceControl_to_SurfaceControl(aSurfaceControl); - if (frameRate < 0) { - ALOGE("Failed to set frame ate - invalid frame rate"); - return; - } - Transaction* transaction = ASurfaceTransaction_to_Transaction(aSurfaceTransaction); - transaction->setFrameRate(surfaceControl, frameRate); + sp surfaceControl = ASurfaceControl_to_SurfaceControl(aSurfaceControl); + transaction->setFrameRate(surfaceControl, frameRate, compatibility); } -- cgit v1.2.3