OSDN Git Service

HWC2: Kill logspam for non-HWC virtual displays
authorDan Stoza <stoza@google.com>
Thu, 21 Jul 2016 18:09:40 +0000 (11:09 -0700)
committerSteve Kondik <steve@cyngn.com>
Wed, 5 Oct 2016 01:33:10 +0000 (18:33 -0700)
Removes some logspam and fixes some non-errors which were reported as
errors when running a virtual display that is not backed by hardware
composer.

Test: Cherry-pick from internal branch
Bug: 30022738
Change-Id: Ie966e37d95f53bcc050eef064d24bbe26748b7fd

services/surfaceflinger/DisplayHardware/HWComposer.cpp
services/surfaceflinger/Layer.cpp

index 2629794..216bbc9 100644 (file)
@@ -422,6 +422,10 @@ status_t HWComposer::prepare(DisplayDevice& displayDevice) {
 
     Mutex::Autolock _l(mDisplayLock);
     auto displayId = displayDevice.getHwcDisplayId();
+    if (displayId == DisplayDevice::DISPLAY_ID_INVALID) {
+        ALOGV("Skipping HWComposer prepare for non-HWC display");
+        return NO_ERROR;
+    }
     if (!isValidDisplay(displayId)) {
         return BAD_INDEX;
     }
@@ -515,6 +519,11 @@ status_t HWComposer::prepare(DisplayDevice& displayDevice) {
 }
 
 bool HWComposer::hasDeviceComposition(int32_t displayId) const {
+    if (displayId == DisplayDevice::DISPLAY_ID_INVALID) {
+        // Displays without a corresponding HWC display are never composed by
+        // the device
+        return false;
+    }
     if (!isValidDisplay(displayId)) {
         ALOGE("hasDeviceComposition: Invalid display %d", displayId);
         return false;
@@ -523,6 +532,11 @@ bool HWComposer::hasDeviceComposition(int32_t displayId) const {
 }
 
 bool HWComposer::hasClientComposition(int32_t displayId) const {
+    if (displayId == DisplayDevice::DISPLAY_ID_INVALID) {
+        // Displays without a corresponding HWC display are always composed by
+        // the client
+        return true;
+    }
     if (!isValidDisplay(displayId)) {
         ALOGE("hasClientComposition: Invalid display %d", displayId);
         return true;
index 928a6ba..046234f 100644 (file)
@@ -1089,8 +1089,13 @@ void Layer::setCompositionType(int32_t hwcId, HWC2::Composition type,
 }
 
 HWC2::Composition Layer::getCompositionType(int32_t hwcId) const {
+    if (hwcId == DisplayDevice::DISPLAY_ID_INVALID) {
+        // If we're querying the composition type for a display that does not
+        // have a HWC counterpart, then it will always be Client
+        return HWC2::Composition::Client;
+    }
     if (mHwcLayers.count(hwcId) == 0) {
-        ALOGE("getCompositionType called without a valid HWC layer");
+        ALOGE("getCompositionType called with an invalid HWC layer");
         return HWC2::Composition::Invalid;
     }
     return mHwcLayers.at(hwcId).compositionType;