diff options
author | John Stultz <john.stultz@linaro.org> | 2019-01-09 14:54:52 -0800 |
---|---|---|
committer | John Stultz <john.stultz@linaro.org> | 2019-01-15 10:53:46 -0800 |
commit | 734ee1c2e3d0b2c39f111db8efbf253bc17005b8 (patch) | |
tree | a79db90a0751e629bc89f96e0dd215b332cba37f | |
parent | 5047b229d8ca076d6a4631e5e58867f674a04749 (diff) | |
download | drm_hwcomposer-734ee1c2e3d0b2c39f111db8efbf253bc17005b8.tar.gz |
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
-rw-r--r-- | drmhwctwo.cpp | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/drmhwctwo.cpp b/drmhwctwo.cpp index cd79e7b..cf4ec11 100644 --- a/drmhwctwo.cpp +++ b/drmhwctwo.cpp @@ -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; |