From 86e36b5b5fc9f161f033671b7452cda69727fe91 Mon Sep 17 00:00:00 2001 From: Lee Bousfield Date: Mon, 24 Feb 2025 14:53:49 -0600 Subject: [PATCH] allocator: Don't force linear for multigpu if unsupported --- src/allocator/GBM.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/allocator/GBM.cpp b/src/allocator/GBM.cpp index d5f69db..f4ed015 100644 --- a/src/allocator/GBM.cpp +++ b/src/allocator/GBM.cpp @@ -140,10 +140,16 @@ Aquamarine::CGBMBuffer::CGBMBuffer(const SAllocatorBufferParams& params, Hypruti return; } - // FIXME: Nvidia cannot render to linear buffers. What do? if (MULTIGPU) { - allocator->backend->log(AQ_LOG_DEBUG, "GBM: Buffer is marked as multigpu, forcing linear"); - explicitModifiers = {DRM_FORMAT_MOD_LINEAR}; + // Try to use the linear format if available for cross-GPU compatibility. + // However, Nvidia doesn't support linear, so this is a best-effort basis. + for (auto const& f : FORMATS) { + if (f.drmFormat == DRM_FORMAT_MOD_LINEAR) { + allocator->backend->log(AQ_LOG_DEBUG, "GBM: Buffer is marked as multigpu, using linear format"); + explicitModifiers = {DRM_FORMAT_MOD_LINEAR}; + break; + } + } } uint32_t flags = GBM_BO_USE_RENDERING;