From dc399a37d339e958494da270473cbc1d829f7307 Mon Sep 17 00:00:00 2001 From: dawsers <47487972+dawsers@users.noreply.github.com> Date: Tue, 17 Sep 2024 15:29:08 +0200 Subject: [PATCH] gbm: fix modifier list not updating when renderable list is empty (#84) --- src/allocator/GBM.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/allocator/GBM.cpp b/src/allocator/GBM.cpp index b61b4a1..37dc3e0 100644 --- a/src/allocator/GBM.cpp +++ b/src/allocator/GBM.cpp @@ -105,17 +105,16 @@ Aquamarine::CGBMBuffer::CGBMBuffer(const SAllocatorBufferParams& params, Hypruti // check if we can use modifiers. If the requested support has any explicit modifier // supported by the primary backend, we can. - if (!RENDERABLE.empty()) { - TRACE(allocator->backend->log(AQ_LOG_TRACE, std::format("GBM: Renderable has {} formats, clipping", RENDERABLE.size()))); + for (auto const& f : FORMATS) { + if (f.drmFormat != attrs.format) + continue; - for (auto const& f : FORMATS) { - if (f.drmFormat != attrs.format) + for (auto const& m : f.modifiers) { + if (m == DRM_FORMAT_MOD_INVALID) continue; - for (auto const& m : f.modifiers) { - if (m == DRM_FORMAT_MOD_INVALID) - continue; - + if (!RENDERABLE.empty()) { + TRACE(allocator->backend->log(AQ_LOG_TRACE, std::format("GBM: Renderable has {} formats, clipping", RENDERABLE.size()))); if (params.scanout && !CURSOR && !MULTIGPU) { // regular scanout plane, check if the format is renderable auto rformat = std::find_if(RENDERABLE.begin(), RENDERABLE.end(), [f](const auto& e) { return e.drmFormat == f.drmFormat; }); @@ -130,9 +129,8 @@ Aquamarine::CGBMBuffer::CGBMBuffer(const SAllocatorBufferParams& params, Hypruti continue; } } - - explicitModifiers.push_back(m); } + explicitModifiers.push_back(m); } }