drm_hwcomposer: Allow skipping round-trip to SF before presenting
PresentOrValidateDisplay feature allows to present composition without
a round trip to Surface Flinger in case the client layer does not have
to be updated. This saves some CPU time.
Change-Id: I7969f90a45525b2d9dfdc12a0006cd9b36ac98ba
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
diff --git a/hwc2_device/HwcDisplay.cpp b/hwc2_device/HwcDisplay.cpp
index 26a60be..121f04f 100644
--- a/hwc2_device/HwcDisplay.cpp
+++ b/hwc2_device/HwcDisplay.cpp
@@ -1279,4 +1279,12 @@
backend_ = std::move(backend);
}
+bool HwcDisplay::NeedsClientLayerUpdate() const {
+ return std::any_of(layers_.begin(), layers_.end(), [](const auto &pair) {
+ const auto &layer = pair.second;
+ return layer.GetSfType() == HWC2::Composition::Client ||
+ layer.GetValidatedType() == HWC2::Composition::Client;
+ });
+}
+
} // namespace android
diff --git a/hwc2_device/HwcDisplay.h b/hwc2_device/HwcDisplay.h
index 7c24dea..069a6ee 100644
--- a/hwc2_device/HwcDisplay.h
+++ b/hwc2_device/HwcDisplay.h
@@ -247,6 +247,8 @@
auto getDisplayPhysicalOrientation() -> std::optional<PanelOrientation>;
+ bool NeedsClientLayerUpdate() const;
+
private:
AtomicCommitArgs CreateModesetCommit(
const HwcDisplayConfig *config,