From 57e9005abbef8af161ad5a6448e84695eb2259db Mon Sep 17 00:00:00 2001 From: Vaxry Date: Wed, 26 Jun 2024 19:42:50 +0200 Subject: [PATCH] use auto format for cursor --- src/managers/PointerManager.cpp | 31 ++----------------------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/src/managers/PointerManager.cpp b/src/managers/PointerManager.cpp index 477aba97..82255703 100644 --- a/src/managers/PointerManager.cpp +++ b/src/managers/PointerManager.cpp @@ -10,28 +10,6 @@ #include #include -static Aquamarine::SDRMFormat pickCursorFormat(SP output) { - - const auto fmts = output->getBackend()->getCursorFormats(); - - if (fmts.empty()) - return {}; - - // try to use common formats in their order - std::vector PREFERRED_FORMATS = {DRM_FORMAT_ARGB8888, DRM_FORMAT_XRGB8888}; - - for (auto& pf : PREFERRED_FORMATS) { - for (auto& fmt : fmts) { - if (pf != fmt.drmFormat) - continue; - - return fmt; - } - } - - return fmts.at(0); -} - CPointerManager::CPointerManager() { hooks.monitorAdded = g_pHookSystem->hookDynamic("newMonitor", [this](void* self, SCallbackInfo& info, std::any data) { auto PMONITOR = std::any_cast>(data); @@ -390,12 +368,6 @@ SP CPointerManager::renderHWCursorBuffer(SPmonitor->cursorSwapchain || maxSize != state->monitor->cursorSwapchain->currentOptions().size) { - auto format = pickCursorFormat(output); - - if (format.drmFormat == DRM_FORMAT_INVALID) { - Debug::log(TRACE, "Failed to pick an output format for hw cursor"); - return nullptr; - } if (!state->monitor->cursorSwapchain) state->monitor->cursorSwapchain = Aquamarine::CSwapchain::create(g_pCompositor->m_pAqBackend->allocator, state->monitor->output->getBackend()); @@ -403,9 +375,10 @@ SP CPointerManager::renderHWCursorBuffer(SPmonitor->cursorSwapchain->currentOptions(); options.size = maxSize; options.length = 2; - options.format = format.drmFormat; options.scanout = true; options.cursor = true; + // We do not set the format. If it's unset (DRM_FORMAT_INVALID) then the swapchain will pick for us, + // but if it's set, we don't wanna change it. if (!state->monitor->cursorSwapchain->reconfigure(options)) { Debug::log(TRACE, "Failed to reconfigure cursor swapchain");