hwc2 : Allow only top most cursor layer
Reset cursor flag if it is not top most layer and
allow only top most cursor layer for HWCursor pipe.
Bug: 30153949
Change-Id: Iccd72e0cab9c43f20df0ca44b3e3a1c9a5d90bb6
Acked-by: Prabhanjan Kandula<pkandula@codeaurora.org>
CRs-Fixed: 1045845
diff --git a/msm8996/sdm/libs/hwc2/hwc_display.cpp b/msm8996/sdm/libs/hwc2/hwc_display.cpp
index a047694..edda67c 100644
--- a/msm8996/sdm/libs/hwc2/hwc_display.cpp
+++ b/msm8996/sdm/libs/hwc2/hwc_display.cpp
@@ -360,9 +360,15 @@
layer_stack_.flags.skip_present = true;
}
- if (layer->flags.cursor) {
- layer_stack_.flags.cursor_present = true;
+
+ if (hwc_layer->GetClientRequestedCompositionType() == HWC2::Composition::Cursor) {
+ // Currently we support only one HWCursor & only at top most z-order
+ if ((*layer_set_.rbegin())->GetId() == hwc_layer->GetId()) {
+ layer->flags.cursor = true;
+ layer_stack_.flags.cursor_present = true;
+ }
}
+
// TODO(user): Move to a getter if this is needed at other places
hwc_rect_t scaled_display_frame = {INT(layer->dst_rect.left), INT(layer->dst_rect.top),
INT(layer->dst_rect.right), INT(layer->dst_rect.bottom)};
diff --git a/msm8996/sdm/libs/hwc2/hwc_layers.cpp b/msm8996/sdm/libs/hwc2/hwc_layers.cpp
index 098959b..0f9b6b2 100644
--- a/msm8996/sdm/libs/hwc2/hwc_layers.cpp
+++ b/msm8996/sdm/libs/hwc2/hwc_layers.cpp
@@ -147,7 +147,6 @@
layer_->flags.solid_fill = true;
break;
case HWC2::Composition::Cursor:
- layer_->flags.cursor = true;
break;
case HWC2::Composition::Invalid:
return HWC2::Error::BadParameter;