Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/hwcomposer/hwcomposer_backend.cpp
Show First 20 Lines • Show All 217 Lines • ▼ Show 20 Line(s) | 217 | if (hwc_open_1(hwcModule, &hwcDevice) != 0) { | |||
---|---|---|---|---|---|
218 | qCWarning(KWIN_HWCOMPOSER) << "Failed to open hwcomposer device"; | 218 | qCWarning(KWIN_HWCOMPOSER) << "Failed to open hwcomposer device"; | ||
219 | emit initFailed(); | 219 | emit initFailed(); | ||
220 | return; | 220 | return; | ||
221 | } | 221 | } | ||
222 | 222 | | |||
223 | // unblank, setPowerMode? | 223 | // unblank, setPowerMode? | ||
224 | m_device = hwcDevice; | 224 | m_device = hwcDevice; | ||
225 | 225 | | |||
226 | m_hwcVersion = m_device->common.version; | ||||
227 | if ((m_hwcVersion & 0xffff0000) == 0) { | ||||
228 | // Assume header version is always 1 | ||||
229 | uint32_t header_version = 1; | ||||
230 | // Legacy version encoding | ||||
231 | m_hwcVersion = (m_hwcVersion << 16) | header_version; | ||||
232 | } | ||||
233 | | ||||
226 | // register callbacks | 234 | // register callbacks | ||
227 | hwc_procs_t *procs = new hwc_procs_t; | 235 | hwc_procs_t *procs = new hwc_procs_t; | ||
228 | procs->invalidate = [] (const struct hwc_procs* procs) { | 236 | procs->invalidate = [] (const struct hwc_procs* procs) { | ||
229 | Q_UNUSED(procs) | 237 | Q_UNUSED(procs) | ||
230 | }; | 238 | }; | ||
231 | procs->vsync = [] (const struct hwc_procs* procs, int disp, int64_t timestamp) { | 239 | procs->vsync = [] (const struct hwc_procs* procs, int disp, int64_t timestamp) { | ||
232 | Q_UNUSED(procs) | 240 | Q_UNUSED(procs) | ||
233 | if (disp != 0) { | 241 | if (disp != 0) { | ||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Line(s) | |||||
304 | 312 | | |||
305 | void HwcomposerBackend::toggleBlankOutput() | 313 | void HwcomposerBackend::toggleBlankOutput() | ||
306 | { | 314 | { | ||
307 | if (!m_device) { | 315 | if (!m_device) { | ||
308 | return; | 316 | return; | ||
309 | } | 317 | } | ||
310 | m_outputBlank = !m_outputBlank; | 318 | m_outputBlank = !m_outputBlank; | ||
311 | toggleScreenBrightness(); | 319 | toggleScreenBrightness(); | ||
320 | | ||||
321 | #if defined(HWC_DEVICE_API_VERSION_1_4) || defined(HWC_DEVICE_API_VERSION_1_5) | ||||
graesslin: hmm that doesn' t look really forward compatible. Can we have something like
#if VERSION >… | |||||
bshah: I didn't get you on how it is not forward compatible? | |||||
Oh actually nevermind. I got wrong line in email so was confused.. so idea here is you'll need to check 1.4 and 1.5 as there is also 2.0 and it is not compatible with this code bshah: Oh actually nevermind. I got wrong line in email so was confused.. so idea here is you'll need… | |||||
322 | if (m_hwcVersion > HWC_DEVICE_API_VERSION_1_3) | ||||
323 | m_device->setPowerMode(m_device, 0, m_outputBlank ? 0 : 2); | ||||
324 | else | ||||
325 | #endif | ||||
312 | m_device->blank(m_device, 0, m_outputBlank ? 1 : 0); | 326 | m_device->blank(m_device, 0, m_outputBlank ? 1 : 0); | ||
313 | // only disable Vsycn, enable happens after next frame rendered | 327 | | ||
328 | // only disable Vsync, enable happens after next frame rendered | ||||
314 | if (m_outputBlank) { | 329 | if (m_outputBlank) { | ||
315 | enableVSync(false); | 330 | enableVSync(false); | ||
316 | } | 331 | } | ||
317 | // enable/disable compositor repainting when blanked | 332 | // enable/disable compositor repainting when blanked | ||
318 | setOutputsEnabled(!m_outputBlank); | 333 | setOutputsEnabled(!m_outputBlank); | ||
319 | if (Compositor *compositor = Compositor::self()) { | 334 | if (Compositor *compositor = Compositor::self()) { | ||
320 | if (!m_outputBlank) { | 335 | if (!m_outputBlank) { | ||
321 | compositor->addRepaintFull(); | 336 | compositor->addRepaintFull(); | ||
▲ Show 20 Lines • Show All 140 Lines • Show Last 20 Lines |
hmm that doesn' t look really forward compatible. Can we have something like
?