diff --git a/src/allocator/GBM.cpp b/src/allocator/GBM.cpp index 37dc3e0..02defff 100644 --- a/src/allocator/GBM.cpp +++ b/src/allocator/GBM.cpp @@ -103,12 +103,14 @@ Aquamarine::CGBMBuffer::CGBMBuffer(const SAllocatorBufferParams& params, Hypruti return; } + bool foundFormat = false; // check if we can use modifiers. If the requested support has any explicit modifier // supported by the primary backend, we can. for (auto const& f : FORMATS) { if (f.drmFormat != attrs.format) continue; + foundFormat = true; for (auto const& m : f.modifiers) { if (m == DRM_FORMAT_MOD_INVALID) continue; @@ -134,17 +136,17 @@ Aquamarine::CGBMBuffer::CGBMBuffer(const SAllocatorBufferParams& params, Hypruti } } + if (!foundFormat) { + allocator->backend->log(AQ_LOG_ERROR, std::format("GBM: Failed to allocate a GBM buffer: format {} isn't supported by primary backend", fourccToName(attrs.format))); + 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}; } - if (explicitModifiers.empty()) { - // fall back to using a linear buffer. - explicitModifiers.push_back(DRM_FORMAT_MOD_LINEAR); - } - uint32_t flags = GBM_BO_USE_RENDERING; if (params.scanout) flags |= GBM_BO_USE_SCANOUT; diff --git a/src/backend/drm/DRM.cpp b/src/backend/drm/DRM.cpp index 38d1df8..f39d382 100644 --- a/src/backend/drm/DRM.cpp +++ b/src/backend/drm/DRM.cpp @@ -527,7 +527,7 @@ void Aquamarine::CDRMBackend::buildGlFormats(const std::vector& fmts) std::vector result; for (auto const& fmt : fmts) { - if (fmt.external) + if (fmt.external && fmt.modifier != DRM_FORMAT_MOD_INVALID) continue; if (auto it = std::find_if(result.begin(), result.end(), [fmt](const auto& e) { return fmt.drmFormat == e.drmFormat; }); it != result.end()) { diff --git a/src/backend/drm/Renderer.cpp b/src/backend/drm/Renderer.cpp index 896f593..a1683d8 100644 --- a/src/backend/drm/Renderer.cpp +++ b/src/backend/drm/Renderer.cpp @@ -809,11 +809,6 @@ bool CDRMRenderer::verifyDestinationDMABUF(const SDMABUFAttrs& attrs) { if (fmt.modifier != attrs.modifier) continue; - if (fmt.external) { - backend->log(AQ_LOG_ERROR, "EGL (verifyDestinationDMABUF): FAIL, format is external-only"); - return false; - } - return true; }