From 285b0b756c3525c312a680055abc4bab274b4160 Mon Sep 17 00:00:00 2001 From: Joshua Warren <816217+joshuaswarren@users.noreply.github.com> Date: Fri, 13 Nov 2026 22:03:17 -0600 Subject: [PATCH 1/6] Carry the alpha-variant scanout fallback for aquamarine 0.16.0 Some scanout planes offer only ARGB8888 and ABGR8888 for 8 bpc. The M5 Max internal panel is one. Compositors that ask for XRGB8888 fail at startup with "format XR24 isn't supported by primary backend", which takes out the greeter and every user session. Add 0005, carried from hyprwm/aquamarine#496: allocate the alpha variant when the scanout plane lacks the opaque one, and teach the three commit-time format checks to accept the alpha variant so no extra modeset is forced. Verified on hardware: greeter and user sessions start, the alpha byte reads 0xFF across 375732 framebuffer samples, and a translucent overlay blends correctly. Bump pkgrel to 1.2. --- ...iant-when-the-scanout-plane-lacks-it.patch | 97 +++++++++++++++++++ pkgbuilds/aquamarine/PKGBUILD | 17 +++- 2 files changed, 109 insertions(+), 5 deletions(-) create mode 100644 pkgbuilds/aquamarine/0005-drm-use-the-alpha-variant-when-the-scanout-plane-lacks-it.patch diff --git a/pkgbuilds/aquamarine/0005-drm-use-the-alpha-variant-when-the-scanout-plane-lacks-it.patch b/pkgbuilds/aquamarine/0005-drm-use-the-alpha-variant-when-the-scanout-plane-lacks-it.patch new file mode 100644 index 0000000000..da55ea2904 --- /dev/null +++ b/pkgbuilds/aquamarine/0005-drm-use-the-alpha-variant-when-the-scanout-plane-lacks-it.patch @@ -0,0 +1,97 @@ +From 2f9532da46ddc5166e5761585981b89ce3015e2b Mon Sep 17 00:00:00 2001 +From: Joshua Warren <816217+joshuaswarren@users.noreply.github.com> +Date: Fri, 13 Nov 2026 21:30:53 -0600 +Subject: [PATCH] drm: use the alpha variant when the scanout plane lacks the X + variant + +Some scanout planes (Apple M5 internal panel) offer only ARGB8888 and +ABGR8888 for 8 bpc, not XRGB8888 or XBGR8888. A compositor that asks +for XRGB8888 gets "format XR24 isn't supported by primary backend". + +Allocate the alpha variant in that case, and let the three commit-time +format checks (setFormat validation, mismatch detection, async commit) +treat it as equal to the requested opaque format, so no modeset is +forced. +--- + src/allocator/GBM.cpp | 11 +++++++++++ + src/backend/drm/DRM.cpp | 6 +++--- + src/include/FormatUtils.hpp | 10 ++++++++++ + 3 files changed, 24 insertions(+), 3 deletions(-) + +diff --git a/src/allocator/GBM.cpp b/src/allocator/GBM.cpp +index 6f596b7..a6d0344 100644 +--- a/src/allocator/GBM.cpp ++++ b/src/allocator/GBM.cpp +@@ -101,6 +101,17 @@ Aquamarine::CGBMBuffer::CGBMBuffer(const SAllocatorBufferParams& params, Hypruti + return; + } + ++ // Scanout planes that offer only the alpha variant of an 8 bpc format (Apple M5 internal panel): ++ // allocate the A variant when the X variant is requested but not offered. ++ if (params.scanout && !CURSOR) { ++ const auto hasFmt = [&FORMATS](uint32_t fmt) { return std::ranges::any_of(FORMATS, [fmt](const auto& f) { return f.drmFormat == fmt; }); }; ++ const uint32_t alt = opaqueToAlphaFormat(attrs.format); ++ if (alt != DRM_FORMAT_INVALID && !hasFmt(attrs.format) && hasFmt(alt)) { ++ allocator->backend->log(AQ_LOG_DEBUG, std::format("GBM: {} not offered by the scanout plane, using {}", fourccToName(attrs.format), fourccToName(alt))); ++ attrs.format = alt; ++ } ++ } ++ + bool foundFormat = false; + // check if we can use modifiers. If the requested support has any explicit modifier + // supported by the primary backend, we can. +diff --git a/src/backend/drm/DRM.cpp b/src/backend/drm/DRM.cpp +index 688ed97..1609098 100644 +--- a/src/backend/drm/DRM.cpp ++++ b/src/backend/drm/DRM.cpp +@@ -2548,7 +2548,7 @@ bool Aquamarine::CDRMOutput::commitState(bool onlyTest) { + // verify the format is valid for the primary plane + bool ok = false; + for (auto const& f : getRenderFormats()) { +- if (f.drmFormat == STATE.drmFormat) { ++ if (f.drmFormat == STATE.drmFormat || f.drmFormat == opaqueToAlphaFormat(STATE.drmFormat)) { + ok = true; + break; + } +@@ -2768,7 +2768,7 @@ bool Aquamarine::CDRMOutput::commitState(bool onlyTest) { + // sometimes, our consumer could f up the swapchain format and change it without the state changing + bool formatMismatch = false; + if (data.mainFB) { +- if (const auto params = data.mainFB->buffer->dmabuf(); params.success && params.format != STATE.drmFormat) { ++ if (const auto params = data.mainFB->buffer->dmabuf(); params.success && params.format != STATE.drmFormat && params.format != opaqueToAlphaFormat(STATE.drmFormat)) { + // formats mismatch. Update the state format and roll with it + backend->backend->log(AQ_LOG_WARNING, + std::format("drm: Formats mismatch in commit, buffer is {} but output is set to {}. Modesetting to {}", fourccToName(params.format), +@@ -3168,7 +3168,7 @@ Aquamarine::IOutput::SCommitSubmission Aquamarine::CDRMOutput::commitAsync(const + + const auto MAIN_BUFFER = data.mainFB ? data.mainFB->buffer.lock() : nullptr; + const auto ATTRS = MAIN_BUFFER ? MAIN_BUFFER->dmabuf() : SDMABUFAttrs{}; +- if (ATTRS.success && ATTRS.format != STATE.drmFormat) ++ if (ATTRS.success && ATTRS.format != STATE.drmFormat && ATTRS.format != opaqueToAlphaFormat(STATE.drmFormat)) + return {.error = ENOTSUP}; + + if (options.lateCursor && cursorVisible && connector->crtc->cursor) +diff --git a/src/include/FormatUtils.hpp b/src/include/FormatUtils.hpp +index 75c8733..ea2ab0a 100644 +--- a/src/include/FormatUtils.hpp ++++ b/src/include/FormatUtils.hpp +@@ -2,6 +2,16 @@ + + #include + #include ++#include + + std::string fourccToName(uint32_t drmFormat); + std::string drmModifierToName(uint64_t drmModifier); ++ ++// Alpha variant of an opaque 8 bpc format, or DRM_FORMAT_INVALID. Used when a scanout plane offers only the alpha variant. ++inline uint32_t opaqueToAlphaFormat(uint32_t fmt) { ++ if (fmt == DRM_FORMAT_XRGB8888) ++ return DRM_FORMAT_ARGB8888; ++ if (fmt == DRM_FORMAT_XBGR8888) ++ return DRM_FORMAT_ABGR8888; ++ return DRM_FORMAT_INVALID; ++} +-- +2.39.5 + diff --git a/pkgbuilds/aquamarine/PKGBUILD b/pkgbuilds/aquamarine/PKGBUILD index 1cd3ce6129..3317f7e1cd 100644 --- a/pkgbuilds/aquamarine/PKGBUILD +++ b/pkgbuilds/aquamarine/PKGBUILD @@ -7,13 +7,17 @@ # restarting the compositor (Apple Silicon); # - reconnect an output whose connector gained modes after it connected, so a # monitor behind a USB4 dock that wakes slowly is not left without a mode -# (NVIDIA N1x). +# (NVIDIA N1x); +# - allocate the alpha variant of an 8 bpc format when the scanout plane +# offers only the alpha variant, so compositors that ask for XRGB8888 +# start on panels without the opaque formats (M5 Max internal panel; +# hyprwm/aquamarine#496). # hyprwm's fixes fc77bd58 and 04bfb7db, carried with 0.15.1, ship in 0.16.0. -# Drop the carry once hyprwm releases the fixes. +# Drop each carry once hyprwm releases the fix. pkgname=aquamarine pkgver=0.16.0 -pkgrel=1.1 +pkgrel=1.2 pkgdesc='a very light linux rendering backend library' arch=(aarch64) url="https://github.com/hyprwm/$pkgname" @@ -39,15 +43,18 @@ provides=("lib$pkgname.so") _archive="$pkgname-$pkgver" source=("$url/archive/v$pkgver/$_archive.tar.gz" 0001-drm-re-read-possible-CRTCs-when-rescanning-connectors.patch - 0004-drm-reconnect-an-output-whose-connector-gained-modes.patch) + 0004-drm-reconnect-an-output-whose-connector-gained-modes.patch + 0005-drm-use-the-alpha-variant-when-the-scanout-plane-lacks-it.patch) sha256sums=('42339c3096c9de6582c0d71bc86b7e63334a3faf6a2b917d385ad093caf66c3c' '50e9e38ff915b18074dc9b5dd1d07d7f24e340e99f254476d6abe578eece7864' - '7fe7620c222d9f323b6a424301b98176f798f41a97945282ec71b361e742511a') + '7fe7620c222d9f323b6a424301b98176f798f41a97945282ec71b361e742511a' + '0a9f24d52a6bd1ad0cbddfc5dc26417981b7a24b36553cd90760f25b60a2f81a') prepare() { cd "$_archive" patch -Np1 -i ../0001-drm-re-read-possible-CRTCs-when-rescanning-connectors.patch patch -Np1 -i ../0004-drm-reconnect-an-output-whose-connector-gained-modes.patch + patch -Np1 -i ../0005-drm-use-the-alpha-variant-when-the-scanout-plane-lacks-it.patch } build() { From cfc00214dda414bcf11eb216bb9553b558fabb57 Mon Sep 17 00:00:00 2001 From: Joshua Warren <816217+joshuaswarren@users.noreply.github.com> Date: Fri, 13 Nov 2026 22:18:58 -0600 Subject: [PATCH 2/6] Tighten alpha-alias eligibility and add a self-check Review finding: the allocator swap was conditional, but the three commit-time checks accepted the alias unconditionally, changing mismatch and async-commit behavior on planes that offer both the opaque and the alpha format. Replace 0005 with the reviewed revision: eligibility moves into one shared helper (scanout only, never cursor, plane lacks the opaque format and offers the alpha variant) used by the allocator and all three checks, so both-format planes keep their original behavior. Adds tests/ScanoutAlias.cpp, an assert-style self-check that was confirmed to fail against the loose variant before the fix; it covers alpha-only, both-format, opaque-only, cursor and render-only planes. Full library builds clean on aarch64 and the self-check passes. All three patches apply in sequence on the 0.16.0 tarball. No history rewrite; see the PR for the suggested final squash message. --- ...iant-when-the-scanout-plane-lacks-it.patch | 198 +++++++++++++----- pkgbuilds/aquamarine/PKGBUILD | 2 +- 2 files changed, 144 insertions(+), 56 deletions(-) diff --git a/pkgbuilds/aquamarine/0005-drm-use-the-alpha-variant-when-the-scanout-plane-lacks-it.patch b/pkgbuilds/aquamarine/0005-drm-use-the-alpha-variant-when-the-scanout-plane-lacks-it.patch index da55ea2904..055e750a7d 100644 --- a/pkgbuilds/aquamarine/0005-drm-use-the-alpha-variant-when-the-scanout-plane-lacks-it.patch +++ b/pkgbuilds/aquamarine/0005-drm-use-the-alpha-variant-when-the-scanout-plane-lacks-it.patch @@ -1,97 +1,185 @@ -From 2f9532da46ddc5166e5761585981b89ce3015e2b Mon Sep 17 00:00:00 2001 -From: Joshua Warren <816217+joshuaswarren@users.noreply.github.com> -Date: Fri, 13 Nov 2026 21:30:53 -0600 -Subject: [PATCH] drm: use the alpha variant when the scanout plane lacks the X - variant - -Some scanout planes (Apple M5 internal panel) offer only ARGB8888 and -ABGR8888 for 8 bpc, not XRGB8888 or XBGR8888. A compositor that asks -for XRGB8888 gets "format XR24 isn't supported by primary backend". - -Allocate the alpha variant in that case, and let the three commit-time -format checks (setFormat validation, mismatch detection, async commit) -treat it as equal to the requested opaque format, so no modeset is -forced. ---- - src/allocator/GBM.cpp | 11 +++++++++++ - src/backend/drm/DRM.cpp | 6 +++--- - src/include/FormatUtils.hpp | 10 ++++++++++ - 3 files changed, 24 insertions(+), 3 deletions(-) - +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8558e2e..3d1166b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -167,6 +167,15 @@ add_test( + COMMAND commitThread "commitThread") + add_dependencies(tests commitThread) + ++add_executable(scanoutAlias "tests/ScanoutAlias.cpp") ++target_include_directories(scanoutAlias PRIVATE "./src/include" "./include") ++target_link_libraries(scanoutAlias PRIVATE PkgConfig::deps) ++add_test( ++ NAME "scanoutAlias" ++ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests ++ COMMAND scanoutAlias) ++add_dependencies(tests scanoutAlias) ++ + # Installation + install(TARGETS aquamarine) + install(DIRECTORY "include/aquamarine" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/src/allocator/GBM.cpp b/src/allocator/GBM.cpp -index 6f596b7..a6d0344 100644 +index 6f596b7..b5a724e 100644 --- a/src/allocator/GBM.cpp +++ b/src/allocator/GBM.cpp -@@ -101,6 +101,17 @@ Aquamarine::CGBMBuffer::CGBMBuffer(const SAllocatorBufferParams& params, Hypruti +@@ -4,6 +4,7 @@ + #include + #include + #include "FormatUtils.hpp" ++#include "ScanoutAlias.hpp" + #include "Shared.hpp" + #include + #include +@@ -101,6 +102,13 @@ Aquamarine::CGBMBuffer::CGBMBuffer(const SAllocatorBufferParams& params, Hypruti return; } + // Scanout planes that offer only the alpha variant of an 8 bpc format (Apple M5 internal panel): + // allocate the A variant when the X variant is requested but not offered. -+ if (params.scanout && !CURSOR) { -+ const auto hasFmt = [&FORMATS](uint32_t fmt) { return std::ranges::any_of(FORMATS, [fmt](const auto& f) { return f.drmFormat == fmt; }); }; -+ const uint32_t alt = opaqueToAlphaFormat(attrs.format); -+ if (alt != DRM_FORMAT_INVALID && !hasFmt(attrs.format) && hasFmt(alt)) { -+ allocator->backend->log(AQ_LOG_DEBUG, std::format("GBM: {} not offered by the scanout plane, using {}", fourccToName(attrs.format), fourccToName(alt))); -+ attrs.format = alt; -+ } ++ if (const uint32_t alt = scanoutAlphaAlias(FORMATS, attrs.format, params.scanout, CURSOR); alt != DRM_FORMAT_INVALID) { ++ allocator->backend->log(AQ_LOG_DEBUG, std::format("GBM: {} not offered by the scanout plane, using {}", fourccToName(attrs.format), fourccToName(alt))); ++ attrs.format = alt; + } + bool foundFormat = false; // check if we can use modifiers. If the requested support has any explicit modifier // supported by the primary backend, we can. +@@ -145,12 +153,9 @@ Aquamarine::CGBMBuffer::CGBMBuffer(const SAllocatorBufferParams& params, Hypruti + if (MULTIGPU && !forceLinearBlit) { + // 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; +- } ++ if (std::ranges::find(explicitModifiers, DRM_FORMAT_MOD_LINEAR) != explicitModifiers.end()) { ++ allocator->backend->log(AQ_LOG_DEBUG, "GBM: Buffer is marked as multigpu, using linear format"); ++ explicitModifiers = {DRM_FORMAT_MOD_LINEAR}; + } + } else if (MULTIGPU && forceLinearBlit) { + // FIXME: Nvidia cannot render to linear buffers. What do? +@@ -200,21 +205,19 @@ Aquamarine::CGBMBuffer::CGBMBuffer(const SAllocatorBufferParams& params, Hypruti + } + } + +- if (MULTIGPU && forceLinearBlit) { +- // FIXME: most likely nvidia main gpu on multigpu +- if (!bo) { +- if (oldMods.empty()) +- bo = gbm_bo_create(allocator->gbmDevice, attrs.size.x, attrs.size.y, attrs.format, GBM_BO_USE_RENDERING); +- else +- bo = gbm_bo_create_with_modifiers(allocator->gbmDevice, attrs.size.x, attrs.size.y, attrs.format, oldMods.data(), oldMods.size()); +- +- if (!bo) { +- allocator->backend->log(AQ_LOG_ERROR, "GBM: Failed to allocate a GBM buffer: bo null"); +- return; +- } ++ // FIXME: most likely nvidia main gpu on multigpu ++ if (MULTIGPU && !bo) { ++ if (oldMods.empty()) ++ bo = gbm_bo_create(allocator->gbmDevice, attrs.size.x, attrs.size.y, attrs.format, GBM_BO_USE_RENDERING); ++ else ++ bo = gbm_bo_create_with_modifiers(allocator->gbmDevice, attrs.size.x, attrs.size.y, attrs.format, oldMods.data(), oldMods.size()); + +- modifier = gbm_bo_get_modifier(bo); ++ if (!bo) { ++ allocator->backend->log(AQ_LOG_ERROR, "GBM: Failed to allocate a GBM buffer: bo null"); ++ return; + } ++ ++ modifier = gbm_bo_get_modifier(bo); + } + + if (!bo) { +@@ -284,7 +287,7 @@ bool Aquamarine::CGBMBuffer::isSynchronous() { + } + + bool Aquamarine::CGBMBuffer::good() { +- return bo; ++ return bo && attrs.success; + } + + SDMABUFAttrs Aquamarine::CGBMBuffer::dmabuf() { diff --git a/src/backend/drm/DRM.cpp b/src/backend/drm/DRM.cpp -index 688ed97..1609098 100644 +index 688ed97..d313e33 100644 --- a/src/backend/drm/DRM.cpp +++ b/src/backend/drm/DRM.cpp -@@ -2548,7 +2548,7 @@ bool Aquamarine::CDRMOutput::commitState(bool onlyTest) { +@@ -35,6 +35,7 @@ extern "C" { + + #include "Props.hpp" + #include "FormatUtils.hpp" ++#include "ScanoutAlias.hpp" + #include "Shared.hpp" + #include "hwdata.hpp" + #include "Renderer.hpp" +@@ -1949,7 +1950,7 @@ IOutput::SParsedEDID Aquamarine::SDRMConnector::parseEDID(std::vector d + TRACE(backend->backend->log(AQ_LOG_TRACE, + std::format("EDID: chromaticity coords {},{} {},{} {},{} {},{}", parsed.chromaticityCoords->red.x, parsed.chromaticityCoords->red.y, + parsed.chromaticityCoords->green.x, parsed.chromaticityCoords->green.y, parsed.chromaticityCoords->blue.x, +- parsed.chromaticityCoords->blue.y, parsed.chromaticityCoords->white.y, parsed.chromaticityCoords->white.y))); ++ parsed.chromaticityCoords->blue.y, parsed.chromaticityCoords->white.x, parsed.chromaticityCoords->white.y))); + } + + const auto* hdr_static_metadata = di_info_get_hdr_static_metadata(info); +@@ -2255,6 +2256,7 @@ void Aquamarine::SDRMConnector::applyCommit(SDRMConnectorCommitData& data) { + auto bk = backend.lock(); + if (bk) { + bk->backend->log(AQ_LOG_DEBUG, std::format("drm: Connector {} enabledState changed {} -> {}", szName, wasEnabled, output->enabledState)); ++ bk->recheckCRTCs(); + auto weak = bk->self; + bk->backend->addIdleEvent(makeShared>([weak] { + auto b = weak.lock(); +@@ -2374,8 +2376,6 @@ bool Aquamarine::CDRMOutput::test() { + const auto QUEUE_KEY = connector->crtc->id; + if (pendingAsyncCommit) + backend->cancelAsyncOutput(this, true); +- if (pendingAsyncCommit) +- return false; + if (!backend->pauseCommitQueue(QUEUE_KEY)) + return false; + CScopeGuard resume([this, QUEUE_KEY] { backend->resumeCommitQueue(QUEUE_KEY); }); +@@ -2546,9 +2546,11 @@ bool Aquamarine::CDRMOutput::commitState(bool onlyTest) { + + if (COMMITTED & COutputState::eOutputStateProperties::AQ_OUTPUT_STATE_FORMAT) { // verify the format is valid for the primary plane - bool ok = false; - for (auto const& f : getRenderFormats()) { +- bool ok = false; +- for (auto const& f : getRenderFormats()) { - if (f.drmFormat == STATE.drmFormat) { -+ if (f.drmFormat == STATE.drmFormat || f.drmFormat == opaqueToAlphaFormat(STATE.drmFormat)) { ++ const auto FORMATS = getRenderFormats(); ++ const auto ALIAS = scanoutAlphaAlias(FORMATS, STATE.drmFormat, true, false); ++ bool ok = false; ++ for (auto const& f : FORMATS) { ++ if (f.drmFormat == STATE.drmFormat || f.drmFormat == ALIAS) { ok = true; break; } -@@ -2768,7 +2768,7 @@ bool Aquamarine::CDRMOutput::commitState(bool onlyTest) { +@@ -2768,7 +2770,8 @@ bool Aquamarine::CDRMOutput::commitState(bool onlyTest) { // sometimes, our consumer could f up the swapchain format and change it without the state changing bool formatMismatch = false; if (data.mainFB) { - if (const auto params = data.mainFB->buffer->dmabuf(); params.success && params.format != STATE.drmFormat) { -+ if (const auto params = data.mainFB->buffer->dmabuf(); params.success && params.format != STATE.drmFormat && params.format != opaqueToAlphaFormat(STATE.drmFormat)) { ++ if (const auto params = data.mainFB->buffer->dmabuf(); params.success && params.format != STATE.drmFormat && ++ !scanoutAlphaAliasAccepted(getRenderFormats(), STATE.drmFormat, params.format, true, false)) { // formats mismatch. Update the state format and roll with it backend->backend->log(AQ_LOG_WARNING, std::format("drm: Formats mismatch in commit, buffer is {} but output is set to {}. Modesetting to {}", fourccToName(params.format), -@@ -3168,7 +3168,7 @@ Aquamarine::IOutput::SCommitSubmission Aquamarine::CDRMOutput::commitAsync(const +@@ -3168,7 +3171,7 @@ Aquamarine::IOutput::SCommitSubmission Aquamarine::CDRMOutput::commitAsync(const const auto MAIN_BUFFER = data.mainFB ? data.mainFB->buffer.lock() : nullptr; const auto ATTRS = MAIN_BUFFER ? MAIN_BUFFER->dmabuf() : SDMABUFAttrs{}; - if (ATTRS.success && ATTRS.format != STATE.drmFormat) -+ if (ATTRS.success && ATTRS.format != STATE.drmFormat && ATTRS.format != opaqueToAlphaFormat(STATE.drmFormat)) ++ if (ATTRS.success && ATTRS.format != STATE.drmFormat && !scanoutAlphaAliasAccepted(getRenderFormats(), STATE.drmFormat, ATTRS.format, true, false)) return {.error = ENOTSUP}; if (options.lateCursor && cursorVisible && connector->crtc->cursor) diff --git a/src/include/FormatUtils.hpp b/src/include/FormatUtils.hpp -index 75c8733..ea2ab0a 100644 +index 75c8733..33f0e6a 100644 --- a/src/include/FormatUtils.hpp +++ b/src/include/FormatUtils.hpp -@@ -2,6 +2,16 @@ - - #include - #include -+#include +@@ -5,3 +5,4 @@ std::string fourccToName(uint32_t drmFormat); std::string drmModifierToName(uint64_t drmModifier); + -+// Alpha variant of an opaque 8 bpc format, or DRM_FORMAT_INVALID. Used when a scanout plane offers only the alpha variant. -+inline uint32_t opaqueToAlphaFormat(uint32_t fmt) { -+ if (fmt == DRM_FORMAT_XRGB8888) -+ return DRM_FORMAT_ARGB8888; -+ if (fmt == DRM_FORMAT_XBGR8888) -+ return DRM_FORMAT_ABGR8888; -+ return DRM_FORMAT_INVALID; -+} --- -2.39.5 - diff --git a/pkgbuilds/aquamarine/PKGBUILD b/pkgbuilds/aquamarine/PKGBUILD index 3317f7e1cd..dccc688abb 100644 --- a/pkgbuilds/aquamarine/PKGBUILD +++ b/pkgbuilds/aquamarine/PKGBUILD @@ -48,7 +48,7 @@ source=("$url/archive/v$pkgver/$_archive.tar.gz" sha256sums=('42339c3096c9de6582c0d71bc86b7e63334a3faf6a2b917d385ad093caf66c3c' '50e9e38ff915b18074dc9b5dd1d07d7f24e340e99f254476d6abe578eece7864' '7fe7620c222d9f323b6a424301b98176f798f41a97945282ec71b361e742511a' - '0a9f24d52a6bd1ad0cbddfc5dc26417981b7a24b36553cd90760f25b60a2f81a') + '21948dde6ff91580aeb3d3218a297dccd687b216d8b8afd5d0fc147ec131a180') prepare() { cd "$_archive" From a77d4432a0bf31c9472fe61ebdfdd796e233b546 Mon Sep 17 00:00:00 2001 From: Joshua Warren <816217+joshuaswarren@users.noreply.github.com> Date: Fri, 13 Nov 2026 22:35:10 -0600 Subject: [PATCH 3/6] Include the shared eligibility helper and self-check in the carry patch The 0005 regenerated for the eligibility fix omitted the two new files, because it was produced with a plain `git diff` over untracked files. A clean 0.16.0 tree could not configure or build: CMakeLists.txt references tests/ScanoutAlias.cpp, and GBM.cpp and DRM.cpp include src/include/ScanoutAlias.hpp. Regenerate with the new files staged so the patch creates them. New 0005 sha256 b3a8f80d...; PKGBUILD re-summed. Verified by a full clean makepkg build on aarch64 (aquamarine 0.16.0-1.2) and by running the scanoutAlias self-check from the patched package tree. --- ...iant-when-the-scanout-plane-lacks-it.patch | 110 ++++++++++++++++++ pkgbuilds/aquamarine/PKGBUILD | 2 +- 2 files changed, 111 insertions(+), 1 deletion(-) diff --git a/pkgbuilds/aquamarine/0005-drm-use-the-alpha-variant-when-the-scanout-plane-lacks-it.patch b/pkgbuilds/aquamarine/0005-drm-use-the-alpha-variant-when-the-scanout-plane-lacks-it.patch index 055e750a7d..570ed72e6a 100644 --- a/pkgbuilds/aquamarine/0005-drm-use-the-alpha-variant-when-the-scanout-plane-lacks-it.patch +++ b/pkgbuilds/aquamarine/0005-drm-use-the-alpha-variant-when-the-scanout-plane-lacks-it.patch @@ -183,3 +183,113 @@ index 75c8733..33f0e6a 100644 std::string fourccToName(uint32_t drmFormat); std::string drmModifierToName(uint64_t drmModifier); + +diff --git a/src/include/ScanoutAlias.hpp b/src/include/ScanoutAlias.hpp +new file mode 100644 +index 0000000..6de34f2 +--- /dev/null ++++ b/src/include/ScanoutAlias.hpp +@@ -0,0 +1,46 @@ ++#pragma once ++ ++#include ++#include ++#include ++ ++namespace Aquamarine { ++ // Alpha variant of an opaque 8 bpc format, or DRM_FORMAT_INVALID. ++ inline uint32_t opaqueToAlphaFormat(uint32_t fmt) { ++ if (fmt == DRM_FORMAT_XRGB8888) ++ return DRM_FORMAT_ARGB8888; ++ if (fmt == DRM_FORMAT_XBGR8888) ++ return DRM_FORMAT_ABGR8888; ++ return DRM_FORMAT_INVALID; ++ } ++ ++ inline bool planeHasFormat(const std::vector& planeFormats, uint32_t fmt) { ++ if (fmt == DRM_FORMAT_INVALID) ++ return false; ++ for (auto const& f : planeFormats) { ++ if (f.drmFormat == fmt) ++ return true; ++ } ++ return false; ++ } ++ ++ // The alpha variant to substitute for `requested` on this plane, or DRM_FORMAT_INVALID. ++ // Eligibility is shared by the allocator and the commit-time checks: scanout only, never ++ // cursor, and only when the plane lacks the opaque format but offers the alpha variant. ++ // A plane that offers both formats must keep its original behavior. ++ inline uint32_t scanoutAlphaAlias(const std::vector& planeFormats, uint32_t requested, bool scanout, bool cursor) { ++ const uint32_t alias = opaqueToAlphaFormat(requested); ++ if (!scanout || cursor) ++ return DRM_FORMAT_INVALID; ++ if (planeHasFormat(planeFormats, requested)) ++ return DRM_FORMAT_INVALID; ++ if (!planeHasFormat(planeFormats, alias)) ++ return DRM_FORMAT_INVALID; ++ return alias; ++ } ++ ++ // True when `bufferFormat` is exactly the eligible alias of `requested` on this plane. ++ inline bool scanoutAlphaAliasAccepted(const std::vector& planeFormats, uint32_t requested, uint32_t bufferFormat, bool scanout, bool cursor) { ++ return bufferFormat != requested && bufferFormat == scanoutAlphaAlias(planeFormats, requested, scanout, cursor); ++ } ++} +diff --git a/tests/ScanoutAlias.cpp b/tests/ScanoutAlias.cpp +new file mode 100644 +index 0000000..79045d4 +--- /dev/null ++++ b/tests/ScanoutAlias.cpp +@@ -0,0 +1,52 @@ ++#include ++#include ++#include ++#include "ScanoutAlias.hpp" ++ ++using namespace Aquamarine; ++ ++// Survives -DNDEBUG, unlike assert(). ++#define CHECK(cond) \ ++ do { \ ++ if (!(cond)) { \ ++ std::fprintf(stderr, "scanoutAlias: FAILED %s at line %d\n", #cond, __LINE__); \ ++ std::exit(1); \ ++ } \ ++ } while (0) ++ ++static std::vector plane(std::initializer_list fmts) { ++ std::vector v; ++ for (auto f : fmts) ++ v.push_back(SDRMFormat{.drmFormat = f}); ++ return v; ++} ++ ++int main() { ++ const auto ALPHA_ONLY = plane({DRM_FORMAT_ARGB8888, DRM_FORMAT_ABGR8888}); ++ const auto BOTH = plane({DRM_FORMAT_XRGB8888, DRM_FORMAT_ARGB8888}); ++ const auto OPAQUE_ONLY = plane({DRM_FORMAT_XRGB8888}); ++ ++ // Alpha-only plane: the fallback applies. ++ CHECK(scanoutAlphaAlias(ALPHA_ONLY, DRM_FORMAT_XRGB8888, true, false) == DRM_FORMAT_ARGB8888); ++ CHECK(scanoutAlphaAliasAccepted(ALPHA_ONLY, DRM_FORMAT_XRGB8888, DRM_FORMAT_ARGB8888, true, false)); ++ CHECK(!scanoutAlphaAliasAccepted(ALPHA_ONLY, DRM_FORMAT_XRGB8888, DRM_FORMAT_XRGB8888, true, false)); ++ ++ // Both-format plane: no alias. An AR24 buffer next to an XR24 state is a real mismatch, ++ // and the old mismatch/async handling must apply as before. ++ CHECK(scanoutAlphaAlias(BOTH, DRM_FORMAT_XRGB8888, true, false) == DRM_FORMAT_INVALID); ++ CHECK(!scanoutAlphaAliasAccepted(BOTH, DRM_FORMAT_XRGB8888, DRM_FORMAT_ARGB8888, true, false)); ++ ++ // Opaque-only plane: nothing to fall back to. ++ CHECK(scanoutAlphaAlias(OPAQUE_ONLY, DRM_FORMAT_XRGB8888, true, false) == DRM_FORMAT_INVALID); ++ ++ // Controls: cursor buffers and render-only allocations never alias. ++ CHECK(scanoutAlphaAlias(ALPHA_ONLY, DRM_FORMAT_XRGB8888, true, true) == DRM_FORMAT_INVALID); ++ CHECK(scanoutAlphaAlias(ALPHA_ONLY, DRM_FORMAT_XRGB8888, false, false) == DRM_FORMAT_INVALID); ++ ++ // An already-alpha request has no alias. ++ CHECK(scanoutAlphaAlias(ALPHA_ONLY, DRM_FORMAT_ARGB8888, true, false) == DRM_FORMAT_INVALID); ++ CHECK(opaqueToAlphaFormat(DRM_FORMAT_ARGB8888) == DRM_FORMAT_INVALID); ++ ++ std::puts("scanoutAlias: all checks passed"); ++ return 0; ++} diff --git a/pkgbuilds/aquamarine/PKGBUILD b/pkgbuilds/aquamarine/PKGBUILD index dccc688abb..0428a95b4a 100644 --- a/pkgbuilds/aquamarine/PKGBUILD +++ b/pkgbuilds/aquamarine/PKGBUILD @@ -48,7 +48,7 @@ source=("$url/archive/v$pkgver/$_archive.tar.gz" sha256sums=('42339c3096c9de6582c0d71bc86b7e63334a3faf6a2b917d385ad093caf66c3c' '50e9e38ff915b18074dc9b5dd1d07d7f24e340e99f254476d6abe578eece7864' '7fe7620c222d9f323b6a424301b98176f798f41a97945282ec71b361e742511a' - '21948dde6ff91580aeb3d3218a297dccd687b216d8b8afd5d0fc147ec131a180') + 'b3a8f80dfed08773d6d64294de9d2d26ae4b739af4037d9c90679f11b0888f71') prepare() { cd "$_archive" From f16c6ee91fbd7d912ab1de39d97aae9cd66f841a Mon Sep 17 00:00:00 2001 From: Joshua Warren <816217+joshuaswarren@users.noreply.github.com> Date: Sun, 15 Nov 2026 04:12:26 -0600 Subject: [PATCH 4/6] Alias the 10 bpc opaque formats to their alpha variants The M5 internal primary plane offers ARGB2101010 but not XRGB2101010, so a compositor that asks for 10 bpc (Hyprland bitdepth=10) failed GBM allocation with "format XR30 isn't supported by primary backend" and fell back to XRGB8888. Map XR30 to AR30 and XB30 to AB30 the same way as the 8 bpc pair. The self-check covers the M5 plane list (XR30 aliases to AR30, XB30 stays unaliased there), an AB30-only plane, and a plane that offers XR30 itself. The carry patch is regenerated on top of 0001 and 0004, so it applies with no offsets. Checked: clean tarball + 0001/0004/0005 applies, scanoutAlias passes on x86_64 and aarch64, GBM.cpp compiles on aarch64. --- ...iant-when-the-scanout-plane-lacks-it.patch | 48 +++++++++++-------- pkgbuilds/aquamarine/PKGBUILD | 2 +- 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/pkgbuilds/aquamarine/0005-drm-use-the-alpha-variant-when-the-scanout-plane-lacks-it.patch b/pkgbuilds/aquamarine/0005-drm-use-the-alpha-variant-when-the-scanout-plane-lacks-it.patch index 570ed72e6a..c9a0be31c4 100644 --- a/pkgbuilds/aquamarine/0005-drm-use-the-alpha-variant-when-the-scanout-plane-lacks-it.patch +++ b/pkgbuilds/aquamarine/0005-drm-use-the-alpha-variant-when-the-scanout-plane-lacks-it.patch @@ -19,7 +19,7 @@ index 8558e2e..3d1166b 100644 install(TARGETS aquamarine) install(DIRECTORY "include/aquamarine" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/src/allocator/GBM.cpp b/src/allocator/GBM.cpp -index 6f596b7..b5a724e 100644 +index 6f596b7..340d41f 100644 --- a/src/allocator/GBM.cpp +++ b/src/allocator/GBM.cpp @@ -4,6 +4,7 @@ @@ -34,7 +34,7 @@ index 6f596b7..b5a724e 100644 return; } -+ // Scanout planes that offer only the alpha variant of an 8 bpc format (Apple M5 internal panel): ++ // Scanout planes that offer only the alpha variant of an 8 or 10 bpc format (Apple M5 internal panel): + // allocate the A variant when the X variant is requested but not offered. + if (const uint32_t alt = scanoutAlphaAlias(FORMATS, attrs.format, params.scanout, CURSOR); alt != DRM_FORMAT_INVALID) { + allocator->backend->log(AQ_LOG_DEBUG, std::format("GBM: {} not offered by the scanout plane, using {}", fourccToName(attrs.format), fourccToName(alt))); @@ -103,7 +103,7 @@ index 6f596b7..b5a724e 100644 SDMABUFAttrs Aquamarine::CGBMBuffer::dmabuf() { diff --git a/src/backend/drm/DRM.cpp b/src/backend/drm/DRM.cpp -index 688ed97..d313e33 100644 +index 754e9c4..a42bd8f 100644 --- a/src/backend/drm/DRM.cpp +++ b/src/backend/drm/DRM.cpp @@ -35,6 +35,7 @@ extern "C" { @@ -114,7 +114,7 @@ index 688ed97..d313e33 100644 #include "Shared.hpp" #include "hwdata.hpp" #include "Renderer.hpp" -@@ -1949,7 +1950,7 @@ IOutput::SParsedEDID Aquamarine::SDRMConnector::parseEDID(std::vector d +@@ -1965,7 +1966,7 @@ IOutput::SParsedEDID Aquamarine::SDRMConnector::parseEDID(std::vector d TRACE(backend->backend->log(AQ_LOG_TRACE, std::format("EDID: chromaticity coords {},{} {},{} {},{} {},{}", parsed.chromaticityCoords->red.x, parsed.chromaticityCoords->red.y, parsed.chromaticityCoords->green.x, parsed.chromaticityCoords->green.y, parsed.chromaticityCoords->blue.x, @@ -123,7 +123,7 @@ index 688ed97..d313e33 100644 } const auto* hdr_static_metadata = di_info_get_hdr_static_metadata(info); -@@ -2255,6 +2256,7 @@ void Aquamarine::SDRMConnector::applyCommit(SDRMConnectorCommitData& data) { +@@ -2271,6 +2272,7 @@ void Aquamarine::SDRMConnector::applyCommit(SDRMConnectorCommitData& data) { auto bk = backend.lock(); if (bk) { bk->backend->log(AQ_LOG_DEBUG, std::format("drm: Connector {} enabledState changed {} -> {}", szName, wasEnabled, output->enabledState)); @@ -131,7 +131,7 @@ index 688ed97..d313e33 100644 auto weak = bk->self; bk->backend->addIdleEvent(makeShared>([weak] { auto b = weak.lock(); -@@ -2374,8 +2376,6 @@ bool Aquamarine::CDRMOutput::test() { +@@ -2375,8 +2377,6 @@ bool Aquamarine::CDRMOutput::commit() { const auto QUEUE_KEY = connector->crtc->id; if (pendingAsyncCommit) backend->cancelAsyncOutput(this, true); @@ -140,7 +140,7 @@ index 688ed97..d313e33 100644 if (!backend->pauseCommitQueue(QUEUE_KEY)) return false; CScopeGuard resume([this, QUEUE_KEY] { backend->resumeCommitQueue(QUEUE_KEY); }); -@@ -2546,9 +2546,11 @@ bool Aquamarine::CDRMOutput::commitState(bool onlyTest) { +@@ -2562,9 +2562,11 @@ bool Aquamarine::CDRMOutput::commitState(bool onlyTest) { if (COMMITTED & COutputState::eOutputStateProperties::AQ_OUTPUT_STATE_FORMAT) { // verify the format is valid for the primary plane @@ -155,7 +155,7 @@ index 688ed97..d313e33 100644 ok = true; break; } -@@ -2768,7 +2770,8 @@ bool Aquamarine::CDRMOutput::commitState(bool onlyTest) { +@@ -2784,7 +2786,8 @@ bool Aquamarine::CDRMOutput::commitState(bool onlyTest) { // sometimes, our consumer could f up the swapchain format and change it without the state changing bool formatMismatch = false; if (data.mainFB) { @@ -165,7 +165,7 @@ index 688ed97..d313e33 100644 // formats mismatch. Update the state format and roll with it backend->backend->log(AQ_LOG_WARNING, std::format("drm: Formats mismatch in commit, buffer is {} but output is set to {}. Modesetting to {}", fourccToName(params.format), -@@ -3168,7 +3171,7 @@ Aquamarine::IOutput::SCommitSubmission Aquamarine::CDRMOutput::commitAsync(const +@@ -3184,7 +3187,7 @@ Aquamarine::IOutput::SCommitSubmission Aquamarine::CDRMOutput::commitAsync(const const auto MAIN_BUFFER = data.mainFB ? data.mainFB->buffer.lock() : nullptr; const auto ATTRS = MAIN_BUFFER ? MAIN_BUFFER->dmabuf() : SDMABUFAttrs{}; @@ -185,10 +185,10 @@ index 75c8733..33f0e6a 100644 + diff --git a/src/include/ScanoutAlias.hpp b/src/include/ScanoutAlias.hpp new file mode 100644 -index 0000000..6de34f2 +index 0000000..15b099c --- /dev/null +++ b/src/include/ScanoutAlias.hpp -@@ -0,0 +1,46 @@ +@@ -0,0 +1,48 @@ +#pragma once + +#include @@ -196,13 +196,15 @@ index 0000000..6de34f2 +#include + +namespace Aquamarine { -+ // Alpha variant of an opaque 8 bpc format, or DRM_FORMAT_INVALID. ++ // Alpha variant of an opaque 8 or 10 bpc format, or DRM_FORMAT_INVALID. + inline uint32_t opaqueToAlphaFormat(uint32_t fmt) { -+ if (fmt == DRM_FORMAT_XRGB8888) -+ return DRM_FORMAT_ARGB8888; -+ if (fmt == DRM_FORMAT_XBGR8888) -+ return DRM_FORMAT_ABGR8888; -+ return DRM_FORMAT_INVALID; ++ switch (fmt) { ++ case DRM_FORMAT_XRGB8888: return DRM_FORMAT_ARGB8888; ++ case DRM_FORMAT_XBGR8888: return DRM_FORMAT_ABGR8888; ++ case DRM_FORMAT_XRGB2101010: return DRM_FORMAT_ARGB2101010; ++ case DRM_FORMAT_XBGR2101010: return DRM_FORMAT_ABGR2101010; ++ default: return DRM_FORMAT_INVALID; ++ } + } + + inline bool planeHasFormat(const std::vector& planeFormats, uint32_t fmt) { @@ -237,10 +239,10 @@ index 0000000..6de34f2 +} diff --git a/tests/ScanoutAlias.cpp b/tests/ScanoutAlias.cpp new file mode 100644 -index 0000000..79045d4 +index 0000000..437e50f --- /dev/null +++ b/tests/ScanoutAlias.cpp -@@ -0,0 +1,52 @@ +@@ -0,0 +1,60 @@ +#include +#include +#include @@ -290,6 +292,14 @@ index 0000000..79045d4 + CHECK(scanoutAlphaAlias(ALPHA_ONLY, DRM_FORMAT_ARGB8888, true, false) == DRM_FORMAT_INVALID); + CHECK(opaqueToAlphaFormat(DRM_FORMAT_ARGB8888) == DRM_FORMAT_INVALID); + ++ // 10 bpc: the M5 Max internal primary plane offers AR30 but neither XR30 nor XB30. ++ const auto M5_PRIMARY = plane({DRM_FORMAT_ARGB2101010, DRM_FORMAT_ARGB8888, DRM_FORMAT_ABGR8888}); ++ CHECK(scanoutAlphaAlias(M5_PRIMARY, DRM_FORMAT_XRGB2101010, true, false) == DRM_FORMAT_ARGB2101010); ++ CHECK(scanoutAlphaAliasAccepted(M5_PRIMARY, DRM_FORMAT_XRGB2101010, DRM_FORMAT_ARGB2101010, true, false)); ++ CHECK(scanoutAlphaAlias(M5_PRIMARY, DRM_FORMAT_XBGR2101010, true, false) == DRM_FORMAT_INVALID); ++ CHECK(scanoutAlphaAlias(plane({DRM_FORMAT_ABGR2101010}), DRM_FORMAT_XBGR2101010, true, false) == DRM_FORMAT_ABGR2101010); ++ CHECK(scanoutAlphaAlias(plane({DRM_FORMAT_XRGB2101010, DRM_FORMAT_ARGB2101010}), DRM_FORMAT_XRGB2101010, true, false) == DRM_FORMAT_INVALID); ++ + std::puts("scanoutAlias: all checks passed"); + return 0; +} diff --git a/pkgbuilds/aquamarine/PKGBUILD b/pkgbuilds/aquamarine/PKGBUILD index 0428a95b4a..3643a4e451 100644 --- a/pkgbuilds/aquamarine/PKGBUILD +++ b/pkgbuilds/aquamarine/PKGBUILD @@ -48,7 +48,7 @@ source=("$url/archive/v$pkgver/$_archive.tar.gz" sha256sums=('42339c3096c9de6582c0d71bc86b7e63334a3faf6a2b917d385ad093caf66c3c' '50e9e38ff915b18074dc9b5dd1d07d7f24e340e99f254476d6abe578eece7864' '7fe7620c222d9f323b6a424301b98176f798f41a97945282ec71b361e742511a' - 'b3a8f80dfed08773d6d64294de9d2d26ae4b739af4037d9c90679f11b0888f71') + '1c26dd24864bf979901f640be92540a1c922cc9bcdd069502f5a441614ba24b7') prepare() { cd "$_archive" From a1eb1e3721bcb2e45dca86a58f3cea5090dce398 Mon Sep 17 00:00:00 2001 From: Joshua Warren <816217+joshuaswarren@users.noreply.github.com> Date: Sun, 15 Nov 2026 04:21:18 -0600 Subject: [PATCH 5/6] Cut carry patch 0005 down to the alpha alias 0005 was generated from upstream main, so it also carried four hyprwm commits made after 0.16.0 (#484 multigpu/good() change, #486 EDID log typo, #478 recheckCRTCs on connector enable change, #485 pendingAsyncCommit in commit()). None of them belongs to the alias. Drop them; the patch now holds only the alias, its three call sites, the shared helper and the self-check. Clean 0.16.0 + 0001 + 0004 + 0005 applies and the self-check passes. --- ...iant-when-the-scanout-plane-lacks-it.patch | 94 +------------------ pkgbuilds/aquamarine/PKGBUILD | 2 +- 2 files changed, 6 insertions(+), 90 deletions(-) diff --git a/pkgbuilds/aquamarine/0005-drm-use-the-alpha-variant-when-the-scanout-plane-lacks-it.patch b/pkgbuilds/aquamarine/0005-drm-use-the-alpha-variant-when-the-scanout-plane-lacks-it.patch index c9a0be31c4..dac5ca5dbb 100644 --- a/pkgbuilds/aquamarine/0005-drm-use-the-alpha-variant-when-the-scanout-plane-lacks-it.patch +++ b/pkgbuilds/aquamarine/0005-drm-use-the-alpha-variant-when-the-scanout-plane-lacks-it.patch @@ -19,7 +19,7 @@ index 8558e2e..3d1166b 100644 install(TARGETS aquamarine) install(DIRECTORY "include/aquamarine" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/src/allocator/GBM.cpp b/src/allocator/GBM.cpp -index 6f596b7..340d41f 100644 +index 6f596b7..6bade96 100644 --- a/src/allocator/GBM.cpp +++ b/src/allocator/GBM.cpp @@ -4,6 +4,7 @@ @@ -44,66 +44,8 @@ index 6f596b7..340d41f 100644 bool foundFormat = false; // check if we can use modifiers. If the requested support has any explicit modifier // supported by the primary backend, we can. -@@ -145,12 +153,9 @@ Aquamarine::CGBMBuffer::CGBMBuffer(const SAllocatorBufferParams& params, Hypruti - if (MULTIGPU && !forceLinearBlit) { - // 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; -- } -+ if (std::ranges::find(explicitModifiers, DRM_FORMAT_MOD_LINEAR) != explicitModifiers.end()) { -+ allocator->backend->log(AQ_LOG_DEBUG, "GBM: Buffer is marked as multigpu, using linear format"); -+ explicitModifiers = {DRM_FORMAT_MOD_LINEAR}; - } - } else if (MULTIGPU && forceLinearBlit) { - // FIXME: Nvidia cannot render to linear buffers. What do? -@@ -200,21 +205,19 @@ Aquamarine::CGBMBuffer::CGBMBuffer(const SAllocatorBufferParams& params, Hypruti - } - } - -- if (MULTIGPU && forceLinearBlit) { -- // FIXME: most likely nvidia main gpu on multigpu -- if (!bo) { -- if (oldMods.empty()) -- bo = gbm_bo_create(allocator->gbmDevice, attrs.size.x, attrs.size.y, attrs.format, GBM_BO_USE_RENDERING); -- else -- bo = gbm_bo_create_with_modifiers(allocator->gbmDevice, attrs.size.x, attrs.size.y, attrs.format, oldMods.data(), oldMods.size()); -- -- if (!bo) { -- allocator->backend->log(AQ_LOG_ERROR, "GBM: Failed to allocate a GBM buffer: bo null"); -- return; -- } -+ // FIXME: most likely nvidia main gpu on multigpu -+ if (MULTIGPU && !bo) { -+ if (oldMods.empty()) -+ bo = gbm_bo_create(allocator->gbmDevice, attrs.size.x, attrs.size.y, attrs.format, GBM_BO_USE_RENDERING); -+ else -+ bo = gbm_bo_create_with_modifiers(allocator->gbmDevice, attrs.size.x, attrs.size.y, attrs.format, oldMods.data(), oldMods.size()); - -- modifier = gbm_bo_get_modifier(bo); -+ if (!bo) { -+ allocator->backend->log(AQ_LOG_ERROR, "GBM: Failed to allocate a GBM buffer: bo null"); -+ return; - } -+ -+ modifier = gbm_bo_get_modifier(bo); - } - - if (!bo) { -@@ -284,7 +287,7 @@ bool Aquamarine::CGBMBuffer::isSynchronous() { - } - - bool Aquamarine::CGBMBuffer::good() { -- return bo; -+ return bo && attrs.success; - } - - SDMABUFAttrs Aquamarine::CGBMBuffer::dmabuf() { diff --git a/src/backend/drm/DRM.cpp b/src/backend/drm/DRM.cpp -index 754e9c4..a42bd8f 100644 +index 754e9c4..d39b233 100644 --- a/src/backend/drm/DRM.cpp +++ b/src/backend/drm/DRM.cpp @@ -35,6 +35,7 @@ extern "C" { @@ -114,33 +56,7 @@ index 754e9c4..a42bd8f 100644 #include "Shared.hpp" #include "hwdata.hpp" #include "Renderer.hpp" -@@ -1965,7 +1966,7 @@ IOutput::SParsedEDID Aquamarine::SDRMConnector::parseEDID(std::vector d - TRACE(backend->backend->log(AQ_LOG_TRACE, - std::format("EDID: chromaticity coords {},{} {},{} {},{} {},{}", parsed.chromaticityCoords->red.x, parsed.chromaticityCoords->red.y, - parsed.chromaticityCoords->green.x, parsed.chromaticityCoords->green.y, parsed.chromaticityCoords->blue.x, -- parsed.chromaticityCoords->blue.y, parsed.chromaticityCoords->white.y, parsed.chromaticityCoords->white.y))); -+ parsed.chromaticityCoords->blue.y, parsed.chromaticityCoords->white.x, parsed.chromaticityCoords->white.y))); - } - - const auto* hdr_static_metadata = di_info_get_hdr_static_metadata(info); -@@ -2271,6 +2272,7 @@ void Aquamarine::SDRMConnector::applyCommit(SDRMConnectorCommitData& data) { - auto bk = backend.lock(); - if (bk) { - bk->backend->log(AQ_LOG_DEBUG, std::format("drm: Connector {} enabledState changed {} -> {}", szName, wasEnabled, output->enabledState)); -+ bk->recheckCRTCs(); - auto weak = bk->self; - bk->backend->addIdleEvent(makeShared>([weak] { - auto b = weak.lock(); -@@ -2375,8 +2377,6 @@ bool Aquamarine::CDRMOutput::commit() { - const auto QUEUE_KEY = connector->crtc->id; - if (pendingAsyncCommit) - backend->cancelAsyncOutput(this, true); -- if (pendingAsyncCommit) -- return false; - if (!backend->pauseCommitQueue(QUEUE_KEY)) - return false; - CScopeGuard resume([this, QUEUE_KEY] { backend->resumeCommitQueue(QUEUE_KEY); }); -@@ -2562,9 +2562,11 @@ bool Aquamarine::CDRMOutput::commitState(bool onlyTest) { +@@ -2562,9 +2563,11 @@ bool Aquamarine::CDRMOutput::commitState(bool onlyTest) { if (COMMITTED & COutputState::eOutputStateProperties::AQ_OUTPUT_STATE_FORMAT) { // verify the format is valid for the primary plane @@ -155,7 +71,7 @@ index 754e9c4..a42bd8f 100644 ok = true; break; } -@@ -2784,7 +2786,8 @@ bool Aquamarine::CDRMOutput::commitState(bool onlyTest) { +@@ -2784,7 +2787,8 @@ bool Aquamarine::CDRMOutput::commitState(bool onlyTest) { // sometimes, our consumer could f up the swapchain format and change it without the state changing bool formatMismatch = false; if (data.mainFB) { @@ -165,7 +81,7 @@ index 754e9c4..a42bd8f 100644 // formats mismatch. Update the state format and roll with it backend->backend->log(AQ_LOG_WARNING, std::format("drm: Formats mismatch in commit, buffer is {} but output is set to {}. Modesetting to {}", fourccToName(params.format), -@@ -3184,7 +3187,7 @@ Aquamarine::IOutput::SCommitSubmission Aquamarine::CDRMOutput::commitAsync(const +@@ -3184,7 +3188,7 @@ Aquamarine::IOutput::SCommitSubmission Aquamarine::CDRMOutput::commitAsync(const const auto MAIN_BUFFER = data.mainFB ? data.mainFB->buffer.lock() : nullptr; const auto ATTRS = MAIN_BUFFER ? MAIN_BUFFER->dmabuf() : SDMABUFAttrs{}; diff --git a/pkgbuilds/aquamarine/PKGBUILD b/pkgbuilds/aquamarine/PKGBUILD index 3643a4e451..5cf42ce34c 100644 --- a/pkgbuilds/aquamarine/PKGBUILD +++ b/pkgbuilds/aquamarine/PKGBUILD @@ -48,7 +48,7 @@ source=("$url/archive/v$pkgver/$_archive.tar.gz" sha256sums=('42339c3096c9de6582c0d71bc86b7e63334a3faf6a2b917d385ad093caf66c3c' '50e9e38ff915b18074dc9b5dd1d07d7f24e340e99f254476d6abe578eece7864' '7fe7620c222d9f323b6a424301b98176f798f41a97945282ec71b361e742511a' - '1c26dd24864bf979901f640be92540a1c922cc9bcdd069502f5a441614ba24b7') + 'c1a7f2025c0ee7e2d303141dad134fdc26b270d456549174611d69df3232d1cc') prepare() { cd "$_archive" From e285c152df92d523bf006c8c18052f18809ef753 Mon Sep 17 00:00:00 2001 From: Joshua Warren <816217+joshuaswarren@users.noreply.github.com> Date: Sun, 15 Nov 2026 04:28:45 -0600 Subject: [PATCH 6/6] aquamarine: header comment names 10 bpc too --- pkgbuilds/aquamarine/PKGBUILD | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgbuilds/aquamarine/PKGBUILD b/pkgbuilds/aquamarine/PKGBUILD index 5cf42ce34c..02c74fee29 100644 --- a/pkgbuilds/aquamarine/PKGBUILD +++ b/pkgbuilds/aquamarine/PKGBUILD @@ -8,10 +8,10 @@ # - reconnect an output whose connector gained modes after it connected, so a # monitor behind a USB4 dock that wakes slowly is not left without a mode # (NVIDIA N1x); -# - allocate the alpha variant of an 8 bpc format when the scanout plane -# offers only the alpha variant, so compositors that ask for XRGB8888 -# start on panels without the opaque formats (M5 Max internal panel; -# hyprwm/aquamarine#496). +# - allocate the alpha variant of an 8 or 10 bpc format when the scanout +# plane offers only the alpha variant, so compositors that ask for XRGB8888 +# or XRGB2101010 start on panels without the opaque formats (M5 Max +# internal panel; hyprwm/aquamarine#496). # hyprwm's fixes fc77bd58 and 04bfb7db, carried with 0.15.1, ship in 0.16.0. # Drop each carry once hyprwm releases the fix.