diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2018-09-09 10:32:10 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2018-09-09 10:32:10 -0700 |
commit | 0d0d8fb1dbac70212796bc3e4a93d3b936ac5101 (patch) | |
tree | fc2beafc26226726048edc92922f398317c7bdea | |
parent | 425545165353f882abbdd6eac0828d3515ef4186 (diff) | |
parent | 08f7a64fd5b9a9a7779322d50eca8c9c380129c2 (diff) | |
download | android_hardware_qcom_sdm710_display-0d0d8fb1dbac70212796bc3e4a93d3b936ac5101.tar.gz android_hardware_qcom_sdm710_display-0d0d8fb1dbac70212796bc3e4a93d3b936ac5101.tar.bz2 android_hardware_qcom_sdm710_display-0d0d8fb1dbac70212796bc3e4a93d3b936ac5101.zip |
Merge "hwc2: Fix GetDozeSupport api to handle failure case"
-rw-r--r-- | sdm/libs/hwc2/hwc_session.cpp | 19 | ||||
-rw-r--r-- | sdm/libs/hwc2/hwc_session.h | 2 |
2 files changed, 14 insertions, 7 deletions
diff --git a/sdm/libs/hwc2/hwc_session.cpp b/sdm/libs/hwc2/hwc_session.cpp index 39c73f85..e4404648 100644 --- a/sdm/libs/hwc2/hwc_session.cpp +++ b/sdm/libs/hwc2/hwc_session.cpp @@ -562,12 +562,14 @@ static int32_t GetDisplayType(hwc2_device_t *device, hwc2_display_t display, int return HWCSession::CallDisplayFunction(device, display, &HWCDisplay::GetDisplayType, out_type); } -static int32_t GetDozeSupport(hwc2_device_t *device, hwc2_display_t display, int32_t *out_support) { +int32_t HWCSession::GetDozeSupport(hwc2_device_t *device, hwc2_display_t display, + int32_t *out_support) { if (!device || !out_support) { return HWC2_ERROR_BAD_PARAMETER; } - if (display >= HWC_NUM_DISPLAY_TYPES) { + HWCSession *hwc_session = static_cast<HWCSession *>(device); + if (display >= HWC_NUM_DISPLAY_TYPES || (hwc_session->hwc_display_[display] == nullptr) ) { return HWC2_ERROR_BAD_DISPLAY; } @@ -611,7 +613,7 @@ int32_t HWCSession::PresentDisplay(hwc2_device_t *device, hwc2_display_t display auto status = HWC2::Error::BadDisplay; DTRACE_SCOPED(); - if (display >= HWC_NUM_DISPLAY_TYPES) { + if (display >= HWC_NUM_DISPLAY_TYPES || (hwc_session->hwc_display_[display] == nullptr)) { return HWC2_ERROR_BAD_DISPLAY; } @@ -626,9 +628,7 @@ int32_t HWCSession::PresentDisplay(hwc2_device_t *device, hwc2_display_t display } // TODO(user): Handle virtual display/HDMI concurrency - if (hwc_session->hwc_display_[display]) { - status = hwc_session->PresentDisplayInternal(display, out_retire_fence); - } + status = hwc_session->PresentDisplayInternal(display, out_retire_fence); } if (status != HWC2::Error::None && status != HWC2::Error::NotValidated) { @@ -847,7 +847,12 @@ int32_t HWCSession::SetPowerMode(hwc2_device_t *device, hwc2_display_t display, // all displays support on/off. Check for doze modes int support = 0; - GetDozeSupport(device, display, &support); + + auto status = GetDozeSupport(device, display, &support); + if (status != HWC2_ERROR_NONE) { + return INT32(status); + } + if (!support && (mode == HWC2::PowerMode::Doze || mode == HWC2::PowerMode::DozeSuspend)) { return HWC2_ERROR_UNSUPPORTED; } diff --git a/sdm/libs/hwc2/hwc_session.h b/sdm/libs/hwc2/hwc_session.h index 8f4c7c20..5b94b572 100644 --- a/sdm/libs/hwc2/hwc_session.h +++ b/sdm/libs/hwc2/hwc_session.h @@ -177,6 +177,8 @@ class HWCSession : hwc2_device_t, HWCUEventListener, IDisplayConfig, public qCli const native_handle_t *buffer, int32_t acquire_fence); static int32_t GetReadbackBufferFence(hwc2_device_t *device, hwc2_display_t display, int32_t *release_fence); + static int32_t GetDozeSupport(hwc2_device_t *device, hwc2_display_t display, + int32_t *out_support); static Locker locker_[HWC_NUM_DISPLAY_TYPES]; |