drm_hwcomposer: Run test commit only when it actually needed
Composition testing is expensive. We do not need to spend CPU time when:
* All layers are marked as a client.
The patch skips CommitFrame function called by the ValidateDisplay
method in this case.
Signed-off-by: Matvii Zorin <matvii.zorin@globallogic.com>
diff --git a/drmhwctwo.cpp b/drmhwctwo.cpp
index 46071b9..8743b14 100644
--- a/drmhwctwo.cpp
+++ b/drmhwctwo.cpp
@@ -963,7 +963,9 @@
MarkValidated(z_map, client_start, client_size);
- if (CreateComposition(true) != HWC2::Error::None) {
+ bool testing_needed = !(client_start == 0 && client_size == z_map.size());
+
+ if (testing_needed && CreateComposition(true) != HWC2::Error::None) {
++total_stats_.failed_kms_validate_;
gpu_pixops = total_pixops;
client_size = z_map.size();