summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libhwc2.1/libdevice/ExynosDevice.cpp88
-rw-r--r--libhwc2.1/libdevice/ExynosDevice.h4
-rw-r--r--libhwc2.1/libdevice/ExynosDisplay.cpp4
-rw-r--r--libhwc2.1/libdisplayinterface/ExynosDeviceDrmInterface.cpp2
-rw-r--r--libhwc2.1/libexternaldisplay/ExynosExternalDisplay.cpp6
-rw-r--r--libhwc2.1/libhwcService/ExynosHWCService.cpp8
-rw-r--r--libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.cpp2
-rw-r--r--libhwc2.1/pixel-display.cpp2
8 files changed, 64 insertions, 52 deletions
diff --git a/libhwc2.1/libdevice/ExynosDevice.cpp b/libhwc2.1/libdevice/ExynosDevice.cpp
index dfe9038..08009c5 100644
--- a/libhwc2.1/libdevice/ExynosDevice.cpp
+++ b/libhwc2.1/libdevice/ExynosDevice.cpp
@@ -217,13 +217,12 @@ void ExynosDevice::initDeviceInterface(uint32_t interfaceType)
}
ExynosDevice::~ExynosDevice() {
-
- ExynosDisplay *primary_display = getDisplay(getDisplayId(HWC_DISPLAY_PRIMARY,0));
-
mDRLoopStatus = false;
mDRThread.join();
-
- delete primary_display;
+ for(auto& display : mDisplays) {
+ delete display;
+ }
+ mDisplays.clear();
}
bool ExynosDevice::isFirstValidate()
@@ -307,7 +306,6 @@ void *ExynosDevice::dynamicRecompositionThreadLoop(void *data)
android_atomic_inc(&(dev->mDRThreadStatus));
while (dev->mDRLoopStatus) {
- uint32_t result = 0;
for (uint32_t i = 0; i < dev->mDisplays.size(); i++)
event_cnt[i] = display[i]->mUpdateEventCnt;
@@ -323,11 +321,10 @@ void *ExynosDevice::dynamicRecompositionThreadLoop(void *data)
if (display[i]->checkDynamicReCompMode() == DEVICE_2_CLIENT) {
display[i]->mUpdateEventCnt = 0;
display[i]->setGeometryChanged(GEOMETRY_DISPLAY_DYNAMIC_RECOMPOSITION);
- result = 1;
+ dev->onRefresh(display[i]->mDisplayId);
}
}
}
- if (result) dev->onRefresh();
}
android_atomic_dec(&(dev->mDRThreadStatus));
@@ -513,16 +510,29 @@ void ExynosDevice::onHotPlug(uint32_t displayId, bool status) {
callbackFunc(callbackData, displayId,
status ? HWC2_CONNECTION_CONNECTED : HWC2_CONNECTION_DISCONNECTED);
}
+void ExynosDevice::onRefreshDisplays() {
+ for (auto& display : mDisplays) {
+ onRefresh(display->mDisplayId);
+ }
+}
-void ExynosDevice::onRefresh() {
+void ExynosDevice::onRefresh(uint32_t displayId) {
Mutex::Autolock lock(mDeviceCallbackMutex);
if (!isCallbackRegisteredLocked(HWC2_CALLBACK_REFRESH)) return;
+ if (!checkDisplayConnection(displayId)) return;
+
+ ExynosDisplay *display = (ExynosDisplay *)getDisplay(displayId);
+
+ if (!display->mPowerModeState.has_value() ||
+ (display->mPowerModeState.value() == (hwc2_power_mode_t)HWC_POWER_MODE_OFF))
+ return;
+
hwc2_callback_data_t callbackData = mCallbackInfos[HWC2_CALLBACK_REFRESH].callbackData;
HWC2_PFN_REFRESH callbackFunc =
reinterpret_cast<HWC2_PFN_REFRESH>(mCallbackInfos[HWC2_CALLBACK_REFRESH].funcPointer);
- callbackFunc(callbackData, getDisplayId(HWC_DISPLAY_PRIMARY, 0));
+ callbackFunc(callbackData, displayId);
}
void ExynosDevice::onVsync(uint32_t displayId, int64_t timestamp) {
@@ -615,21 +625,20 @@ void ExynosDevice::getHWCFenceDebug()
ALOGE("[HWCFenceDebug] IP_Number(%d) : Debug(%x)", i, hwcFenceDebug[i]);
}
-void ExynosDevice::setHWCControl(uint32_t display, uint32_t ctrl, int32_t val)
-{
+void ExynosDevice::setHWCControl(uint32_t displayId, uint32_t ctrl, int32_t val) {
ExynosDisplay *exynosDisplay = NULL;
switch (ctrl) {
case HWC_CTL_FORCE_GPU:
ALOGI("%s::HWC_CTL_FORCE_GPU on/off=%d", __func__, val);
exynosHWCControl.forceGpu = (unsigned int)val;
setGeometryChanged(GEOMETRY_DEVICE_CONFIG_CHANGED);
- onRefresh();
+ onRefresh(displayId);
break;
case HWC_CTL_WINDOW_UPDATE:
ALOGI("%s::HWC_CTL_WINDOW_UPDATE on/off=%d", __func__, val);
exynosHWCControl.windowUpdate = (unsigned int)val;
setGeometryChanged(GEOMETRY_DEVICE_CONFIG_CHANGED);
- onRefresh();
+ onRefresh(displayId);
break;
case HWC_CTL_FORCE_PANIC:
ALOGI("%s::HWC_CTL_FORCE_PANIC on/off=%d", __func__, val);
@@ -650,33 +659,33 @@ void ExynosDevice::setHWCControl(uint32_t display, uint32_t ctrl, int32_t val)
ALOGI("%s::HWC_CTL_SKIP_RESOURCE_ASSIGN on/off=%d", __func__, val);
exynosHWCControl.skipResourceAssign = (unsigned int)val;
setGeometryChanged(GEOMETRY_DEVICE_CONFIG_CHANGED);
- onRefresh();
+ onRefreshDisplays();
break;
case HWC_CTL_SKIP_VALIDATE:
ALOGI("%s::HWC_CTL_SKIP_VALIDATE on/off=%d", __func__, val);
exynosHWCControl.skipValidate = (unsigned int)val;
setGeometryChanged(GEOMETRY_DEVICE_CONFIG_CHANGED);
- onRefresh();
+ onRefreshDisplays();
break;
case HWC_CTL_DUMP_MID_BUF:
ALOGI("%s::HWC_CTL_DUMP_MID_BUF on/off=%d", __func__, val);
exynosHWCControl.dumpMidBuf = (unsigned int)val;
setGeometryChanged(GEOMETRY_DEVICE_CONFIG_CHANGED);
- onRefresh();
+ onRefreshDisplays();
break;
case HWC_CTL_CAPTURE_READBACK:
- captureScreenWithReadback(HWC_DISPLAY_PRIMARY);
+ captureScreenWithReadback(displayId);
break;
case HWC_CTL_DISPLAY_MODE:
ALOGI("%s::HWC_CTL_DISPLAY_MODE mode=%d", __func__, val);
setDisplayMode((uint32_t)val);
setGeometryChanged(GEOMETRY_DEVICE_CONFIG_CHANGED);
- onRefresh();
+ onRefreshDisplays();
break;
// Support DDI scalser {
case HWC_CTL_DDI_RESOLUTION_CHANGE:
ALOGI("%s::HWC_CTL_DDI_RESOLUTION_CHANGE mode=%d", __func__, val);
- exynosDisplay = (ExynosDisplay*)getDisplay(display);
+ exynosDisplay = (ExynosDisplay *)getDisplay(displayId);
uint32_t width, height;
/* TODO: Add branch here for each resolution/index */
@@ -697,7 +706,7 @@ void ExynosDevice::setHWCControl(uint32_t display, uint32_t ctrl, int32_t val)
exynosDisplay->setDDIScalerEnable(width, height);
}
setGeometryChanged(GEOMETRY_DISPLAY_RESOLUTION_CHANGED);
- onRefresh();
+ onRefreshDisplays();
break;
// } Support DDI scaler
case HWC_CTL_ENABLE_COMPOSITION_CROP:
@@ -706,7 +715,7 @@ void ExynosDevice::setHWCControl(uint32_t display, uint32_t ctrl, int32_t val)
case HWC_CTL_USE_MAX_G2D_SRC:
case HWC_CTL_ENABLE_HANDLE_LOW_FPS:
case HWC_CTL_ENABLE_EARLY_START_MPP:
- exynosDisplay = (ExynosDisplay*)getDisplay(display);
+ exynosDisplay = (ExynosDisplay *)getDisplay(displayId);
if (exynosDisplay == NULL) {
for (uint32_t i = 0; i < mDisplays.size(); i++) {
mDisplays[i]->setHWCControl(ctrl, val);
@@ -715,7 +724,7 @@ void ExynosDevice::setHWCControl(uint32_t display, uint32_t ctrl, int32_t val)
exynosDisplay->setHWCControl(ctrl, val);
}
setGeometryChanged(GEOMETRY_DEVICE_CONFIG_CHANGED);
- onRefresh();
+ onRefreshDisplays();
break;
case HWC_CTL_DYNAMIC_RECOMP:
ALOGI("%s::HWC_CTL_DYNAMIC_RECOMP on/off = %d", __func__, val);
@@ -983,11 +992,10 @@ void ExynosDevice::signalReadbackDone()
}
}
-void ExynosDevice::captureScreenWithReadback(uint32_t displayType)
-{
- ExynosDisplay *display = getDisplay(displayType);
+void ExynosDevice::captureScreenWithReadback(uint32_t displayId) {
+ ExynosDisplay *display = getDisplay(displayId);
if (display == nullptr) {
- ALOGE("There is no display(%d)", displayType);
+ ALOGE("There is no display(%d)", displayId);
return;
}
@@ -1014,7 +1022,7 @@ void ExynosDevice::captureScreenWithReadback(uint32_t displayType)
}
/* Update screen */
- onRefresh();
+ onRefresh(displayId);
/* Wait for handling readback */
uint32_t waitPeriod = display->mVsyncPeriod * 3;
@@ -1057,20 +1065,22 @@ int32_t ExynosDevice::setDisplayDeviceMode(int32_t display_id, int32_t mode)
{
int32_t ret = HWC2_ERROR_NONE;
- if (display_id == HWC_DISPLAY_PRIMARY) {
- if (mode == static_cast<int32_t>(ext_hwc2_power_mode_t::PAUSE) ||
- mode == static_cast<int32_t>(ext_hwc2_power_mode_t::RESUME)) {
- ret = mDisplays[display_id]->setPowerMode(mode);
- if (mode == static_cast<int32_t>(ext_hwc2_power_mode_t::RESUME) && ret == HWC2_ERROR_NONE) {
- onRefresh();
+ for (size_t i = 0; i < mDisplays.size(); i++) {
+ if (mDisplays[i]->mType == HWC_DISPLAY_PRIMARY && mDisplays[i]->mDisplayId == display_id) {
+ if (mode == static_cast<int32_t>(ext_hwc2_power_mode_t::PAUSE) ||
+ mode == static_cast<int32_t>(ext_hwc2_power_mode_t::RESUME)) {
+ ret = mDisplays[i]->setPowerMode(mode);
+ if (mode == static_cast<int32_t>(ext_hwc2_power_mode_t::RESUME) &&
+ ret == HWC2_ERROR_NONE) {
+ onRefresh(display_id);
+ }
+ return ret;
+ } else {
+ return HWC2_ERROR_UNSUPPORTED;
}
- return ret;
- } else {
- return HWC2_ERROR_UNSUPPORTED;
}
- } else {
- return HWC2_ERROR_UNSUPPORTED;
}
+ return HWC2_ERROR_UNSUPPORTED;
}
int32_t ExynosDevice::setPanelGammaTableSource(int32_t display_id, int32_t type, int32_t source) {
diff --git a/libhwc2.1/libdevice/ExynosDevice.h b/libhwc2.1/libdevice/ExynosDevice.h
index 86127c7..7a5eee2 100644
--- a/libhwc2.1/libdevice/ExynosDevice.h
+++ b/libhwc2.1/libdevice/ExynosDevice.h
@@ -279,7 +279,9 @@ class ExynosDevice {
int32_t descriptor, hwc2_callback_data_t callbackData, hwc2_function_pointer_t point);
bool isCallbackAvailable(int32_t descriptor);
void onHotPlug(uint32_t displayId, bool status);
- void onRefresh();
+ void onRefresh(uint32_t displayId);
+ void onRefreshDisplays();
+
void onVsync(uint32_t displayId, int64_t timestamp);
bool onVsync_2_4(uint32_t displayId, int64_t timestamp, uint32_t vsyncPeriod);
void onVsyncPeriodTimingChanged(uint32_t displayId,
diff --git a/libhwc2.1/libdevice/ExynosDisplay.cpp b/libhwc2.1/libdevice/ExynosDisplay.cpp
index 354d75c..c63a14a 100644
--- a/libhwc2.1/libdevice/ExynosDisplay.cpp
+++ b/libhwc2.1/libdevice/ExynosDisplay.cpp
@@ -1593,7 +1593,7 @@ bool ExynosDisplay::skipStaticLayerChanged(ExynosCompositionInfo& compositionInf
}
void ExynosDisplay::requestLhbm(bool on) {
- mDevice->onRefresh();
+ mDevice->onRefresh(mDisplayId);
if (mBrightnessController) {
mBrightnessController->processLocalHbm(on);
}
@@ -3464,7 +3464,7 @@ int32_t ExynosDisplay::presentDisplay(int32_t* outRetireFence) {
ret = HWC2_ERROR_NOT_VALIDATED;
}
mRenderingState = RENDERING_STATE_PRESENTED;
- mDevice->onRefresh();
+ mDevice->onRefresh(mDisplayId);
return ret;
}
diff --git a/libhwc2.1/libdisplayinterface/ExynosDeviceDrmInterface.cpp b/libhwc2.1/libdisplayinterface/ExynosDeviceDrmInterface.cpp
index 0437bbb..febd76d 100644
--- a/libhwc2.1/libdisplayinterface/ExynosDeviceDrmInterface.cpp
+++ b/libhwc2.1/libdisplayinterface/ExynosDeviceDrmInterface.cpp
@@ -262,7 +262,7 @@ void ExynosDeviceDrmInterface::ExynosDrmEventHandler::handleTUIEvent() {
} else {
/* Received TUI Exit event */
if (mExynosDevice->isInTUI()) {
- mExynosDevice->onRefresh();
+ mExynosDevice->onRefreshDisplays();
mExynosDevice->exitFromTUI();
ALOGV("%s:: DRM device out TUI", __func__);
}
diff --git a/libhwc2.1/libexternaldisplay/ExynosExternalDisplay.cpp b/libhwc2.1/libexternaldisplay/ExynosExternalDisplay.cpp
index d932f68..36fde04 100644
--- a/libhwc2.1/libexternaldisplay/ExynosExternalDisplay.cpp
+++ b/libhwc2.1/libexternaldisplay/ExynosExternalDisplay.cpp
@@ -311,7 +311,7 @@ int32_t ExynosExternalDisplay::presentDisplay(
ret = HWC2_ERROR_NOT_VALIDATED;
}
mRenderingState = RENDERING_STATE_PRESENTED;
- mDevice->onRefresh();
+ mDevice->onRefresh(mDisplayId);
return ret;
}
@@ -350,7 +350,7 @@ int32_t ExynosExternalDisplay::presentDisplay(
*/
setGeometryChanged(GEOMETRY_DISPLAY_FORCE_VALIDATE);
- mDevice->onRefresh();
+ mDevice->onRefresh(mDisplayId);
return HWC2_ERROR_NONE;
}
@@ -546,7 +546,7 @@ void ExynosExternalDisplay::handleHotplugEvent()
closeExternalDisplay();
}
hotplug();
- mDevice->onRefresh();
+ mDevice->onRefresh(mDisplayId);
}
}
diff --git a/libhwc2.1/libhwcService/ExynosHWCService.cpp b/libhwc2.1/libhwcService/ExynosHWCService.cpp
index aac4916..82d3ec8 100644
--- a/libhwc2.1/libhwcService/ExynosHWCService.cpp
+++ b/libhwc2.1/libhwcService/ExynosHWCService.cpp
@@ -252,7 +252,7 @@ void ExynosHWCService::enableMPP(uint32_t physicalType, uint32_t physicalIndex,
__func__, physicalType, physicalIndex, logicalIndex, enable);
ExynosResourceManager::enableMPP(physicalType, physicalIndex, logicalIndex, enable);
mHWCCtx->device->setGeometryChanged(GEOMETRY_DEVICE_CONFIG_CHANGED);
- mHWCCtx->device->onRefresh();
+ mHWCCtx->device->onRefreshDisplays();
}
void ExynosHWCService::setScaleDownRatio(uint32_t physicalType,
@@ -262,7 +262,7 @@ void ExynosHWCService::setScaleDownRatio(uint32_t physicalType,
__func__, physicalType, physicalIndex, logicalIndex, scaleDownRatio);
ExynosResourceManager::setScaleDownRatio(physicalType, physicalIndex, logicalIndex, scaleDownRatio);
mHWCCtx->device->setGeometryChanged(GEOMETRY_DEVICE_CONFIG_CHANGED);
- mHWCCtx->device->onRefresh();
+ mHWCCtx->device->onRefreshDisplays();
}
void ExynosHWCService::setLbeCtrl(uint32_t display_id, uint32_t state, uint32_t lux) {
@@ -482,7 +482,7 @@ int32_t ExynosHWCService::setDisplayRCDLayerEnabled(uint32_t displayIndex, bool
auto ret = primaryDisplay->setDebugRCDLayerEnabled(enable);
mHWCCtx->device->setGeometryChanged(GEOMETRY_DEVICE_CONFIG_CHANGED);
- mHWCCtx->device->onRefresh();
+ mHWCCtx->device->onRefresh(getDisplayId(HWC_DISPLAY_PRIMARY, displayIndex));
return ret;
}
@@ -511,7 +511,7 @@ int32_t ExynosHWCService::setDisplayDbm(int32_t display_id, uint32_t on) {
ALOGD("ExynosHWCService::%s() display(%u) on=%d", __func__, display_id, on);
display->setDbmState(!!on);
- mHWCCtx->device->onRefresh();
+ mHWCCtx->device->onRefresh(display_id);
return NO_ERROR;
}
diff --git a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.cpp b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.cpp
index 594495b..6585b5d 100644
--- a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.cpp
+++ b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.cpp
@@ -120,7 +120,7 @@ ExynosPrimaryDisplay::ExynosPrimaryDisplay(uint32_t index, ExynosDevice *device)
if (mEarlyWakeupDispFd == nullptr)
ALOGE("open %s failed! %s", earlyWakeupNodeBase, strerror(errno));
mBrightnessController = std::make_unique<BrightnessController>(
- mIndex, [this]() { mDevice->onRefresh(); },
+ mIndex, [this]() { mDevice->onRefresh(mDisplayId); },
[this]() { updatePresentColorConversionInfo(); });
}
diff --git a/libhwc2.1/pixel-display.cpp b/libhwc2.1/pixel-display.cpp
index c95c239..32bc806 100644
--- a/libhwc2.1/pixel-display.cpp
+++ b/libhwc2.1/pixel-display.cpp
@@ -186,7 +186,7 @@ bool Display::runMediator(const RoiRect roi, const Weight weight, const Histogra
ALOGE("histogram error, ENABLE_HIST ERROR\n");
}
if (mMediator.getFrameCount() != mMediator.getSampleFrameCounter()) {
- mDisplay->mDevice->onRefresh(); // DRM not busy & sampled frame changed
+ mDisplay->mDevice->onRefresh(mDisplay->mDisplayId); // DRM not busy & sampled frame changed
}
if (mMediator.collectRoiLuma(histogrambuffer) != HistogramErrorCode::NONE) {
ALOGE("histogram error, COLLECT_ROI_LUMA ERROR\n");