diff options
author | 2025-03-07 14:58:25 -0800 | |
---|---|---|
committer | 2025-03-14 13:16:28 -0700 | |
commit | bac7071aa3b1ae72f90b904b9af61b5c74ba9265 (patch) | |
tree | b350f3ed5472a4d2e9d511ee085aa997f64075ed /services/surfaceflinger/SurfaceFlinger.h | |
parent | 913c8f38edd7d5423a65f1b78b7c78a3cc7d8ef6 (diff) |
Turn off synthetic VSYNC when adjusting thread scheduling for performance
* This CL explicitly sets synthetic VSYNC state based on the new power state. Before, the synthetic VSYNC state was assumed based on the previous power state and in some cases was not set explicitly.
* The previous behaviour of enabling synthetic VSYNC if the only display is DOZE_SUSPEND is preserved.
* This also fixes a hypothetical gap where it would not optimise for performance if there were a display that needed it, while the primary display was DOZE_SUSPEND.
Bug: 342681202
Bug: 241285876
Flag: android.companion.virtualdevice.flags.correct_virtual_display_power_state
Test: manually tested with flag on/off using Android Auto Projected
Change-Id: I181aefad586ad7b1732c837b67a01d61939d1d3e
Diffstat (limited to 'services/surfaceflinger/SurfaceFlinger.h')
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.h | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h index 9cf0c6aaa0..f61214cc65 100644 --- a/services/surfaceflinger/SurfaceFlinger.h +++ b/services/surfaceflinger/SurfaceFlinger.h @@ -733,19 +733,14 @@ private: void setVirtualDisplayPowerMode(const sp<DisplayDevice>& display, hal::PowerMode mode) REQUIRES(mStateLock, kMainThreadContext); - // Returns whether to optimize globally for performance instead of power. - bool shouldOptimizeForPerformance() REQUIRES(mStateLock); - - // Turns on power optimizations, for example when there are no displays to be optimized for - // performance. - static void enablePowerOptimizations(const char* whence); - - // Turns off power optimizations. - static void disablePowerOptimizations(const char* whence); + // Adjusts thread scheduling according to the optimization policy + static void optimizeThreadScheduling( + const char* whence, gui::ISurfaceComposer::OptimizationPolicy optimizationPolicy); // Enables or disables power optimizations depending on whether there are displays that should // be optimized for performance. - void applyOptimizationPolicy(const char* whence) REQUIRES(mStateLock); + void applyOptimizationPolicy(const char* whence) REQUIRES(kMainThreadContext) + REQUIRES(mStateLock); // Returns the preferred mode for PhysicalDisplayId if the Scheduler has selected one for that // display. Falls back to the display's defaultModeId otherwise. |