OSDN Git Service

drm_hwcomposer: do not queue layers map for virtual display
authorHaixia Shi <hshi@chromium.org>
Thu, 15 Oct 2015 23:21:48 +0000 (16:21 -0700)
committerHaixia Shi <hshi@chromium.org>
Fri, 16 Oct 2015 00:10:20 +0000 (17:10 -0700)
It is invalid to add a DrmCompositionDisplayLayersMap for the virtual
display because the corresponding physical display resources (such as
crtc, connector, etc.) do not exist.

BUG=24985282
TEST=verify that no crash occurs

Change-Id: I24a6671e7f94032a38104ae7ed3eb0da79479601

hwcomposer.cpp

index ac7fdac..31cbada 100644 (file)
@@ -498,7 +498,7 @@ static int hwc_set(hwc_composer_device_1_t *dev, size_t num_displays,
   for (size_t i = 0; i < num_displays; ++i) {
     hwc_display_contents_1_t *dc = sf_display_contents[i];
     DrmHwcDisplayContents &display_contents = displays_contents[i];
-    if (!sf_display_contents[i])
+    if (!sf_display_contents[i] || i == HWC_DISPLAY_VIRTUAL)
       continue;
 
     layers_map.emplace_back();
@@ -596,7 +596,8 @@ static int hwc_query(struct hwc_composer_device_1 * /* dev */, int what,
       *value = 1000 * 1000 * 1000 / 60;
       break;
     case HWC_DISPLAY_TYPES_SUPPORTED:
-      *value = HWC_DISPLAY_PRIMARY | HWC_DISPLAY_EXTERNAL | HWC_DISPLAY_VIRTUAL;
+      *value = HWC_DISPLAY_PRIMARY_BIT | HWC_DISPLAY_EXTERNAL_BIT |
+               HWC_DISPLAY_VIRTUAL_BIT;
       break;
   }
   return 0;