From 54565a94bd81f50f7f8ed1ccd3e351139943e732 Mon Sep 17 00:00:00 2001 From: Bhushan Shah Date: Wed, 1 Nov 2017 12:18:56 +0530 Subject: [PATCH] [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 --- .../platforms/hwcomposer/hwcomposer_backend.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/plugins/platforms/hwcomposer/hwcomposer_backend.cpp b/plugins/platforms/hwcomposer/hwcomposer_backend.cpp index d871568d88..797b7b2465 100644 --- a/plugins/platforms/hwcomposer/hwcomposer_backend.cpp +++ b/plugins/platforms/hwcomposer/hwcomposer_backend.cpp @@ -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;