[platforms/hwcomposer] Few fixes for hwcomposer platforms

Summary:
- Actually use double layered compositing, previously both layers were
of type HWC_FRAMEBUFFER, instead of 2nd layer being
HWC_FRAMEBUFFER_TARGET. Thanks to @NotKit on telegram for pointing this
out.

- Use sourceCropf instead of sourceCrop, as sourceCrop is legacy option.

Test Plan: have to test on actual device, but test_hwcomposer does have similar code.

Reviewers: #plasma, graesslin

Reviewed By: #plasma, graesslin

Subscribers: plasma-devel, kwin, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8587
This commit is contained in:
Bhushan Shah 2017-11-01 12:18:56 +05:30
parent 7739dea33c
commit 54565a94bd

View file

@ -394,16 +394,23 @@ void HwcomposerBackend::wakeVSync()
m_vsyncMutex.unlock();
}
static void initLayer(hwc_layer_1_t *layer, const hwc_rect_t &rect)
static void initLayer(hwc_layer_1_t *layer, const hwc_rect_t &rect, int layerCompositionType)
{
memset(layer, 0, sizeof(hwc_layer_1_t));
layer->compositionType = HWC_FRAMEBUFFER;
layer->compositionType = layerCompositionType;
layer->hints = 0;
layer->flags = 0;
layer->handle = 0;
layer->transform = 0;
layer->blending = HWC_BLENDING_NONE;
#ifdef HWC_DEVICE_API_VERSION_1_3
layer->sourceCropf.top = 0.0f;
layer->sourceCropf.left = 0.0f;
layer->sourceCropf.bottom = (float) rect.bottom;
layer->sourceCropf.right = (float) rect.right;
#else
layer->sourceCrop = rect;
#endif
layer->displayFrame = rect;
layer->visibleRegionScreen.numRects = 1;
layer->visibleRegionScreen.rects = &layer->displayFrame;
@ -434,8 +441,8 @@ HwcomposerWindow::HwcomposerWindow(HwcomposerBackend *backend)
m_backend->size().width(),
m_backend->size().height()
};
initLayer(&list->hwLayers[0], rect);
initLayer(&list->hwLayers[1], rect);
initLayer(&list->hwLayers[0], rect, HWC_FRAMEBUFFER);
initLayer(&list->hwLayers[1], rect, HWC_FRAMEBUFFER_TARGET);
list->retireFenceFd = -1;
list->flags = HWC_GEOMETRY_CHANGED;