OSDN Git Service

drm_hwcomposer: Rework ValidateDisplay layer check to use if statement rather then...
authorJohn Stultz <john.stultz@linaro.org>
Wed, 9 Jan 2019 22:54:52 +0000 (14:54 -0800)
committerJohn Stultz <john.stultz@linaro.org>
Tue, 15 Jan 2019 18:53:46 +0000 (10:53 -0800)
AOSP's toolchain throws errors on un-annotated switch case
fallthroughs. Rather then adding [[fallthrough]] annotations,
which would add C++17 syntax, switch to using a if statement
instead.

Change-Id: Id0b2bf6d365d50e637569f0c4353ceb4fda21c16
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
v2: Rework conditional to be more readable as suggested by seanpaul

drmhwctwo.cpp

index cd79e7b..cf4ec11 100644 (file)
@@ -745,18 +745,11 @@ HWC2::Error DrmHwcTwo::HwcDisplay::ValidateDisplay(uint32_t *num_types,
 
   for (std::pair<const hwc2_layer_t, DrmHwcTwo::HwcLayer> &l : layers_) {
     DrmHwcTwo::HwcLayer &layer = l.second;
-    switch (layer.sf_type()) {
-      case HWC2::Composition::Device:
-        if (layer.validated_type() == HWC2::Composition::Device)
-          break;
-      // fall thru
-      case HWC2::Composition::SolidColor:
-      case HWC2::Composition::Cursor:
-      case HWC2::Composition::Sideband:
-      default:
-        layer.set_validated_type(HWC2::Composition::Client);
-        ++*num_types;
-        break;
+    // We can only handle layers of Device type, send everything else to SF
+    if (layer.sf_type() != HWC2::Composition::Device ||
+        layer.validated_type() != HWC2::Composition::Device) {
+      layer.set_validated_type(HWC2::Composition::Client);
+      ++*num_types;
     }
   }
   return *num_types ? HWC2::Error::HasChanges : HWC2::Error::None;