From 1cbb7b80c5ef584fb351d3642803164403ce4f15 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Wed, 26 Jun 2024 19:26:55 +0200 Subject: [PATCH] fix hw cursors with new aq stuff --- src/managers/PointerManager.cpp | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/managers/PointerManager.cpp b/src/managers/PointerManager.cpp index 0b52d132..477aba97 100644 --- a/src/managers/PointerManager.cpp +++ b/src/managers/PointerManager.cpp @@ -375,25 +375,21 @@ bool CPointerManager::setHWCursorBuffer(SP state, SP CPointerManager::renderHWCursorBuffer(SP state, SP texture) { auto output = state->monitor->output; - auto maxSize = output->maxCursorSize(); - + auto maxSize = output->cursorPlaneSize(); auto cursorSize = currentCursorImage.size; - if (cursorSize == Vector2D{}) - return nullptr; - - // error if (maxSize == Vector2D{}) return nullptr; if (maxSize != Vector2D{-1, -1}) { - if (cursorSize.x < maxSize.x || cursorSize.y < maxSize.y) { + if (cursorSize.x > maxSize.x || cursorSize.y > maxSize.y) { Debug::log(TRACE, "hardware cursor too big! {} > {}", currentCursorImage.size, maxSize); return nullptr; } - } + } else + maxSize = cursorSize; - if (!state->monitor->cursorSwapchain || cursorSize != state->monitor->cursorSwapchain->currentOptions().size) { + if (!state->monitor->cursorSwapchain || maxSize != state->monitor->cursorSwapchain->currentOptions().size) { auto format = pickCursorFormat(output); if (format.drmFormat == DRM_FORMAT_INVALID) { @@ -402,12 +398,14 @@ SP CPointerManager::renderHWCursorBuffer(SPmonitor->cursorSwapchain) - state->monitor->cursorSwapchain = makeShared(g_pCompositor->m_pAqBackend->allocator); + state->monitor->cursorSwapchain = Aquamarine::CSwapchain::create(g_pCompositor->m_pAqBackend->allocator, state->monitor->output->getBackend()); - auto options = state->monitor->cursorSwapchain->currentOptions(); - options.size = cursorSize; - options.length = 2; - options.format = format.drmFormat; + auto options = state->monitor->cursorSwapchain->currentOptions(); + options.size = maxSize; + options.length = 2; + options.format = format.drmFormat; + options.scanout = true; + options.cursor = true; if (!state->monitor->cursorSwapchain->reconfigure(options)) { Debug::log(TRACE, "Failed to reconfigure cursor swapchain");