[platforms/hwcomposer] Support for hwcomposer 1.4 and 1.5 version
Summary: HWcomposer version 1.4 introduced setPowerMode, which replaces the blank(). This adds support for it. There are various code paths possible, - If KWin is built against hwcomposer 1.3 headers, then setPowerMode code is not compiled in, and it will use blank to turn display off. - If KWin is built against hwcomposer 1.4 headers, it will have setPowerMode code path compiled in. It will be used only on devices with 1.4 and 1.5 version of hwcomposer. This is slightly insane, because Android can report hwcomposer 1.5 even when headers are of 1.4 version.. Test Plan: Tested this on Nexus 5X which reports 1.5 version of hwcomposer Reviewers: graesslin, #plasma Reviewed By: graesslin, #plasma Subscribers: plasma-devel, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D3686
This commit is contained in:
parent
eae9bdd50a
commit
f906e21f3d
2 changed files with 18 additions and 2 deletions
|
@ -223,6 +223,14 @@ void HwcomposerBackend::init()
|
|||
// unblank, setPowerMode?
|
||||
m_device = hwcDevice;
|
||||
|
||||
m_hwcVersion = m_device->common.version;
|
||||
if ((m_hwcVersion & 0xffff0000) == 0) {
|
||||
// Assume header version is always 1
|
||||
uint32_t header_version = 1;
|
||||
// Legacy version encoding
|
||||
m_hwcVersion = (m_hwcVersion << 16) | header_version;
|
||||
}
|
||||
|
||||
// register callbacks
|
||||
hwc_procs_t *procs = new hwc_procs_t;
|
||||
procs->invalidate = [] (const struct hwc_procs* procs) {
|
||||
|
@ -309,8 +317,15 @@ void HwcomposerBackend::toggleBlankOutput()
|
|||
}
|
||||
m_outputBlank = !m_outputBlank;
|
||||
toggleScreenBrightness();
|
||||
m_device->blank(m_device, 0, m_outputBlank ? 1 : 0);
|
||||
// only disable Vsycn, enable happens after next frame rendered
|
||||
|
||||
#if defined(HWC_DEVICE_API_VERSION_1_4) || defined(HWC_DEVICE_API_VERSION_1_5)
|
||||
if (m_hwcVersion > HWC_DEVICE_API_VERSION_1_3)
|
||||
m_device->setPowerMode(m_device, 0, m_outputBlank ? 0 : 2);
|
||||
else
|
||||
#endif
|
||||
m_device->blank(m_device, 0, m_outputBlank ? 1 : 0);
|
||||
|
||||
// only disable Vsync, enable happens after next frame rendered
|
||||
if (m_outputBlank) {
|
||||
enableVSync(false);
|
||||
}
|
||||
|
|
|
@ -99,6 +99,7 @@ private:
|
|||
bool m_outputBlank = true;
|
||||
int m_refreshRate = 60000;
|
||||
int m_vsyncInterval = 16;
|
||||
uint32_t m_hwcVersion;
|
||||
int m_oldScreenBrightness = 0x7f;
|
||||
bool m_hasVsync = false;
|
||||
QMutex m_vsyncMutex;
|
||||
|
|
Loading…
Reference in a new issue