diff options
author | Naseer Ahmed <naseer@codeaurora.org> | 2017-07-19 11:58:59 -0400 |
---|---|---|
committer | Steve Pfetsch <spfetsch@google.com> | 2017-08-23 15:48:43 -0700 |
commit | d8991a46243fc83743ced1f8e62c8746264e4838 (patch) | |
tree | e03dba27972959116265b52c6b2c8dd47af6c941 | |
parent | 80cb4abfd48107bd165dd4531111af510c5fc754 (diff) | |
download | display-d8991a46243fc83743ced1f8e62c8746264e4838.tar.gz |
hwc2: cursor fixes
* Treat cursor layers as device layers
* Reject incorrect setCursorPosition calls
Bug: 62992393
Change-Id: Icebc268d1429324f198691cee7aa1737d1a54081
-rw-r--r-- | msm8996/sdm/libs/hwc2/hwc_display.cpp | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/msm8996/sdm/libs/hwc2/hwc_display.cpp b/msm8996/sdm/libs/hwc2/hwc_display.cpp index 146d12b1..10b22206 100644 --- a/msm8996/sdm/libs/hwc2/hwc_display.cpp +++ b/msm8996/sdm/libs/hwc2/hwc_display.cpp @@ -364,15 +364,6 @@ void HWCDisplay::BuildLayerStack() { layer_stack_.flags.skip_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)}; @@ -1391,8 +1382,26 @@ HWC2::Error HWCDisplay::SetCursorPosition(hwc2_layer_t layer, int x, int y) { return HWC2::Error::None; } - // TODO(user): Validate layer - // TODO(user): Check if we're in a validate/present cycle + HWCLayer *hwc_layer = GetHWCLayer(layer); + if (hwc_layer == nullptr) { + return HWC2::Error::BadLayer; + } + if (hwc_layer->GetDeviceSelectedCompositionType() != HWC2::Composition::Cursor) { + return HWC2::Error::BadLayer; + } + if (validated_ == true) { + // the device is currently in the middle of the validate/present sequence, + // cannot set the Position(as per HWC2 spec) + return HWC2::Error::NotValidated; + } + + DisplayState state; + if (display_intf_->GetDisplayState(&state) == kErrorNone) { + if (state != kStateOn) { + return HWC2::Error::None; + } + } + auto error = display_intf_->SetCursorPosition(x, y); if (error != kErrorNone) { |