drm_hwcomposer: Rework ValidateDisplay layer check to use if statement rather then switch
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
diff --git a/drmhwctwo.cpp b/drmhwctwo.cpp
index cd79e7b..cf4ec11 100644
--- a/drmhwctwo.cpp
+++ b/drmhwctwo.cpp
@@ -745,18 +745,11 @@
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;