drm_hwcomposer: Query property when checking virtual displays availability

The current implementation of "getMaxVirtualDisplayCount" function
relies on the number of writeback connectors, but doesn't consider
the availability of CRTCs. Since CRTCs can only be bound to a single
pipeline, even though there are available writeback connectors, we
might fail to create a virtual pipeline if the CRTCs are being used.

This leads to failures in the "CreateVirtualDisplay" and
"SetOutputBuffer" VTS tests because the tests expect the creation of
a virtual pipeline to work based on the positive value returned by
"getMaxVirtualDisplayCount".

The virtual display feature in drm-hwcomposer is experimental and
currently unused. To address test failures, modify the function
"getMaxVirtualDisplayCount" to return 0 unless the property
"vendor.vendor.hwc.drm.enable_virtual_display" is explicitly set to
true.

Signed-off-by: Paz Zcharya <pazz@google.com>
diff --git a/drm/DrmHwc.cpp b/drm/DrmHwc.cpp
index 57293c2..6b62457 100644
--- a/drm/DrmHwc.cpp
+++ b/drm/DrmHwc.cpp
@@ -19,6 +19,9 @@
 #include "DrmHwc.h"
 
 #include <cinttypes>
+#include <string>
+
+#include <android-base/properties.h>
 
 #include "backend/Backend.h"
 #include "utils/log.h"
@@ -196,6 +199,15 @@
 }
 
 uint32_t DrmHwc::GetMaxVirtualDisplayCount() {
+  /* Virtual display is an experimental feature.
+   * Unless explicitly set to true, return 0 for no support.
+   */
+  if (!base::GetBoolProperty(std::string(
+                                 "vendor.hwc.drm.enable_virtual_display"),
+                             false)) {
+    return 0;
+  }
+
   auto writeback_count = resource_manager_.GetWritebackConnectorsCount();
   writeback_count = std::min(writeback_count, 1U);
   /* Currently, only 1 virtual display is supported. Other cases need testing */