Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/hwcomposer/hwcomposer_backend.cpp
Show First 20 Lines • Show All 386 Lines • ▼ Show 20 Line(s) | |||||
387 | 387 | | |||
388 | void HwcomposerBackend::wakeVSync() | 388 | void HwcomposerBackend::wakeVSync() | ||
389 | { | 389 | { | ||
390 | m_vsyncMutex.lock(); | 390 | m_vsyncMutex.lock(); | ||
391 | m_vsyncWaitCondition.wakeAll(); | 391 | m_vsyncWaitCondition.wakeAll(); | ||
392 | m_vsyncMutex.unlock(); | 392 | m_vsyncMutex.unlock(); | ||
393 | } | 393 | } | ||
394 | 394 | | |||
395 | bool HwcomposerBackend::canLoad() | ||||
396 | { | ||||
397 | // try to open hwc module & device, like in init() | ||||
398 | hw_module_t *hwcModule = nullptr; | ||||
399 | if (hw_get_module(HWC_HARDWARE_MODULE_ID, (const hw_module_t **)&hwcModule) != 0) { | ||||
400 | qCWarning(KWIN_HWCOMPOSER) << "Failed to get hwcomposer module"; | ||||
401 | return false; | ||||
402 | } | ||||
403 | | ||||
404 | hwc_composer_device_1_t *hwcDevice = nullptr; | ||||
405 | if (hwc_open_1(hwcModule, &hwcDevice) != 0) { | ||||
406 | qCWarning(KWIN_HWCOMPOSER) << "Failed to open hwcomposer device"; | ||||
407 | return false; | ||||
408 | } | ||||
409 | | ||||
410 | // close device method in nougat branch: | ||||
411 | // https://github.com/ubports/android-headers/blob/xenial/24-caf/hardware/hwcomposer.h#L794 | ||||
412 | hwc_close_1(hwcDevice); | ||||
413 | return true; | ||||
414 | } | ||||
415 | | ||||
395 | static void initLayer(hwc_layer_1_t *layer, const hwc_rect_t &rect, int layerCompositionType) | 416 | static void initLayer(hwc_layer_1_t *layer, const hwc_rect_t &rect, int layerCompositionType) | ||
396 | { | 417 | { | ||
397 | memset(layer, 0, sizeof(hwc_layer_1_t)); | 418 | memset(layer, 0, sizeof(hwc_layer_1_t)); | ||
398 | layer->compositionType = layerCompositionType; | 419 | layer->compositionType = layerCompositionType; | ||
399 | layer->hints = 0; | 420 | layer->hints = 0; | ||
400 | layer->flags = 0; | 421 | layer->flags = 0; | ||
401 | layer->handle = 0; | 422 | layer->handle = 0; | ||
402 | layer->transform = 0; | 423 | layer->transform = 0; | ||
▲ Show 20 Lines • Show All 147 Lines • Show Last 20 Lines |