From: John Stultz Date: Wed, 9 Jan 2019 22:54:52 +0000 (-0800) Subject: drm_hwcomposer: Rework ValidateDisplay layer check to use if statement rather then... X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=734ee1c2e3d0b2c39f111db8efbf253bc17005b8;p=android-x86%2Fexternal-drm_hwcomposer.git 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 --- 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 @@ HWC2::Error DrmHwcTwo::HwcDisplay::ValidateDisplay(uint32_t *num_types, for (std::pair &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;