diff options
| author | vaxerski <vaxry@vaxry.net> | 2025-01-08 12:29:24 +0100 |
|---|---|---|
| committer | vaxerski <vaxry@vaxry.net> | 2025-01-08 12:29:24 +0100 |
| commit | b320bc2dc6e308360936ce4396010359b74558bf (patch) | |
| tree | 16f92da31804b4c6e313fec173b47f82dc472971 /src/managers/PointerManager.cpp | |
| parent | ad64726f5df0fa3cabcd6af9f872d5e8e1f65dbc (diff) | |
core: use cpu-buffer hw cursors on nvidia by default
Diffstat (limited to 'src/managers/PointerManager.cpp')
| -rw-r--r-- | src/managers/PointerManager.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/managers/PointerManager.cpp b/src/managers/PointerManager.cpp index bc166825..85e1c601 100644 --- a/src/managers/PointerManager.cpp +++ b/src/managers/PointerManager.cpp @@ -376,7 +376,9 @@ SP<Aquamarine::IBuffer> CPointerManager::renderHWCursorBuffer(SP<CPointerManager auto maxSize = state->monitor->output->cursorPlaneSize(); auto const& cursorSize = currentCursorImage.size; - static auto PDUMB = CConfigValue<Hyprlang::INT>("cursor:use_cpu_buffer"); + static auto PCPUBUFFER = CConfigValue<Hyprlang::INT>("cursor:use_cpu_buffer"); + + const bool shouldUseCpuBuffer = *PCPUBUFFER == 1 || (*PCPUBUFFER != 0 && g_pHyprRenderer->isNvidia()); if (maxSize == Vector2D{}) return nullptr; @@ -390,12 +392,12 @@ SP<Aquamarine::IBuffer> CPointerManager::renderHWCursorBuffer(SP<CPointerManager maxSize = cursorSize; if (!state->monitor->cursorSwapchain || maxSize != state->monitor->cursorSwapchain->currentOptions().size || - *PDUMB != (state->monitor->cursorSwapchain->getAllocator()->type() != Aquamarine::AQ_ALLOCATOR_TYPE_GBM)) { + shouldUseCpuBuffer != (state->monitor->cursorSwapchain->getAllocator()->type() != Aquamarine::AQ_ALLOCATOR_TYPE_GBM)) { - if (!state->monitor->cursorSwapchain || *PDUMB != (state->monitor->cursorSwapchain->getAllocator()->type() != Aquamarine::AQ_ALLOCATOR_TYPE_GBM)) { + if (!state->monitor->cursorSwapchain || shouldUseCpuBuffer != (state->monitor->cursorSwapchain->getAllocator()->type() != Aquamarine::AQ_ALLOCATOR_TYPE_GBM)) { auto allocator = state->monitor->output->getBackend()->preferredAllocator(); - if (*PDUMB) { + if (shouldUseCpuBuffer) { for (const auto& a : state->monitor->output->getBackend()->getAllocators()) { if (a->type() == Aquamarine::AQ_ALLOCATOR_TYPE_DRM_DUMB) { allocator = a; @@ -415,7 +417,7 @@ SP<Aquamarine::IBuffer> CPointerManager::renderHWCursorBuffer(SP<CPointerManager options.multigpu = state->monitor->output->getBackend()->preferredAllocator()->drmFD() != g_pCompositor->m_iDRMFD; // We do not set the format (unless shm). 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 (*PDUMB) + if (shouldUseCpuBuffer) options.format = DRM_FORMAT_ARGB8888; if (!state->monitor->cursorSwapchain->reconfigure(options)) { @@ -438,7 +440,7 @@ SP<Aquamarine::IBuffer> CPointerManager::renderHWCursorBuffer(SP<CPointerManager return nullptr; } - if (*PDUMB) { + if (shouldUseCpuBuffer) { // get the texture data if available. auto texData = texture->dataCopy(); if (texData.empty()) { |
