diff options
author | Yichi Chen <yichichen@google.com> | 2021-12-16 21:59:24 +0800 |
---|---|---|
committer | Midas Chien <midaschieh@google.com> | 2022-01-04 14:57:00 +0800 |
commit | 6bf7e1132ab41883159a0906ea4f93fa39b1b8c3 (patch) | |
tree | 18268fefa787f89397c9aa858569948996aad722 /hwc3/ComposerCommandEngine.cpp | |
parent | 076837ca55baf1c9eca7b4115daa8190b12cbc35 (diff) |
hwc3: create the interface for expectedPresentTime
The expectedPresentTime is an optional value specified in
validateDisplay and presentOrValidateDisplay. The patch creates the
proper command dispatchers to read the information only in the two
functions. A warning message will show if the expectedPresentTime is
provided multiple times within one frame update.
Bug: 198186194
Test: VtsHalGraphicsComposer3_TargetTest
Change-Id: Ifff31202bef3297c1ddc28189ed301a7f6175695
Diffstat (limited to 'hwc3/ComposerCommandEngine.cpp')
-rw-r--r-- | hwc3/ComposerCommandEngine.cpp | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/hwc3/ComposerCommandEngine.cpp b/hwc3/ComposerCommandEngine.cpp index 062ec1e..0c92824 100644 --- a/hwc3/ComposerCommandEngine.cpp +++ b/hwc3/ComposerCommandEngine.cpp @@ -46,6 +46,13 @@ namespace aidl::android::hardware::graphics::composer3::impl { } \ } while (0) +#define DISPATCH_DISPLAY_BOOL_COMMAND_AND_DATA(displayCmd, field, data, funcName) \ + do { \ + if (displayCmd.field) { \ + execute##funcName(displayCmd.display, displayCmd.data); \ + } \ + } while (0) + bool ComposerCommandEngine::init() { mWriter = std::make_unique<ComposerServiceWriter>(); return (mWriter != nullptr); @@ -73,10 +80,12 @@ void ComposerCommandEngine::dispatchDisplayCommand(const DisplayCommand& command DISPATCH_DISPLAY_COMMAND(command, virtualDisplayOutputBuffer, SetOutputBuffer); // TODO: (b/196171661) SDR & HDR blending // DISPATCH_DISPLAY_COMMAND(command, displayBrightness, SetDisplayBrightness); - DISPATCH_DISPLAY_BOOL_COMMAND(command, validateDisplay, ValidateDisplay); + DISPATCH_DISPLAY_BOOL_COMMAND_AND_DATA(command, validateDisplay, expectedPresentTime, + ValidateDisplay); DISPATCH_DISPLAY_BOOL_COMMAND(command, acceptDisplayChanges, AcceptDisplayChanges); DISPATCH_DISPLAY_BOOL_COMMAND(command, presentDisplay, PresentDisplay); - DISPATCH_DISPLAY_BOOL_COMMAND(command, presentOrValidateDisplay, PresentOrValidateDisplay); + DISPATCH_DISPLAY_BOOL_COMMAND_AND_DATA(command, presentOrValidateDisplay, expectedPresentTime, + PresentOrValidateDisplay); } void ComposerCommandEngine::dispatchLayerCommand(int64_t display, const LayerCommand& command) { @@ -178,11 +187,21 @@ void ComposerCommandEngine::executeSetOutputBuffer(uint64_t display, const Buffe } } -void ComposerCommandEngine::executeValidateDisplay(int64_t display) { +void ComposerCommandEngine::executeSetExpectedPresentTimeInternal( + int64_t display, const std::optional<ClockMonotonicTimestamp> expectedPresentTime) { + mHal->setExpectedPresentTime(display, expectedPresentTime); +} + +void ComposerCommandEngine::executeValidateDisplay( + int64_t display, const std::optional<ClockMonotonicTimestamp> expectedPresentTime) { + executeSetExpectedPresentTimeInternal(display, expectedPresentTime); executeValidateDisplayInternal(display); } -void ComposerCommandEngine::executePresentOrValidateDisplay(int64_t display) { +void ComposerCommandEngine::executePresentOrValidateDisplay( + int64_t display, const std::optional<ClockMonotonicTimestamp> expectedPresentTime) { + executeSetExpectedPresentTimeInternal(display, expectedPresentTime); + int err; // First try to Present as is. if (mHal->hasCapability(Capability::SKIP_VALIDATE)) { |