summaryrefslogtreecommitdiff
path: root/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterface.cpp
diff options
context:
space:
mode:
authorMidas Chien <midaschieh@google.com>2020-12-22 21:07:52 +0800
committerMidas Chien <midaschieh@google.com>2020-12-24 00:43:44 +0800
commit4e764f3431eed2c22d1772cf76747bdebb832a4c (patch)
tree1e5164db3a3773638a5db645e1c4faf20bf087a4 /libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterface.cpp
parentd735cc29d620aac033bd61176b2474dd1ff17571 (diff)
libhwc2.1: force set display mode after exit DOZE mode
Doze mode now is a new display mode but it doesn't exposed to framework. Therefore the display mode need to be restored to previous or pending mode after exiting doze mode. Bug: 164139096 Test: VtsHalGraphicsComposerV2_4TargetTest Test: stress test AoD in/out, display on/off, boot Change-Id: I31ee313973530e880ee916a10f47a5a511b717cc
Diffstat (limited to 'libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterface.cpp')
-rw-r--r--libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterface.cpp40
1 files changed, 24 insertions, 16 deletions
diff --git a/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterface.cpp b/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterface.cpp
index be5840a..dba37ac 100644
--- a/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterface.cpp
+++ b/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterface.cpp
@@ -28,8 +28,9 @@ using namespace std::chrono_literals;
constexpr uint32_t MAX_PLANE_NUM = 3;
constexpr uint32_t CBCR_INDEX = 1;
constexpr float DISPLAY_LUMINANCE_UNIT = 10000;
+constexpr auto nsecsPerMs = std::chrono::nanoseconds(1ms).count();
constexpr auto nsecsPerSec = std::chrono::nanoseconds(1s).count();
-constexpr auto microsecsPerSec = std::chrono::microseconds(1s).count();
+constexpr auto vsyncPeriodTag = "VsyncPeriod";
typedef struct _drmModeAtomicReqItem drmModeAtomicReqItem, *drmModeAtomicReqItemPtr;
@@ -259,22 +260,21 @@ void ExynosDisplayDrmInterface::Callback(
ExynosDevice *exynosDevice = mExynosDisplay->mDevice;
exynosDevice->compareVsyncPeriod();
if (exynosDevice->mVsyncDisplay == (int)mExynosDisplay->mDisplayId) {
- auto vsyncCallbackInfo =
- exynosDevice->mCallbackInfos[HWC2_CALLBACK_VSYNC];
- if (vsyncCallbackInfo.funcPointer &&
- vsyncCallbackInfo.callbackData)
- ((HWC2_PFN_VSYNC)vsyncCallbackInfo.funcPointer)(
- vsyncCallbackInfo.callbackData,
- mExynosDisplay->mDisplayId, timestamp);
-
auto vsync_2_4CallbackInfo =
exynosDevice->mCallbackInfos[HWC2_CALLBACK_VSYNC_2_4];
- if (vsync_2_4CallbackInfo.funcPointer &&
- vsync_2_4CallbackInfo.callbackData)
+ if (vsync_2_4CallbackInfo.funcPointer && vsync_2_4CallbackInfo.callbackData) {
((HWC2_PFN_VSYNC_2_4)vsync_2_4CallbackInfo.funcPointer)(
vsync_2_4CallbackInfo.callbackData,
mExynosDisplay->mDisplayId,
timestamp, mExynosDisplay->mVsyncPeriod);
+ ATRACE_INT(vsyncPeriodTag, static_cast<int32_t>(mExynosDisplay->mVsyncPeriod));
+ return;
+ }
+
+ auto vsyncCallbackInfo = exynosDevice->mCallbackInfos[HWC2_CALLBACK_VSYNC];
+ if (vsyncCallbackInfo.funcPointer && vsyncCallbackInfo.callbackData)
+ ((HWC2_PFN_VSYNC)vsyncCallbackInfo.funcPointer)(vsyncCallbackInfo.callbackData,
+ mExynosDisplay->mDisplayId, timestamp);
}
}
@@ -299,8 +299,7 @@ bool ExynosDisplayDrmInterface::ExynosVsyncCallback::Callback(
* mDesiredVsyncPeriod is nanoseconds
* Compare with milliseconds
*/
- if (mDesiredVsyncPeriod/microsecsPerSec == mVsyncPeriod/microsecsPerSec)
- return true;
+ if (mDesiredVsyncPeriod / nsecsPerMs == mVsyncPeriod / nsecsPerMs) return true;
return false;
}
@@ -337,7 +336,7 @@ int32_t ExynosDisplayDrmInterface::setLowPowerMode() {
mExynosDisplay->mXres = mDozeDrmMode.h_display();
mExynosDisplay->mYres = mDozeDrmMode.v_display();
// in nanoseconds
- mExynosDisplay->mVsyncPeriod = 1000 * 1000 * 1000 / mDozeDrmMode.v_refresh();
+ mExynosDisplay->mVsyncPeriod = nsecsPerSec / mDozeDrmMode.v_refresh();
// Dots per 1000 inches
mExynosDisplay->mXdpi = mm_width ? (mDozeDrmMode.h_display() * kUmPerInch) / mm_width : -1;
// Dots per 1000 inches
@@ -374,6 +373,13 @@ int32_t ExynosDisplayDrmInterface::setVsyncEnabled(uint32_t enabled)
}
mVsyncCallback.enableVSync(HWC2_VSYNC_ENABLE == enabled);
+
+ ExynosDevice *exynosDevice = mExynosDisplay->mDevice;
+ auto vsync_2_4CallbackInfo = exynosDevice->mCallbackInfos[HWC2_CALLBACK_VSYNC_2_4];
+ if (vsync_2_4CallbackInfo.funcPointer && vsync_2_4CallbackInfo.callbackData) {
+ ATRACE_INT(vsyncPeriodTag, 0);
+ }
+
return NO_ERROR;
}
@@ -620,7 +626,6 @@ int32_t ExynosDisplayDrmInterface::setActiveDrmMode(DrmMode const &mode) {
}
int32_t ExynosDisplayDrmInterface::setActiveConfig(hwc2_config_t config) {
- ALOGD("%s:: %s config(%d)", __func__, mExynosDisplay->mDisplayName.string(), config);
auto mode = std::find_if(mDrmConnector->modes().begin(), mDrmConnector->modes().end(),
[config](DrmMode const &m) { return m.id() == config; });
if (mode == mDrmConnector->modes().end()) {
@@ -628,8 +633,11 @@ int32_t ExynosDisplayDrmInterface::setActiveConfig(hwc2_config_t config) {
return HWC2_ERROR_BAD_CONFIG;
}
- if (!setActiveDrmMode(*mode))
+ if (!setActiveDrmMode(*mode)) {
ALOGI("%s:: %s config(%d)", __func__, mExynosDisplay->mDisplayName.string(), config);
+ } else {
+ ALOGE("%s:: %s config(%d) failed", __func__, mExynosDisplay->mDisplayName.string(), config);
+ }
return 0;
}