diff options
Diffstat (limited to 'libhwc2.1/ExynosHWC.cpp')
-rw-r--r-- | libhwc2.1/ExynosHWC.cpp | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/libhwc2.1/ExynosHWC.cpp b/libhwc2.1/ExynosHWC.cpp index 8b3d9a4..fee44ed 100644 --- a/libhwc2.1/ExynosHWC.cpp +++ b/libhwc2.1/ExynosHWC.cpp @@ -1149,15 +1149,34 @@ int32_t exynos_SetActiveConfigWithConstraints(hwc2_device_t* dev, hwc2_display_t { HDEBUGLOGD(eDebugDisplayConfig, "%s, %d", __func__, config); ExynosDevice *exynosDevice = checkDevice(dev); + if (!exynosDevice) { + return HWC2_ERROR_BAD_DISPLAY; + } - if (exynosDevice) { - ExynosDisplay *exynosDisplay = checkDisplay(exynosDevice, display); - if (exynosDisplay) { - return exynosDisplay->setActiveConfigWithConstraints(config, vsyncPeriodChangeConstraints, outTimeline); + ExynosDisplay *exynosDisplay = checkDisplay(exynosDevice, display); + if (!exynosDisplay) { + return HWC2_ERROR_BAD_DISPLAY; + } + + const auto prevXres = exynosDisplay->mXres, prevYres = exynosDisplay->mYres; + auto ret = exynosDisplay->setActiveConfigWithConstraints(config, + vsyncPeriodChangeConstraints, + outTimeline); + if (ret != HWC2_ERROR_NONE) { + ALOGE("exynos_SetActiveConfigWithConstraints() failed config(%d)", config); + return ret; + } + + // when resolution is changed, HWC2 updates the property + if (prevXres != exynosDisplay->mDisplayConfigs[config].width || + prevYres != exynosDisplay->mDisplayConfigs[config].height) { + if ((ret = exynosDisplay->setBootDisplayConfig(config)) != HWC2_ERROR_NONE) { + ALOGE("setBootDisplayConfig() failed when setActiveConfigWithConstraints()"); + return ret; } } - return HWC2_ERROR_BAD_DISPLAY; + return HWC2_ERROR_NONE; } int32_t exynos_SetAutoLowLatencyMode(hwc2_device_t* dev, hwc2_display_t display, bool on) |