OSDN Git Service

Android: Enable support for Extended mode.
authorKalyan Kondapally <kalyan.kondapally@intel.com>
Mon, 17 Jul 2017 01:09:03 +0000 (21:09 -0400)
committerKalyan Kondapally <kalyan.kondapally@intel.com>
Mon, 17 Jul 2017 04:07:10 +0000 (00:07 -0400)
There seems to be no definitive way to track extended and cloned
mode here. What we do is if we get a ValidateDisplay request
for a display in cloned mode, we assume we will have a separate
update request for this display and disable the cloned mode.

Jira: IAHWC-80
Test: Extended mode works as expected on Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
common/display/displayqueue.cpp
os/android/iahwc2.cpp
os/android/iahwc2.h

index 83d5800..9da88a0 100644 (file)
@@ -286,7 +286,7 @@ bool DisplayQueue::QueueUpdate(std::vector<HwcLayer*>& source_layers,
   // Validate Overlays and Layers usage.
   if (!validate_layers) {
     bool can_ignore_commit = false;
-    // Before forcing layer validation check if content has changed
+    // Before forcing layer validation, check if content has changed
     // if not continue showing the current buffer.
     GetCachedLayers(layers, &current_composition_planes, &render_layers,
                     &can_ignore_commit);
index cba2da8..5c85c3e 100644 (file)
@@ -122,8 +122,7 @@ HWC2::Error IAHWC2::Init() {
     cloned->CloneDisplay(primary_display);
   }
 
-  // TODO: Enable support for extended mode.
-  /*for (size_t i = 1; i < size; ++i) {
+  for (size_t i = 1; i < size; ++i) {
     uint32_t index = i - 1;
     extended_displays_.emplace(std::piecewise_construct,
                                std::forward_as_tuple(index),
@@ -131,7 +130,7 @@ HWC2::Error IAHWC2::Init() {
 
     extended_displays_.at(index)
         .Init(displays.at(index), index, disable_explicit_sync_);
-  }*/
+  }
 
   // Start the hwc service
   // FIXME(IAHWC-76): On Android, with userdebug on Joule this is causing
@@ -246,6 +245,7 @@ HWC2::Error IAHWC2::HwcDisplay::Init(hwcomposer::NativeDisplay *display,
   type_ = HWC2::DisplayType::Physical;
   if (display_index == 0) {
     handle_ = HWC_DISPLAY_PRIMARY;
+    cloned_mode_ = false;
   } else {
     handle_ = HWC_DISPLAY_EXTERNAL;
   }
@@ -691,6 +691,12 @@ HWC2::Error IAHWC2::HwcDisplay::ValidateDisplay(uint32_t *num_types,
   }
 
   checkValidateDisplay = true;
+  // If we are in cloned mode, disable it.
+  if (cloned_mode_) {
+    cloned_mode_ = false;
+    display_->CloneDisplay(NULL);
+  }
+
   return HWC2::Error::None;
 }
 
index a23bf81..1423780 100644 (file)
@@ -182,6 +182,7 @@ class IAHWC2 : public hwc2_device_t {
     // True after validateDisplay
     bool checkValidateDisplay = false;
     bool disable_explicit_sync_ = false;
+    bool cloned_mode_ = true;
   };
 
   static IAHWC2 *toIAHWC2(hwc2_device_t *dev) {