From b3e336edd112667ba174f268ad4cce53a484c545 Mon Sep 17 00:00:00 2001 From: Leon Scroggins III Date: Thu, 6 Oct 2022 12:32:16 -0400 Subject: [PATCH] Add a DisplayCapability for multi-threaded present Also update composer3 to the latest version. Begin writing a test. Bug: 241285491 Test: atest VtsHalGraphicsComposer3_TargetTest:GraphicsComposerAidlCommandTest.MultiThreadedPresent Change-Id: I5dbb01fc23abd5e0108c565f96d25e62c77fc16d --- .../graphics/composer3/DisplayCapability.aidl | 1 + .../graphics/composer3/DisplayCapability.aidl | 16 ++++++++++++++++ .../vts/VtsHalGraphicsComposer3_TargetTest.cpp | 14 ++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCapability.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCapability.aidl index 6eba887aef..0e2d72bae0 100644 --- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCapability.aidl +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCapability.aidl @@ -42,4 +42,5 @@ enum DisplayCapability { AUTO_LOW_LATENCY_MODE = 5, SUSPEND = 6, DISPLAY_IDLE_TIMER = 7, + MULTI_THREADED_PRESENT = 8, } diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCapability.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCapability.aidl index f4b29843b8..7154d74499 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCapability.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCapability.aidl @@ -80,4 +80,20 @@ enum DisplayCapability { * IComposerCallback.onVsyncIdle. */ DISPLAY_IDLE_TIMER = 7, + /** + * Indicates that both the composer HAL implementation and the given display + * support calling executeCommands concurrently from separate threads. + * executeCommands for a particular display will never run concurrently to + * any other executeCommands for the same display. In addition, the + * CommandResultPayload must only reference displays included in the + * DisplayCommands passed to executeCommands. Displays referenced from + * separate threads must have minimal interference with one another. If a + * HWC-managed display has this capability, SurfaceFlinger can run + * executeCommands for this display concurrently with other displays with the + * same capability. + * @see IComposerClient.executeCommands + * @see DisplayCommand.presentDisplay + * @see DisplayCommand.validateDisplay + */ + MULTI_THREADED_PRESENT = 8, } diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp index 78dce63dc2..ed8a06c188 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp @@ -2170,6 +2170,20 @@ TEST_P(GraphicsComposerAidlTest, GetDisplayConfigNoRepetitions) { } } +TEST_P(GraphicsComposerAidlCommandTest, MultiThreadedPresent) { + std::vector displays; + for (auto& display : mDisplays) { + if (hasDisplayCapability(display.getDisplayId(), + DisplayCapability::MULTI_THREADED_PRESENT)) { + displays.push_back(&display); + } + } + if (displays.size() <= 1u) { + return; + } + // TODO(b/251842321): Try to present on multiple threads. +} + GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsComposerAidlCommandTest); INSTANTIATE_TEST_SUITE_P( PerInstance, GraphicsComposerAidlCommandTest,