[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/D3686icc-effect-5.14.5
parent
eae9bdd50a
commit
f906e21f3d
|
@ -223,6 +223,14 @@ void HwcomposerBackend::init()
|
||||||
// unblank, setPowerMode?
|
// unblank, setPowerMode?
|
||||||
m_device = hwcDevice;
|
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
|
// register callbacks
|
||||||
hwc_procs_t *procs = new hwc_procs_t;
|
hwc_procs_t *procs = new hwc_procs_t;
|
||||||
procs->invalidate = [] (const struct hwc_procs* procs) {
|
procs->invalidate = [] (const struct hwc_procs* procs) {
|
||||||
|
@ -309,8 +317,15 @@ void HwcomposerBackend::toggleBlankOutput()
|
||||||
}
|
}
|
||||||
m_outputBlank = !m_outputBlank;
|
m_outputBlank = !m_outputBlank;
|
||||||
toggleScreenBrightness();
|
toggleScreenBrightness();
|
||||||
|
|
||||||
|
#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);
|
m_device->blank(m_device, 0, m_outputBlank ? 1 : 0);
|
||||||
// only disable Vsycn, enable happens after next frame rendered
|
|
||||||
|
// only disable Vsync, enable happens after next frame rendered
|
||||||
if (m_outputBlank) {
|
if (m_outputBlank) {
|
||||||
enableVSync(false);
|
enableVSync(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,6 +99,7 @@ private:
|
||||||
bool m_outputBlank = true;
|
bool m_outputBlank = true;
|
||||||
int m_refreshRate = 60000;
|
int m_refreshRate = 60000;
|
||||||
int m_vsyncInterval = 16;
|
int m_vsyncInterval = 16;
|
||||||
|
uint32_t m_hwcVersion;
|
||||||
int m_oldScreenBrightness = 0x7f;
|
int m_oldScreenBrightness = 0x7f;
|
||||||
bool m_hasVsync = false;
|
bool m_hasVsync = false;
|
||||||
QMutex m_vsyncMutex;
|
QMutex m_vsyncMutex;
|
||||||
|
|
Loading…
Reference in New Issue