Subject: [PATCH 08/24] wip: resolve exact tiled atomic modesets

From: Justin Youens <[email-masked]>
Date: Sat, 15 Aug 2026 09:00:35 -0500

---
 CMakeLists.txt                  |   2 +
 src/backend/drm/TiledAtomic.cpp | 414 ++++++++++++++++++++++++++++
 src/backend/drm/TiledAtomic.hpp | 243 +++++++++++++++++
 tests/TiledAtomic.cpp           | 463 ++++++++++++++++++++++++++++++++
 tests/TiledVisibility.cmake     |   2 +-
 5 files changed, 1123 insertions(+), 1 deletion(-)
 create mode 100644 src/backend/drm/TiledAtomic.cpp
 create mode 100644 src/backend/drm/TiledAtomic.hpp
 create mode 100644 tests/TiledAtomic.cpp

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4ed2cf1f69da2d97da20689c29f6735ab7592f12..41757bdf3052c70e04a70fb363740b44fdb7477e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -70,6 +70,7 @@ set(AQUAMARINE_TILED_PRIVATE_SOURCES
     "${CMAKE_CURRENT_SOURCE_DIR}/src/backend/drm/TiledBackendState.cpp"
     "${CMAKE_CURRENT_SOURCE_DIR}/src/backend/drm/TiledCrtcAllocator.cpp"
     "${CMAKE_CURRENT_SOURCE_DIR}/src/backend/drm/TiledDRMIntegration.cpp"
+    "${CMAKE_CURRENT_SOURCE_DIR}/src/backend/drm/TiledAtomic.cpp"
     "${CMAKE_CURRENT_SOURCE_DIR}/src/backend/drm/TiledOutputBridge.cpp"
     "${CMAKE_CURRENT_SOURCE_DIR}/src/backend/drm/TiledRuntime.cpp")
 list(REMOVE_ITEM SRCFILES ${AQUAMARINE_TILED_PRIVATE_SOURCES})
@@ -210,6 +211,7 @@ addTiledPrivateTest(tiledDRMIntegration "tests/TiledDRMIntegration.cpp")
 addTiledPrivateTest(planeFormats "tests/PlaneFormats.cpp")
 addTiledPrivateTest(planeViewport "tests/PlaneViewport.cpp")
 addTiledPrivateTest(tiledCrtcAllocator "tests/TiledCrtcAllocator.cpp")
+addTiledPrivateTest(tiledAtomic "tests/TiledAtomic.cpp")
 addTiledPrivateTest(tiledOutputBridge "tests/TiledOutputBridge.cpp")
 addTiledPrivateTest(atomicSubmit "tests/AtomicSubmit.cpp")
 addTiledPrivateTest(pageFlipBarrier "tests/PageFlipBarrier.cpp")
diff --git a/src/backend/drm/TiledAtomic.cpp b/src/backend/drm/TiledAtomic.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..1e6ead823ff2e5777cb153a66f8d3c4c2de70ce9
--- /dev/null
+++ b/src/backend/drm/TiledAtomic.cpp
@@ -0,0 +1,414 @@
+#include "TiledAtomic.hpp"
+
+#include <algorithm>
+#include <array>
+#include <ranges>
+#include <tuple>
+#include <utility>
+
+#include <drm_fourcc.h>
+#include <drm_mode.h>
+
+using namespace Aquamarine;
+using namespace Aquamarine::NDRM;
+using namespace Aquamarine::NDRM::NTiledAtomic;
+using namespace Aquamarine::NDRM::NTiledCrtcAllocator;
+using namespace Aquamarine::NDRM::NTiledOutputBridge;
+using Hyprutils::Memory::CSharedPointer;
+
+namespace {
+    template <typename T, typename U>
+    [[nodiscard]] bool sameOwner(const CSharedPointer<T>& lhs, const CSharedPointer<U>& rhs) noexcept {
+        return lhs.impl_ != nullptr && lhs.impl_ == rhs.impl_;
+    }
+
+    template <size_t N>
+    [[nodiscard]] bool uniqueRequired(std::array<uint32_t, N> properties) {
+        if (std::ranges::find(properties, 0U) != properties.end())
+            return false;
+        std::ranges::sort(properties);
+        return std::ranges::adjacent_find(properties) == properties.end();
+    }
+
+    [[nodiscard]] bool formatSupported(const SDRMPlane& plane, const STiledAtomicFramebuffer& framebuffer) {
+        const auto FORMAT = std::ranges::find(plane.formats, framebuffer.format, &SDRMFormat::drmFormat);
+        return FORMAT != plane.formats.end() && std::ranges::contains(FORMAT->modifiers, framebuffer.modifier);
+    }
+
+    [[nodiscard]] bool validIncarnation(const CSharedPointer<const SResourceIncarnation>& incarnation, eResourceKind kind, uint32_t resourceId, uint64_t allocationEpoch,
+                                        const NTiledScan::PScanObservation& observation) noexcept {
+        return incarnation && incarnation->kind() == kind && incarnation->resourceID() == resourceId && incarnation->allocationEpoch() == allocationEpoch &&
+            sameOwner(incarnation->observation(), observation);
+    }
+
+    [[nodiscard]] const CBinding* exactBinding(const CGroupAllocation& allocation, const NTiling::STileGroupMember& member) {
+        const CBinding* result = nullptr;
+        for (const auto& BINDING : allocation.bindings()) {
+            if (!BINDING.connector() || BINDING.connector()->id != member.connectorId)
+                continue;
+            if (result)
+                return nullptr;
+            result = &BINDING;
+        }
+        return result;
+    }
+
+    [[nodiscard]] const NTiling::STilePhysicalMode* exactPhysicalMode(const NTiling::STileModeMap& mapping, uint32_t connectorId) {
+        const NTiling::STilePhysicalMode* result = nullptr;
+        for (const auto& PHYSICAL : mapping.members) {
+            if (PHYSICAL.connectorId != connectorId)
+                continue;
+            if (result)
+                return nullptr;
+            result = &PHYSICAL;
+        }
+        return result;
+    }
+
+    void cleanupRequest(const CSharedPointer<ITiledAtomicRequestOperations>& operations, int drmFD, drmModeAtomicReqPtr& request, std::vector<uint32_t>& modeBlobs) noexcept {
+        if (request && operations)
+            operations->freeRequest(request);
+        request = nullptr;
+        if (operations && drmFD >= 0) {
+            for (auto BLOB = modeBlobs.rbegin(); BLOB != modeBlobs.rend(); ++BLOB) {
+                if (*BLOB != 0)
+                    static_cast<void>(operations->destroyModeBlob(drmFD, *BLOB));
+            }
+        }
+        modeBlobs.clear();
+    }
+
+    struct SBuildResources {
+        CSharedPointer<ITiledAtomicRequestOperations> operations;
+        int                                           drmFD   = -1;
+        drmModeAtomicReqPtr                           request = nullptr;
+        std::vector<uint32_t>                         modeBlobs;
+
+        ~SBuildResources() noexcept {
+            cleanupRequest(operations, drmFD, request, modeBlobs);
+        }
+    };
+
+    [[nodiscard]] bool addProperty(const CSharedPointer<ITiledAtomicRequestOperations>& operations, drmModeAtomicReqPtr request, uint32_t objectId, uint32_t propertyId,
+                                   uint64_t value) noexcept {
+        return operations->addProperty(request, objectId, propertyId, value) >= 0;
+    }
+
+    [[nodiscard]] bool addMember(const CSharedPointer<ITiledAtomicRequestOperations>& operations, drmModeAtomicReqPtr request, const STiledAtomicMember& member,
+                                 uint32_t framebufferId, uint32_t modeBlobId) noexcept {
+        const auto& CONNECTOR = member.connectorProperties;
+        const auto& CRTC      = member.crtcProperties;
+        const auto& PLANE     = member.planeProperties;
+        const auto& VIEWPORT  = member.viewport;
+
+        if (!addProperty(operations, request, member.connectorId, CONNECTOR.crtcId, member.crtcId))
+            return false;
+        if (CONNECTOR.linkStatus != 0 && !addProperty(operations, request, member.connectorId, CONNECTOR.linkStatus, DRM_MODE_LINK_STATUS_GOOD))
+            return false;
+        return addProperty(operations, request, member.crtcId, CRTC.modeId, modeBlobId) && addProperty(operations, request, member.crtcId, CRTC.active, 1) &&
+            addProperty(operations, request, member.primaryPlaneId, PLANE.fbId, framebufferId) &&
+            addProperty(operations, request, member.primaryPlaneId, PLANE.crtcId, member.crtcId) &&
+            addProperty(operations, request, member.primaryPlaneId, PLANE.srcX, VIEWPORT.srcX) &&
+            addProperty(operations, request, member.primaryPlaneId, PLANE.srcY, VIEWPORT.srcY) &&
+            addProperty(operations, request, member.primaryPlaneId, PLANE.srcW, VIEWPORT.srcW) &&
+            addProperty(operations, request, member.primaryPlaneId, PLANE.srcH, VIEWPORT.srcH) &&
+            addProperty(operations, request, member.primaryPlaneId, PLANE.crtcX, static_cast<uint64_t>(static_cast<int64_t>(VIEWPORT.crtcX))) &&
+            addProperty(operations, request, member.primaryPlaneId, PLANE.crtcY, static_cast<uint64_t>(static_cast<int64_t>(VIEWPORT.crtcY))) &&
+            addProperty(operations, request, member.primaryPlaneId, PLANE.crtcW, VIEWPORT.crtcW) &&
+            addProperty(operations, request, member.primaryPlaneId, PLANE.crtcH, VIEWPORT.crtcH);
+    }
+}
+
+namespace Aquamarine::NDRM::NTiledAtomic {
+    struct SRouteAssembler {
+        static PResolvedTiledAtomicRoute create(POutputBridgeObservation generationOwner, PScanGroupDefinition groupDefinition,
+                                                CSharedPointer<const CGroupDefinition> allocationDefinition, POutputDefinitionIdentity definitionIdentity,
+                                                CSharedPointer<const CModeSet> modeSet, CSharedPointer<SOutputMode> outputMode, STiledAtomicFramebuffer framebuffer,
+                                                uint64_t generation, uint32_t primaryCrtcId, std::vector<uint32_t> crtcIds, std::vector<STiledAtomicMember> members) {
+            CSharedPointer<CResolvedTiledAtomicRoute> route{new CResolvedTiledAtomicRoute{std::move(generationOwner), std::move(groupDefinition), std::move(allocationDefinition),
+                                                                                          std::move(definitionIdentity), std::move(modeSet), std::move(outputMode), framebuffer,
+                                                                                          generation, primaryCrtcId, std::move(crtcIds), std::move(members)}};
+            return route;
+        }
+    };
+
+    struct SRequestAssembler {
+        static PPreparedTiledTestModeset create(PResolvedTiledAtomicRoute route, CSharedPointer<ITiledAtomicRequestOperations> operations, int drmFD, drmModeAtomicReqPtr request,
+                                                std::vector<uint32_t> modeBlobs) {
+            CSharedPointer<CPreparedTiledTestModeset> prepared{new CPreparedTiledTestModeset{std::move(route), std::move(operations), drmFD, request, std::move(modeBlobs)}};
+            return prepared;
+        }
+    };
+}
+
+CResolvedTiledAtomicRoute::CResolvedTiledAtomicRoute(POutputBridgeObservation generationOwner, PScanGroupDefinition groupDefinition,
+                                                     CSharedPointer<const CGroupDefinition> allocationDefinition, POutputDefinitionIdentity definitionIdentity,
+                                                     CSharedPointer<const CModeSet> modeSet, CSharedPointer<SOutputMode> outputMode, STiledAtomicFramebuffer framebuffer,
+                                                     uint64_t generation, uint32_t primaryCrtcId, std::vector<uint32_t> crtcIds, std::vector<STiledAtomicMember> members) :
+    m_generationOwner(std::move(generationOwner)), m_groupDefinition(std::move(groupDefinition)), m_allocationDefinition(std::move(allocationDefinition)),
+    m_definitionIdentity(std::move(definitionIdentity)), m_modeSet(std::move(modeSet)), m_outputMode(std::move(outputMode)), m_framebuffer(framebuffer), m_generation(generation),
+    m_primaryCrtcId(primaryCrtcId), m_crtcIds(std::move(crtcIds)), m_members(std::move(members)) {}
+
+const POutputBridgeObservation& CResolvedTiledAtomicRoute::generationOwner() const noexcept {
+    return m_generationOwner;
+}
+
+const PScanGroupDefinition& CResolvedTiledAtomicRoute::groupDefinition() const noexcept {
+    return m_groupDefinition;
+}
+
+const CSharedPointer<const CGroupDefinition>& CResolvedTiledAtomicRoute::allocationDefinition() const noexcept {
+    return m_allocationDefinition;
+}
+
+const POutputDefinitionIdentity& CResolvedTiledAtomicRoute::definitionIdentity() const noexcept {
+    return m_definitionIdentity;
+}
+
+const CSharedPointer<const CModeSet>& CResolvedTiledAtomicRoute::modeSet() const noexcept {
+    return m_modeSet;
+}
+
+const CSharedPointer<SOutputMode>& CResolvedTiledAtomicRoute::outputMode() const noexcept {
+    return m_outputMode;
+}
+
+const STiledAtomicFramebuffer& CResolvedTiledAtomicRoute::framebuffer() const noexcept {
+    return m_framebuffer;
+}
+
+uint64_t CResolvedTiledAtomicRoute::generation() const noexcept {
+    return m_generation;
+}
+
+uint32_t CResolvedTiledAtomicRoute::primaryCrtcId() const noexcept {
+    return m_primaryCrtcId;
+}
+
+std::span<const uint32_t> CResolvedTiledAtomicRoute::crtcIds() const noexcept {
+    return m_crtcIds;
+}
+
+std::span<const STiledAtomicMember> CResolvedTiledAtomicRoute::members() const noexcept {
+    return m_members;
+}
+
+STiledAtomicResolveResult::operator bool() const noexcept {
+    return error == eTiledAtomicError::NONE && route;
+}
+
+STiledAtomicResolveResult Aquamarine::NDRM::NTiledAtomic::resolveCapturedTiledAtomic(const STiledAtomicResolveInput& input) noexcept {
+    try {
+        if (!input.generationOwner || !input.groupDefinition || !input.definitionIdentity || !input.outputMode)
+            return {.error = eTiledAtomicError::INVALID_INPUT};
+        const auto& OBSERVATION            = input.generationOwner;
+        const auto& SNAPSHOT               = OBSERVATION->capturedSnapshot();
+        const auto& PLAN                   = OBSERVATION->capturedPlan();
+        const auto& ALLOCATION_OBSERVATION = OBSERVATION->capturedAllocationObservation();
+        if (!SNAPSHOT || !PLAN || !ALLOCATION_OBSERVATION || !SNAPSHOT->observation())
+            return {.error = eTiledAtomicError::INVALID_INPUT};
+        const uint64_t GENERATION = SNAPSHOT->allocationEpoch();
+        if (GENERATION == 0 || ALLOCATION_OBSERVATION->epoch().allocation != GENERATION)
+            return {.error = eTiledAtomicError::INVALID_GENERATION};
+
+        const auto* GROUP = OBSERVATION->findGroup(input.groupDefinition);
+        if (!GROUP)
+            return {.error = eTiledAtomicError::FOREIGN_GROUP};
+        if (GROUP->projection() != eGroupProjection::MULTI_STREAM_ALLOCATED)
+            return {.error = eTiledAtomicError::NOT_ALLOCATED};
+        if (!sameOwner(GROUP->definitionIdentity(), input.definitionIdentity))
+            return {.error = eTiledAtomicError::FOREIGN_DEFINITION_IDENTITY};
+        const auto& MODE_SET   = GROUP->modeSet();
+        const auto  ALLOCATION = GROUP->allocation();
+        if (!MODE_SET || !GROUP->allocationDefinition() || !ALLOCATION || ALLOCATION->get().status() != eGroupStatus::ALLOCATED ||
+            !sameOwner(ALLOCATION->get().definition(), GROUP->allocationDefinition()) || !sameOwner(GROUP->allocationDefinition()->scanDefinition(), input.groupDefinition) ||
+            !sameOwner(MODE_SET->definition(), GROUP->modeDefinition()) || !sameOwner(MODE_SET->definition()->definition(), input.groupDefinition))
+            return {.error = eTiledAtomicError::ALLOCATION_MISMATCH};
+
+        const auto* LOGICAL = MODE_SET->logicalModeFor(input.outputMode);
+        const auto* MAPPING = MODE_SET->physicalMappingFor(input.outputMode);
+        if (!LOGICAL || !MAPPING || LOGICAL->id == 0 || MAPPING->logicalModeId != LOGICAL->id || input.outputMode->modeInfo.has_value() ||
+            input.outputMode->pixelSize.x != static_cast<double>(LOGICAL->width) || input.outputMode->pixelSize.y != static_cast<double>(LOGICAL->height) ||
+            input.outputMode->refreshRate != LOGICAL->refreshRate || input.outputMode->preferred != LOGICAL->preferred)
+            return {.error = eTiledAtomicError::MODE_MAPPING_MISMATCH};
+        if (input.framebuffer.id == 0 || input.framebuffer.format == DRM_FORMAT_INVALID || input.framebuffer.size.width != LOGICAL->width ||
+            input.framebuffer.size.height != LOGICAL->height)
+            return {.error = eTiledAtomicError::FRAMEBUFFER_MISMATCH};
+
+        const auto& TOPOLOGY  = input.groupDefinition->group();
+        const auto& ALLOCATED = ALLOCATION->get();
+        if (TOPOLOGY.kind != NTiling::eTileGroupKind::MULTI_STREAM || TOPOLOGY.primaryConnector == 0 || TOPOLOGY.members.empty() ||
+            ALLOCATED.bindings().size() != TOPOLOGY.members.size() || MAPPING->members.size() != TOPOLOGY.members.size())
+            return {.error = eTiledAtomicError::ALLOCATION_MISMATCH};
+
+        std::vector<STiledAtomicMember> members;
+        std::vector<uint32_t>           crtcIds;
+        std::vector<uint32_t>           objectIds;
+        members.reserve(TOPOLOGY.members.size());
+        crtcIds.reserve(TOPOLOGY.members.size());
+        objectIds.reserve(TOPOLOGY.members.size() * 3U);
+        uint32_t primaryCrtcId = 0;
+
+        for (const auto& MEMBER : TOPOLOGY.members) {
+            const auto* BINDING  = exactBinding(ALLOCATED, MEMBER);
+            const auto* PHYSICAL = exactPhysicalMode(*MAPPING, MEMBER.connectorId);
+            if (!BINDING || !PHYSICAL || !BINDING->tiled() || !sameOwner(BINDING->definition(), GROUP->allocationDefinition()) || BINDING->tileX() != MEMBER.tileHLoc ||
+                BINDING->tileY() != MEMBER.tileVLoc || !BINDING->connector() || !BINDING->crtc() || !BINDING->primaryPlane())
+                return {.error = eTiledAtomicError::ALLOCATION_MISMATCH};
+
+            const auto& CONNECTOR = BINDING->connector();
+            const auto& CRTC      = BINDING->crtc();
+            const auto& PLANE     = BINDING->primaryPlane();
+            if (CONNECTOR->id != MEMBER.connectorId || CRTC->id == 0 || PLANE->id == 0 ||
+                !validIncarnation(BINDING->connectorIncarnation(), eResourceKind::CONNECTOR, CONNECTOR->id, GENERATION, SNAPSHOT->observation()) ||
+                !validIncarnation(BINDING->crtcIncarnation(), eResourceKind::CRTC, CRTC->id, GENERATION, SNAPSHOT->observation()) ||
+                !validIncarnation(BINDING->primaryPlaneIncarnation(), eResourceKind::PRIMARY_PLANE, PLANE->id, GENERATION, SNAPSHOT->observation()))
+                return {.error = eTiledAtomicError::ALLOCATION_MISMATCH};
+            if (PHYSICAL->modeInfo.hdisplay != MEMBER.width || PHYSICAL->modeInfo.vdisplay != MEMBER.height)
+                return {.error = eTiledAtomicError::MODE_MAPPING_MISMATCH};
+            if (!formatSupported(*PLANE, input.framebuffer))
+                return {.error = eTiledAtomicError::FRAMEBUFFER_MISMATCH};
+
+            const auto& CONNECTOR_PROPERTIES = CONNECTOR->props.values;
+            const auto& CRTC_PROPERTIES      = CRTC->props.values;
+            const auto& PLANE_PROPERTIES     = PLANE->props.values;
+            if (CONNECTOR_PROPERTIES.crtc_id == 0 || (CONNECTOR_PROPERTIES.link_status != 0 && CONNECTOR_PROPERTIES.link_status == CONNECTOR_PROPERTIES.crtc_id) ||
+                !uniqueRequired(std::array{CRTC_PROPERTIES.mode_id, CRTC_PROPERTIES.active}) ||
+                !uniqueRequired(std::array{PLANE_PROPERTIES.fb_id, PLANE_PROPERTIES.crtc_id, PLANE_PROPERTIES.src_x, PLANE_PROPERTIES.src_y, PLANE_PROPERTIES.src_w,
+                                           PLANE_PROPERTIES.src_h, PLANE_PROPERTIES.crtc_x, PLANE_PROPERTIES.crtc_y, PLANE_PROPERTIES.crtc_w, PLANE_PROPERTIES.crtc_h}))
+                return {.error = eTiledAtomicError::MISSING_REQUIRED_PROPERTY};
+
+            objectIds.push_back(CONNECTOR->id);
+            objectIds.push_back(CRTC->id);
+            objectIds.push_back(PLANE->id);
+
+            const auto VIEWPORT = encodePlaneViewport(input.framebuffer.size,
+                                                      {
+                                                          .source      = {.x = MEMBER.x, .y = MEMBER.y, .width = MEMBER.width, .height = MEMBER.height},
+                                                          .destination = {.x = 0, .y = 0, .width = MEMBER.width, .height = MEMBER.height},
+                                                      });
+            if (!VIEWPORT)
+                return {.error = eTiledAtomicError::FRAMEBUFFER_MISMATCH};
+
+            members.push_back({
+                .connector               = CONNECTOR,
+                .connectorIncarnation    = BINDING->connectorIncarnation(),
+                .crtc                    = CRTC,
+                .crtcIncarnation         = BINDING->crtcIncarnation(),
+                .primaryPlane            = PLANE,
+                .primaryPlaneIncarnation = BINDING->primaryPlaneIncarnation(),
+                .layout                  = MEMBER,
+                .physicalMode            = PHYSICAL->modeInfo,
+                .viewport                = VIEWPORT.values,
+                .connectorId             = CONNECTOR->id,
+                .crtcId                  = CRTC->id,
+                .primaryPlaneId          = PLANE->id,
+                .connectorProperties     = {.crtcId = CONNECTOR_PROPERTIES.crtc_id, .linkStatus = CONNECTOR_PROPERTIES.link_status},
+                .crtcProperties          = {.modeId = CRTC_PROPERTIES.mode_id, .active = CRTC_PROPERTIES.active},
+                .planeProperties =
+                    {
+                        .fbId   = PLANE_PROPERTIES.fb_id,
+                        .crtcId = PLANE_PROPERTIES.crtc_id,
+                        .srcX   = PLANE_PROPERTIES.src_x,
+                        .srcY   = PLANE_PROPERTIES.src_y,
+                        .srcW   = PLANE_PROPERTIES.src_w,
+                        .srcH   = PLANE_PROPERTIES.src_h,
+                        .crtcX  = PLANE_PROPERTIES.crtc_x,
+                        .crtcY  = PLANE_PROPERTIES.crtc_y,
+                        .crtcW  = PLANE_PROPERTIES.crtc_w,
+                        .crtcH  = PLANE_PROPERTIES.crtc_h,
+                    },
+            });
+            crtcIds.push_back(CRTC->id);
+            if (MEMBER.connectorId == TOPOLOGY.primaryConnector) {
+                if (primaryCrtcId != 0)
+                    return {.error = eTiledAtomicError::ALLOCATION_MISMATCH};
+                primaryCrtcId = CRTC->id;
+            }
+        }
+
+        std::ranges::sort(objectIds);
+        std::ranges::sort(crtcIds);
+        if (primaryCrtcId == 0 || std::ranges::adjacent_find(objectIds) != objectIds.end() || std::ranges::adjacent_find(crtcIds) != crtcIds.end())
+            return {.error = eTiledAtomicError::DUPLICATE_OBJECT_ASSIGNMENT};
+
+        auto route = SRouteAssembler::create(input.generationOwner, input.groupDefinition, GROUP->allocationDefinition(), input.definitionIdentity, MODE_SET, input.outputMode,
+                                             input.framebuffer, GENERATION, primaryCrtcId, std::move(crtcIds), std::move(members));
+        return route ? STiledAtomicResolveResult{.route = std::move(route), .error = eTiledAtomicError::NONE} :
+                       STiledAtomicResolveResult{.error = eTiledAtomicError::ALLOCATION_FAILED};
+    } catch (...) { return {.error = eTiledAtomicError::ALLOCATION_FAILED}; }
+}
+
+CPreparedTiledTestModeset::CPreparedTiledTestModeset(PResolvedTiledAtomicRoute route, CSharedPointer<ITiledAtomicRequestOperations> operations, int drmFD,
+                                                     drmModeAtomicReqPtr request, std::vector<uint32_t> modeBlobs) noexcept :
+    m_route(std::move(route)), m_operations(std::move(operations)), m_drmFD(drmFD), m_request(request), m_modeBlobs(std::move(modeBlobs)) {}
+
+CPreparedTiledTestModeset::~CPreparedTiledTestModeset() noexcept {
+    cleanupRequest(m_operations, m_drmFD, m_request, m_modeBlobs);
+}
+
+const PResolvedTiledAtomicRoute& CPreparedTiledTestModeset::route() const noexcept {
+    return m_route;
+}
+
+drmModeAtomicReqPtr CPreparedTiledTestModeset::request() const noexcept {
+    return m_request;
+}
+
+uint32_t CPreparedTiledTestModeset::flags() const noexcept {
+    return DRM_MODE_ATOMIC_ALLOW_MODESET | DRM_MODE_ATOMIC_TEST_ONLY;
+}
+
+uintptr_t CPreparedTiledTestModeset::userData() const noexcept {
+    return 0;
+}
+
+std::span<const uint32_t> CPreparedTiledTestModeset::modeBlobs() const noexcept {
+    return m_modeBlobs;
+}
+
+STiledAtomicBuildResult::operator bool() const noexcept {
+    return error == eTiledAtomicError::NONE && prepared;
+}
+
+STiledAtomicBuildResult Aquamarine::NDRM::NTiledAtomic::buildTiledTestModeset(const PResolvedTiledAtomicRoute& route, int drmFD,
+                                                                              const CSharedPointer<ITiledAtomicRequestOperations>& operations) noexcept {
+    if (!route)
+        return {.error = eTiledAtomicError::INVALID_INPUT};
+    if (!operations || drmFD < 0)
+        return {.error = eTiledAtomicError::INVALID_OPERATIONS};
+
+    try {
+        SBuildResources resources{.operations = operations, .drmFD = drmFD, .request = operations->allocateRequest()};
+        if (!resources.request)
+            return {.error = eTiledAtomicError::REQUEST_ALLOCATION_FAILED};
+        resources.modeBlobs.reserve(route->members().size());
+
+        for (const auto& MEMBER : route->members()) {
+            uint32_t  blobId = 0;
+            const int result = operations->createModeBlob(drmFD, MEMBER.physicalMode, &blobId);
+            if (blobId != 0) {
+                // One numeric blob ID has one cleanup owner. A broken provider
+                // returning the same nonzero ID twice is rejected without
+                // scheduling a second destroy for that same kernel object.
+                if (std::ranges::contains(resources.modeBlobs, blobId))
+                    return {.error = eTiledAtomicError::MODE_BLOB_FAILED};
+                resources.modeBlobs.push_back(blobId);
+            }
+            if (result != 0 || blobId == 0)
+                return {.error = eTiledAtomicError::MODE_BLOB_FAILED};
+        }
+
+        for (size_t index = 0; index < route->members().size(); ++index) {
+            if (!addMember(operations, resources.request, route->members().subspan(index, 1).front(), route->framebuffer().id, resources.modeBlobs.at(index)))
+                return {.error = eTiledAtomicError::PROPERTY_ADD_FAILED};
+        }
+
+        auto prepared = SRequestAssembler::create(route, operations, drmFD, resources.request, resources.modeBlobs);
+        if (!prepared)
+            return {.error = eTiledAtomicError::ALLOCATION_FAILED};
+        resources.request = nullptr;
+        resources.modeBlobs.clear();
+        return {.prepared = std::move(prepared), .error = eTiledAtomicError::NONE};
+    } catch (...) { return {.error = eTiledAtomicError::ALLOCATION_FAILED}; }
+}
diff --git a/src/backend/drm/TiledAtomic.hpp b/src/backend/drm/TiledAtomic.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..afe5914b367c67208fb3eb6a7e30e6bea69abf31
--- /dev/null
+++ b/src/backend/drm/TiledAtomic.hpp
@@ -0,0 +1,243 @@
+#pragma once
+
+#include "PlaneViewport.hpp"
+#include "TiledRuntime.hpp"
+
+#include <cstdint>
+#include <span>
+#include <vector>
+
+#include <hyprutils/memory/SharedPtr.hpp>
+#include <xf86drmMode.h>
+
+#ifdef __GNUC__
+#define AQ_TILED_ATOMIC_PRIVATE __attribute__((visibility("hidden")))
+#else
+#define AQ_TILED_ATOMIC_PRIVATE
+#endif
+
+namespace Aquamarine::NDRM::NTiledAtomic { // NOLINT(readability-identifier-naming): established Aquamarine DRM namespace
+    using Hyprutils::Memory::CSharedPointer;
+    using NTiledCrtcAllocator::CGroupDefinition;
+    using NTiledCrtcAllocator::SResourceIncarnation;
+    using NTiledOutputBridge::CModeSet;
+    using NTiledOutputBridge::POutputBridgeObservation;
+    using NTiledOutputBridge::POutputDefinitionIdentity;
+    using NTiledScan::PScanGroupDefinition;
+
+    enum class eTiledAtomicError : uint8_t {
+        NONE = 0,
+        INVALID_INPUT,
+        FOREIGN_GROUP,
+        NOT_ALLOCATED,
+        FOREIGN_DEFINITION_IDENTITY,
+        MODE_MAPPING_MISMATCH,
+        ALLOCATION_MISMATCH,
+        INVALID_GENERATION,
+        FRAMEBUFFER_MISMATCH,
+        MISSING_REQUIRED_PROPERTY,
+        DUPLICATE_OBJECT_ASSIGNMENT,
+        ALLOCATION_FAILED,
+        INVALID_OPERATIONS,
+        REQUEST_ALLOCATION_FAILED,
+        MODE_BLOB_FAILED,
+        PROPERTY_ADD_FAILED,
+    };
+
+    struct AQ_TILED_ATOMIC_PRIVATE STiledAtomicFramebuffer {
+        uint32_t              id = 0;
+        SPlaneFramebufferSize size;
+        uint32_t              format   = 0;
+        uint64_t              modifier = 0;
+
+        bool                  operator==(const STiledAtomicFramebuffer&) const = default;
+    };
+
+    struct AQ_TILED_ATOMIC_PRIVATE STiledAtomicConnectorProperties {
+        uint32_t crtcId     = 0;
+        uint32_t linkStatus = 0;
+
+        bool     operator==(const STiledAtomicConnectorProperties&) const = default;
+    };
+
+    struct AQ_TILED_ATOMIC_PRIVATE STiledAtomicCrtcProperties {
+        uint32_t modeId = 0;
+        uint32_t active = 0;
+
+        bool     operator==(const STiledAtomicCrtcProperties&) const = default;
+    };
+
+    struct AQ_TILED_ATOMIC_PRIVATE STiledAtomicPlaneProperties {
+        uint32_t fbId   = 0;
+        uint32_t crtcId = 0;
+        uint32_t srcX   = 0;
+        uint32_t srcY   = 0;
+        uint32_t srcW   = 0;
+        uint32_t srcH   = 0;
+        uint32_t crtcX  = 0;
+        uint32_t crtcY  = 0;
+        uint32_t crtcW  = 0;
+        uint32_t crtcH  = 0;
+
+        bool     operator==(const STiledAtomicPlaneProperties&) const = default;
+    };
+
+    // Frozen request material derived only from one exact allocator binding.
+    // The retained incarnations and bridge observation remain the authority;
+    // copied IDs, geometry, properties, and mode bytes are emission snapshots.
+    struct AQ_TILED_ATOMIC_PRIVATE STiledAtomicMember {
+        CSharedPointer<SDRMConnector>              connector;
+        CSharedPointer<const SResourceIncarnation> connectorIncarnation;
+        CSharedPointer<SDRMCRTC>                   crtc;
+        CSharedPointer<const SResourceIncarnation> crtcIncarnation;
+        CSharedPointer<SDRMPlane>                  primaryPlane;
+        CSharedPointer<const SResourceIncarnation> primaryPlaneIncarnation;
+        NTiling::STileGroupMember                  layout;
+        drmModeModeInfo                            physicalMode = {};
+        SPlanePropertyValues                       viewport;
+        uint32_t                                   connectorId    = 0;
+        uint32_t                                   crtcId         = 0;
+        uint32_t                                   primaryPlaneId = 0;
+        STiledAtomicConnectorProperties            connectorProperties;
+        STiledAtomicCrtcProperties                 crtcProperties;
+        STiledAtomicPlaneProperties                planeProperties;
+    };
+
+    struct AQ_TILED_ATOMIC_PRIVATE STiledAtomicResolveInput {
+        POutputBridgeObservation    generationOwner;
+        PScanGroupDefinition        groupDefinition;
+        POutputDefinitionIdentity   definitionIdentity;
+        CSharedPointer<SOutputMode> outputMode;
+        STiledAtomicFramebuffer     framebuffer;
+    };
+
+    class CResolvedTiledAtomicRoute;
+    using PResolvedTiledAtomicRoute = CSharedPointer<const CResolvedTiledAtomicRoute>;
+
+    class AQ_TILED_ATOMIC_PRIVATE CResolvedTiledAtomicRoute final {
+      public:
+        CResolvedTiledAtomicRoute(const CResolvedTiledAtomicRoute&)                                             = delete;
+        CResolvedTiledAtomicRoute(CResolvedTiledAtomicRoute&&)                                                  = delete;
+        CResolvedTiledAtomicRoute&                                  operator=(const CResolvedTiledAtomicRoute&) = delete;
+        CResolvedTiledAtomicRoute&                                  operator=(CResolvedTiledAtomicRoute&&)      = delete;
+
+        [[nodiscard]] const POutputBridgeObservation&               generationOwner() const noexcept;
+        [[nodiscard]] const PScanGroupDefinition&                   groupDefinition() const noexcept;
+        [[nodiscard]] const CSharedPointer<const CGroupDefinition>& allocationDefinition() const noexcept;
+        [[nodiscard]] const POutputDefinitionIdentity&              definitionIdentity() const noexcept;
+        [[nodiscard]] const CSharedPointer<const CModeSet>&         modeSet() const noexcept;
+        [[nodiscard]] const CSharedPointer<SOutputMode>&            outputMode() const noexcept;
+        [[nodiscard]] const STiledAtomicFramebuffer&                framebuffer() const noexcept;
+        [[nodiscard]] uint64_t                                      generation() const noexcept;
+        [[nodiscard]] uint32_t                                      primaryCrtcId() const noexcept;
+        [[nodiscard]] std::span<const uint32_t>                     crtcIds() const noexcept;
+        [[nodiscard]] std::span<const STiledAtomicMember>           members() const noexcept;
+
+        template <typename TOwner>
+        [[nodiscard]] STiledRuntimePlan<TOwner> runtimePlan() const {
+            std::vector<STiledRuntimeMemberRoute> memberRoutes;
+            memberRoutes.reserve(m_members.size());
+            for (const auto& MEMBER : m_members) {
+                memberRoutes.push_back({
+                    .connectorId    = MEMBER.connectorId,
+                    .crtcId         = MEMBER.crtcId,
+                    .primaryPlaneId = MEMBER.primaryPlaneId,
+                });
+            }
+            return {
+                .generation         = m_generation,
+                .generationOwner    = m_generationOwner,
+                .definitionIdentity = m_definitionIdentity,
+                .primaryCrtcId      = m_primaryCrtcId,
+                .crtcIds            = m_crtcIds,
+                .memberRoutes       = std::move(memberRoutes),
+            };
+        }
+
+      private:
+        CResolvedTiledAtomicRoute(POutputBridgeObservation generationOwner, PScanGroupDefinition groupDefinition, CSharedPointer<const CGroupDefinition> allocationDefinition,
+                                  POutputDefinitionIdentity definitionIdentity, CSharedPointer<const CModeSet> modeSet, CSharedPointer<SOutputMode> outputMode,
+                                  STiledAtomicFramebuffer framebuffer, uint64_t generation, uint32_t primaryCrtcId, std::vector<uint32_t> crtcIds,
+                                  std::vector<STiledAtomicMember> members);
+
+        POutputBridgeObservation               m_generationOwner;
+        PScanGroupDefinition                   m_groupDefinition;
+        CSharedPointer<const CGroupDefinition> m_allocationDefinition;
+        POutputDefinitionIdentity              m_definitionIdentity;
+        CSharedPointer<const CModeSet>         m_modeSet;
+        CSharedPointer<SOutputMode>            m_outputMode;
+        STiledAtomicFramebuffer                m_framebuffer;
+        uint64_t                               m_generation    = 0;
+        uint32_t                               m_primaryCrtcId = 0;
+        std::vector<uint32_t>                  m_crtcIds;
+        std::vector<STiledAtomicMember>        m_members;
+
+        friend struct SRouteAssembler;
+    };
+
+    struct AQ_TILED_ATOMIC_PRIVATE STiledAtomicResolveResult {
+        PResolvedTiledAtomicRoute route;
+        eTiledAtomicError         error = eTiledAtomicError::INVALID_INPUT;
+
+        explicit                  operator bool() const noexcept;
+    };
+
+    // Captured evidence only. Production mutation must resolve and consume this
+    // synchronously inside the combined registry/bridge current-owner gate.
+    [[nodiscard]] AQ_TILED_ATOMIC_PRIVATE STiledAtomicResolveResult resolveCapturedTiledAtomic(const STiledAtomicResolveInput& input) noexcept;
+
+    // This deliberately lacks any submit operation. The first checkpoint can
+    // construct and inspect a TEST_MODESET request, but cannot issue an ioctl.
+    class AQ_TILED_ATOMIC_PRIVATE ITiledAtomicRequestOperations {
+      public:
+        virtual ~ITiledAtomicRequestOperations() = default;
+
+        virtual drmModeAtomicReqPtr allocateRequest() noexcept                                                                                = 0;
+        virtual void                freeRequest(drmModeAtomicReqPtr request) noexcept                                                         = 0;
+        virtual int                 addProperty(drmModeAtomicReqPtr request, uint32_t objectId, uint32_t propertyId, uint64_t value) noexcept = 0;
+        virtual int                 createModeBlob(int drmFD, const drmModeModeInfo& mode, uint32_t* blobId) noexcept                         = 0;
+        virtual int                 destroyModeBlob(int drmFD, uint32_t blobId) noexcept                                                      = 0;
+    };
+
+    class CPreparedTiledTestModeset;
+    using PPreparedTiledTestModeset = CSharedPointer<const CPreparedTiledTestModeset>;
+
+    class AQ_TILED_ATOMIC_PRIVATE CPreparedTiledTestModeset final {
+      public:
+        CPreparedTiledTestModeset(const CPreparedTiledTestModeset&)            = delete;
+        CPreparedTiledTestModeset(CPreparedTiledTestModeset&&)                 = delete;
+        CPreparedTiledTestModeset& operator=(const CPreparedTiledTestModeset&) = delete;
+        CPreparedTiledTestModeset& operator=(CPreparedTiledTestModeset&&)      = delete;
+        ~CPreparedTiledTestModeset() noexcept;
+
+        [[nodiscard]] const PResolvedTiledAtomicRoute& route() const noexcept;
+        [[nodiscard]] drmModeAtomicReqPtr              request() const noexcept;
+        [[nodiscard]] uint32_t                         flags() const noexcept;
+        [[nodiscard]] uintptr_t                        userData() const noexcept;
+        [[nodiscard]] std::span<const uint32_t>        modeBlobs() const noexcept;
+
+      private:
+        CPreparedTiledTestModeset(PResolvedTiledAtomicRoute route, CSharedPointer<ITiledAtomicRequestOperations> operations, int drmFD, drmModeAtomicReqPtr request,
+                                  std::vector<uint32_t> modeBlobs) noexcept;
+
+        PResolvedTiledAtomicRoute                     m_route;
+        CSharedPointer<ITiledAtomicRequestOperations> m_operations;
+        int                                           m_drmFD   = -1;
+        drmModeAtomicReqPtr                           m_request = nullptr;
+        std::vector<uint32_t>                         m_modeBlobs;
+
+        friend struct SRequestAssembler;
+    };
+
+    struct AQ_TILED_ATOMIC_PRIVATE STiledAtomicBuildResult {
+        PPreparedTiledTestModeset prepared;
+        eTiledAtomicError         error = eTiledAtomicError::INVALID_INPUT;
+
+        explicit                  operator bool() const noexcept;
+    };
+
+    [[nodiscard]] AQ_TILED_ATOMIC_PRIVATE STiledAtomicBuildResult buildTiledTestModeset(const PResolvedTiledAtomicRoute& route, int drmFD,
+                                                                                        const CSharedPointer<ITiledAtomicRequestOperations>& operations) noexcept;
+}
+
+#undef AQ_TILED_ATOMIC_PRIVATE
diff --git a/tests/TiledAtomic.cpp b/tests/TiledAtomic.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..adfffda3f060990c0d34535ebc8690ef8e001668
--- /dev/null
+++ b/tests/TiledAtomic.cpp
@@ -0,0 +1,463 @@
+#include "backend/drm/TiledAtomic.hpp"
+
+#include <algorithm>
+#include <cstdint>
+#include <iostream>
+#include <ranges>
+#include <string_view>
+#include <thread>
+#include <tuple>
+#include <utility>
+#include <vector>
+
+#include <drm_fourcc.h>
+#include <drm_mode.h>
+#include <hyprutils/memory/SharedPtr.hpp>
+
+namespace Aquamarine::NDRM::NTiledScan {
+    // Source-private seam for constructing one coherent immutable scan graph.
+    class CScanFixtureAuthority final {
+      public:
+        static PCommittedScan mint(const PSessionIncarnation& session, std::vector<uint32_t> connectorIds, NTiling::STileGroup group, uint64_t serial) {
+            if (!session || !session->valid() || session->eventThread() != std::this_thread::get_id() || serial == 0)
+                return {};
+            const auto backend = session->backend().lock();
+            if (!backend)
+                return {};
+
+            std::ranges::sort(connectorIds);
+            std::ranges::sort(group.members, [](const auto& lhs, const auto& rhs) {
+                return std::tie(lhs.tileVLoc, lhs.tileHLoc, lhs.connectorId) < std::tie(rhs.tileVLoc, rhs.tileHLoc, rhs.connectorId);
+            });
+
+            const auto                       state       = PStateAuthority{new CStateAuthority{}};
+            const auto                       observation = PScanObservation{new CScanObservation{session, serial, serial}};
+            const auto                       ticket      = PScanAttemptTicket{new CScanAttemptTicket{state, backend, session->device(), session, observation, serial}};
+            std::vector<SConnectorView>      views;
+            std::vector<SCommittedConnector> connectors;
+            for (const auto id : connectorIds) {
+                views.push_back({.connectorId = id});
+                connectors.push_back({.view = {.connectorId = id}, .projection = {.connectorId = id}});
+            }
+            const auto                        attempt = PScanAttempt{new CScanAttempt{ticket, eScanCompleteness::COMPLETE, std::move(views)}};
+
+            const auto                        definition = PScanGroupDefinition{new CScanGroupDefinition{session->device(), session, std::move(group)}};
+            NTiling::STileModeSynthesisResult synthesis;
+            synthesis.modes.push_back({
+                .id          = 1,
+                .width       = definition->group().width,
+                .height      = definition->group().height,
+                .refreshRate = 60000,
+                .preferred   = true,
+                .refresh     = {.numerator = 60, .denominator = 1},
+            });
+            NTiling::STileModeMap mapping{.logicalModeId = 1};
+            for (const auto& MEMBER : definition->group().members) {
+                mapping.members.push_back({
+                    .connectorId = MEMBER.connectorId,
+                    .modeInfo =
+                        {
+                            .clock       = 1000,
+                            .hdisplay    = static_cast<uint16_t>(MEMBER.width),
+                            .hsync_start = static_cast<uint16_t>(MEMBER.width + 1),
+                            .hsync_end   = static_cast<uint16_t>(MEMBER.width + 2),
+                            .htotal      = static_cast<uint16_t>(MEMBER.width + 3),
+                            .vdisplay    = static_cast<uint16_t>(MEMBER.height),
+                            .vsync_start = static_cast<uint16_t>(MEMBER.height + 1),
+                            .vsync_end   = static_cast<uint16_t>(MEMBER.height + 2),
+                            .vtotal      = static_cast<uint16_t>(MEMBER.height + 3),
+                            .vrefresh    = 60,
+                        },
+                });
+            }
+            synthesis.mappings.push_back(std::move(mapping));
+            const auto modes = PScanModeDefinition{new CScanModeDefinition{definition, std::move(synthesis)}};
+
+            for (const auto& MEMBER : definition->group().members) {
+                const auto CONNECTOR = std::ranges::find(connectors, MEMBER.connectorId, [](const auto& candidate) { return candidate.view.connectorId; });
+                if (CONNECTOR == connectors.end())
+                    return {};
+                CONNECTOR->projection.definition = definition;
+                CONNECTOR->projection.modes      = modes;
+                CONNECTOR->projection.role =
+                    MEMBER.connectorId == definition->group().primaryConnector ? eConnectorRole::MULTI_STREAM_PRIMARY : eConnectorRole::MULTI_STREAM_MEMBER;
+            }
+
+            return PCommittedScan{new CCommittedScan{attempt, std::move(connectors), {definition}, {modes}}};
+        }
+    };
+}
+
+using namespace Aquamarine;
+using namespace Aquamarine::NDRM;
+using namespace Aquamarine::NDRM::NTiledAtomic;
+using namespace Aquamarine::NDRM::NTiledCrtcAllocator;
+using namespace Aquamarine::NDRM::NTiledIncarnations;
+using namespace Aquamarine::NDRM::NTiledOutputBridge;
+using namespace Aquamarine::NDRM::NTiledScan;
+using Hyprutils::Memory::CSharedPointer;
+using Hyprutils::Memory::makeShared;
+
+namespace {
+    int  FAILURES = 0;
+
+    void check(bool condition, std::string_view expression, int line) {
+        if (condition)
+            return;
+        std::cerr << __FILE__ << ':' << line << ": check failed: " << expression << '\n';
+        ++FAILURES;
+    }
+
+#define CHECK(condition) check((condition), #condition, __LINE__)
+
+    template <typename T, typename U>
+    bool sameOwner(const CSharedPointer<T>& lhs, const CSharedPointer<U>& rhs) {
+        return lhs.impl_ != nullptr && lhs.impl_ == rhs.impl_;
+    }
+
+    NTiling::STileGroup tiledGroup(uint64_t deviceId) {
+        return {
+            .key              = {.deviceId = deviceId, .groupId = 11},
+            .isSingleMonitor  = true,
+            .numHTile         = 2,
+            .numVTile         = 1,
+            .width            = 200,
+            .height           = 50,
+            .kind             = NTiling::eTileGroupKind::MULTI_STREAM,
+            .primaryConnector = 1,
+            .members =
+                {
+                    {.connectorId = 1, .tileHLoc = 0, .tileVLoc = 0, .x = 0, .y = 0, .width = 100, .height = 50},
+                    {.connectorId = 2, .tileHLoc = 1, .tileVLoc = 0, .x = 100, .y = 0, .width = 100, .height = 50},
+                },
+        };
+    }
+
+    struct SResources {
+        std::vector<CSharedPointer<SDRMConnector>> connectors;
+        std::vector<CSharedPointer<SDRMCRTC>>      crtcs;
+        std::vector<CSharedPointer<SDRMPlane>>     planes;
+
+        SResources() {
+            connectors.reserve(2);
+            crtcs.reserve(2);
+            planes.reserve(2);
+            for (size_t index = 0; index < 2; ++index) {
+                const auto connectorPropertyBase = index * 10;
+                const auto crtcPropertyBase      = index * 10;
+                const auto planePropertyBase     = index * 20;
+
+                auto       connector                = makeShared<SDRMConnector>();
+                connector->id                       = static_cast<uint32_t>(index + 1);
+                connector->props.values.crtc_id     = static_cast<uint32_t>(1000 + connectorPropertyBase);
+                connector->props.values.link_status = static_cast<uint32_t>(1001 + connectorPropertyBase);
+                connectors.push_back(std::move(connector));
+
+                auto crtc                  = makeShared<SDRMCRTC>();
+                crtc->id                   = static_cast<uint32_t>(101 + index);
+                crtc->props.values.mode_id = static_cast<uint32_t>(2000 + crtcPropertyBase);
+                crtc->props.values.active  = static_cast<uint32_t>(2001 + crtcPropertyBase);
+                crtcs.push_back(std::move(crtc));
+
+                auto plane                  = makeShared<SDRMPlane>();
+                plane->id                   = static_cast<uint32_t>(201 + index);
+                plane->type                 = DRM_PLANE_TYPE_PRIMARY;
+                plane->formats              = {{.drmFormat = DRM_FORMAT_XRGB8888, .modifiers = {DRM_FORMAT_MOD_LINEAR}}};
+                plane->props.values.fb_id   = static_cast<uint32_t>(3000 + planePropertyBase);
+                plane->props.values.crtc_id = static_cast<uint32_t>(3001 + planePropertyBase);
+                plane->props.values.src_x   = static_cast<uint32_t>(3002 + planePropertyBase);
+                plane->props.values.src_y   = static_cast<uint32_t>(3003 + planePropertyBase);
+                plane->props.values.src_w   = static_cast<uint32_t>(3004 + planePropertyBase);
+                plane->props.values.src_h   = static_cast<uint32_t>(3005 + planePropertyBase);
+                plane->props.values.crtc_x  = static_cast<uint32_t>(3006 + planePropertyBase);
+                plane->props.values.crtc_y  = static_cast<uint32_t>(3007 + planePropertyBase);
+                plane->props.values.crtc_w  = static_cast<uint32_t>(3008 + planePropertyBase);
+                plane->props.values.crtc_h  = static_cast<uint32_t>(3009 + planePropertyBase);
+                planes.push_back(std::move(plane));
+            }
+        }
+    };
+
+    const SConnectorResource* connectorResource(const CSharedPointer<const CSnapshot>& snapshot, uint32_t id) {
+        const auto FOUND = std::ranges::find(snapshot->connectors(), id, [](const auto& resource) { return resource.connector->id; });
+        return FOUND == snapshot->connectors().end() ? nullptr : &*FOUND;
+    }
+
+    CSharedPointer<const CSnapshot> snapshotFor(const PCommittedScan& scan, const SResources& resources, uint64_t allocationEpoch) {
+        const std::vector<uint32_t>       routeIds{resources.crtcs.at(0)->id, resources.crtcs.at(1)->id};
+        std::vector<SConnectorCapture>    connectors;
+        std::vector<SCRTCCapture>         crtcs;
+        std::vector<SPrimaryPlaneCapture> planes;
+        connectors.reserve(resources.connectors.size());
+        crtcs.reserve(resources.crtcs.size());
+        planes.reserve(resources.planes.size());
+        for (const auto& CONNECTOR : resources.connectors)
+            connectors.push_back({.connector = CONNECTOR, .possibleCRTCIDs = routeIds});
+        for (const auto& CRTC : resources.crtcs)
+            crtcs.push_back({.crtc = CRTC});
+        for (const auto& PLANE : resources.planes)
+            planes.push_back({.plane = PLANE, .possibleCRTCIDs = routeIds, .usable = true});
+        return CSnapshot::create(scan, allocationEpoch, std::move(connectors), std::move(crtcs), std::move(planes));
+    }
+
+    SConnectorHandle connectorHandle(const CSharedPointer<const CSnapshot>& snapshot, uint32_t id) {
+        const auto* RESOURCE = connectorResource(snapshot, id);
+        CHECK(RESOURCE != nullptr);
+        return RESOURCE ? SConnectorHandle{.id = id, .incarnation = RESOURCE->incarnation} : SConnectorHandle{};
+    }
+
+    CSharedPointer<const CPlan> planFor(const CSharedPointer<const CSnapshot>& snapshot) {
+        const auto DEFINITION = CGroupDefinition::create(snapshot->scan()->definitions().front());
+        CHECK(static_cast<bool>(DEFINITION));
+        SGroupRequest request{.definition = DEFINITION};
+        for (const auto& MEMBER : DEFINITION->group().members)
+            request.connectors.push_back(connectorHandle(snapshot, MEMBER.connectorId));
+        const SAllocationEpoch epoch{
+            .session     = snapshot->session()->sessionEpoch(),
+            .allocation  = snapshot->allocationEpoch(),
+            .eventThread = snapshot->session()->eventThreadEpoch(),
+        };
+        const auto observation = CAllocationObservation::create(snapshot->scan(), snapshot, {DEFINITION}, {}, {std::move(request)}, {}, {}, {}, epoch);
+        CHECK(static_cast<bool>(observation));
+        const auto plan = solve(observation);
+        CHECK(plan && plan->status() == ePlanStatus::READY);
+        return plan;
+    }
+
+    SCurrentState currentFor(const CSharedPointer<const CPlan>& plan) {
+        return {
+            .backendLifetime = plan->snapshot()->device()->backend().lock(),
+            .device          = plan->snapshot()->device(),
+            .session         = plan->snapshot()->session(),
+            .scan            = plan->snapshot()->scan(),
+            .scanObservation = plan->snapshot()->observation(),
+            .snapshot        = plan->snapshot(),
+            .observation     = plan->observation(),
+            .epoch           = plan->observation()->epoch(),
+        };
+    }
+
+    struct SPropertyWrite {
+        uint32_t objectId   = 0;
+        uint32_t propertyId = 0;
+        uint64_t value      = 0;
+
+        bool     operator==(const SPropertyWrite&) const = default;
+    };
+
+    struct SRecorder final : ITiledAtomicRequestOperations {
+        drmModeAtomicReqPtr allocateRequest() noexcept override {
+            ++allocations;
+            // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast): opaque fake request identity for the injected test boundary
+            return reinterpret_cast<drmModeAtomicReqPtr>(this);
+        }
+
+        void freeRequest(drmModeAtomicReqPtr request) noexcept override {
+            // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast): matches allocateRequest's fake identity
+            if (request == reinterpret_cast<drmModeAtomicReqPtr>(this))
+                ++frees;
+        }
+
+        int addProperty(drmModeAtomicReqPtr, uint32_t objectId, uint32_t propertyId, uint64_t value) noexcept override {
+            if (failPropertyAt == properties.size())
+                return -1;
+            try {
+                properties.push_back({.objectId = objectId, .propertyId = propertyId, .value = value});
+                return static_cast<int>(properties.size() - 1);
+            } catch (...) { return -1; }
+        }
+
+        int createModeBlob(int, const drmModeModeInfo& mode, uint32_t* blobId) noexcept override {
+            if (!blobId)
+                return -1;
+            *blobId = duplicateBlob && !createdBlobs.empty() ? createdBlobs.front() : nextBlob++;
+            try {
+                createdBlobs.push_back(*blobId);
+                physicalModes.push_back(mode);
+                return 0;
+            } catch (...) { return -1; }
+        }
+
+        int destroyModeBlob(int, uint32_t blobId) noexcept override {
+            try {
+                destroyedBlobs.push_back(blobId);
+                return 0;
+            } catch (...) { return -1; }
+        }
+
+        size_t                       allocations    = 0;
+        size_t                       frees          = 0;
+        size_t                       failPropertyAt = static_cast<size_t>(-1);
+        bool                         duplicateBlob  = false;
+        uint32_t                     nextBlob       = 900;
+        std::vector<SPropertyWrite>  properties;
+        std::vector<uint32_t>        createdBlobs;
+        std::vector<uint32_t>        destroyedBlobs;
+        std::vector<drmModeModeInfo> physicalModes;
+    };
+
+    void appendExpected(std::vector<SPropertyWrite>& expected, const STiledAtomicMember& member, uint32_t framebufferId, uint32_t modeBlobId) {
+        const auto& CONNECTOR = member.connectorProperties;
+        const auto& CRTC      = member.crtcProperties;
+        const auto& PLANE     = member.planeProperties;
+        const auto& VIEWPORT  = member.viewport;
+        const auto  append = [&](uint32_t objectId, uint32_t propertyId, uint64_t value) { expected.push_back({.objectId = objectId, .propertyId = propertyId, .value = value}); };
+        append(member.connectorId, CONNECTOR.crtcId, member.crtcId);
+        if (CONNECTOR.linkStatus)
+            append(member.connectorId, CONNECTOR.linkStatus, DRM_MODE_LINK_STATUS_GOOD);
+        append(member.crtcId, CRTC.modeId, modeBlobId);
+        append(member.crtcId, CRTC.active, 1);
+        append(member.primaryPlaneId, PLANE.fbId, framebufferId);
+        append(member.primaryPlaneId, PLANE.crtcId, member.crtcId);
+        append(member.primaryPlaneId, PLANE.srcX, VIEWPORT.srcX);
+        append(member.primaryPlaneId, PLANE.srcY, VIEWPORT.srcY);
+        append(member.primaryPlaneId, PLANE.srcW, VIEWPORT.srcW);
+        append(member.primaryPlaneId, PLANE.srcH, VIEWPORT.srcH);
+        append(member.primaryPlaneId, PLANE.crtcX, static_cast<uint64_t>(static_cast<int64_t>(VIEWPORT.crtcX)));
+        append(member.primaryPlaneId, PLANE.crtcY, static_cast<uint64_t>(static_cast<int64_t>(VIEWPORT.crtcY)));
+        append(member.primaryPlaneId, PLANE.crtcW, VIEWPORT.crtcW);
+        append(member.primaryPlaneId, PLANE.crtcH, VIEWPORT.crtcH);
+    }
+
+    struct SForeignIdentityCarrier {};
+}
+
+int main() {
+    const auto         backend = CBackendLifetime::createTestToken(1);
+    const auto         device  = CDeviceIncarnation::create(backend, 900, 9, 27, 2);
+    const auto         session = CSessionIncarnation::create(backend, device, std::this_thread::get_id(), 17, 1, 3);
+    SResources         resources;
+    const auto         scan     = CScanFixtureAuthority::mint(session, {1, 2}, tiledGroup(device->deviceId()), 10);
+    const auto         snapshot = snapshotFor(scan, resources, 41);
+    const auto         plan     = planFor(snapshot);
+
+    COutputBridgeState bridge;
+    const auto         preparedBridge = bridge.prepare(plan);
+    CHECK(static_cast<bool>(preparedBridge));
+    CHECK(bridge.install(preparedBridge.prepared, currentFor(plan)) == eInstallResult::INSTALLED);
+    POutputBridgeObservation installed;
+    CHECK(bridge.withCurrentOwner(currentFor(plan), [&](const POutputBridgeObservation& current) { installed = current; }));
+    CHECK(static_cast<bool>(installed));
+    CHECK(installed->groups().size() == 1);
+    const auto& GROUP = installed->groups().front();
+    CHECK(GROUP.projection() == eGroupProjection::MULTI_STREAM_ALLOCATED);
+    const auto ALLOCATION = GROUP.allocation();
+    CHECK(ALLOCATION.has_value());
+    if (!ALLOCATION)
+        return 1;
+    const auto& BINDINGS = ALLOCATION->get().bindings();
+    CHECK(GROUP.modeSet() && GROUP.modeSet()->modes().size() == 1);
+
+    // Deliberately poison both mutable singular routes. The resolver must use
+    // only the exact allocator bindings retained by the bridge observation.
+    for (const auto& BINDING : BINDINGS) {
+        const auto WRONG_CRTC     = resources.crtcs.at(BINDING.crtc() == resources.crtcs.at(0) ? 1 : 0);
+        const auto WRONG_PLANE    = resources.planes.at(BINDING.primaryPlane() == resources.planes.at(0) ? 1 : 0);
+        BINDING.connector()->crtc = WRONG_CRTC;
+        BINDING.crtc()->primary   = WRONG_PLANE;
+    }
+
+    const auto                     MODE = GROUP.modeSet()->modes().front().outputMode;
+    const STiledAtomicResolveInput input{
+        .generationOwner    = installed,
+        .groupDefinition    = GROUP.scanDefinition(),
+        .definitionIdentity = GROUP.definitionIdentity(),
+        .outputMode         = MODE,
+        .framebuffer =
+            {
+                .id       = 777,
+                .size     = {.width = 200, .height = 50},
+                .format   = DRM_FORMAT_XRGB8888,
+                .modifier = DRM_FORMAT_MOD_LINEAR,
+            },
+    };
+    const auto resolved = resolveCapturedTiledAtomic(input);
+    CHECK(static_cast<bool>(resolved));
+    CHECK(sameOwner(resolved.route->generationOwner(), installed));
+    CHECK(sameOwner(resolved.route->groupDefinition(), GROUP.scanDefinition()));
+    CHECK(sameOwner(resolved.route->allocationDefinition(), GROUP.allocationDefinition()));
+    CHECK(sameOwner(resolved.route->definitionIdentity(), GROUP.definitionIdentity()));
+    CHECK(sameOwner(resolved.route->modeSet(), GROUP.modeSet()));
+    CHECK(sameOwner(resolved.route->outputMode(), MODE));
+    CHECK(resolved.route->generation() == 41);
+    CHECK(resolved.route->members().size() == 2);
+    CHECK(resolved.route->crtcIds().size() == 2);
+    CHECK(std::ranges::is_sorted(resolved.route->crtcIds()));
+
+    for (const auto& MEMBER : resolved.route->members()) {
+        const auto BINDING = std::ranges::find(BINDINGS, MEMBER.connectorId, [](const auto& candidate) { return candidate.connector()->id; });
+        CHECK(BINDING != BINDINGS.end());
+        if (BINDING == BINDINGS.end())
+            continue;
+        CHECK(sameOwner(MEMBER.connector, BINDING->connector()));
+        CHECK(sameOwner(MEMBER.connectorIncarnation, BINDING->connectorIncarnation()));
+        CHECK(sameOwner(MEMBER.crtc, BINDING->crtc()));
+        CHECK(sameOwner(MEMBER.crtcIncarnation, BINDING->crtcIncarnation()));
+        CHECK(sameOwner(MEMBER.primaryPlane, BINDING->primaryPlane()));
+        CHECK(sameOwner(MEMBER.primaryPlaneIncarnation, BINDING->primaryPlaneIncarnation()));
+        CHECK(!sameOwner(MEMBER.crtc, MEMBER.connector->crtc));
+        CHECK(!sameOwner(MEMBER.primaryPlane, MEMBER.crtc->primary));
+    }
+
+    const auto runtimePlan = resolved.route->runtimePlan<CSharedPointer<CDRMFB>>();
+    CHECK(runtimePlan.generation == resolved.route->generation());
+    CHECK(sameOwner(runtimePlan.generationOwner, installed));
+    CHECK(sameOwner(runtimePlan.definitionIdentity, GROUP.definitionIdentity()));
+    CHECK(runtimePlan.primaryCrtcId == resolved.route->primaryCrtcId());
+    CHECK(runtimePlan.crtcIds == std::vector<uint32_t>(resolved.route->crtcIds().begin(), resolved.route->crtcIds().end()));
+    CHECK(runtimePlan.memberRoutes.size() == resolved.route->members().size());
+
+    auto foreignMode            = makeShared<SOutputMode>();
+    foreignMode->pixelSize      = MODE->pixelSize;
+    foreignMode->refreshRate    = MODE->refreshRate;
+    foreignMode->preferred      = MODE->preferred;
+    auto foreignModeInput       = input;
+    foreignModeInput.outputMode = foreignMode;
+    CHECK(resolveCapturedTiledAtomic(foreignModeInput).error == eTiledAtomicError::MODE_MAPPING_MISMATCH);
+
+    CSharedPointer<SForeignIdentityCarrier> identityCarrier{new SForeignIdentityCarrier{}};
+    auto                                    foreignIdentityInput = input;
+    foreignIdentityInput.definitionIdentity                      = Hyprutils::Memory::reinterpretPointerCast<const COutputDefinitionIdentity>(identityCarrier);
+    CHECK(resolveCapturedTiledAtomic(foreignIdentityInput).error == eTiledAtomicError::FOREIGN_DEFINITION_IDENTITY);
+
+    auto                                          recorder   = makeShared<SRecorder>();
+    CSharedPointer<ITiledAtomicRequestOperations> operations = recorder;
+    auto                                          built      = buildTiledTestModeset(resolved.route, 19, operations);
+    CHECK(static_cast<bool>(built));
+    CHECK(built.prepared->request() != nullptr);
+    CHECK(built.prepared->flags() == (DRM_MODE_ATOMIC_ALLOW_MODESET | DRM_MODE_ATOMIC_TEST_ONLY));
+    CHECK(built.prepared->userData() == 0);
+    CHECK(std::ranges::equal(built.prepared->modeBlobs(), recorder->createdBlobs));
+    CHECK(recorder->physicalModes.size() == resolved.route->members().size());
+
+    std::vector<SPropertyWrite> expected;
+    for (size_t index = 0; index < resolved.route->members().size(); ++index)
+        appendExpected(expected, resolved.route->members().subspan(index, 1).front(), resolved.route->framebuffer().id, recorder->createdBlobs.at(index));
+    CHECK(recorder->properties == expected);
+    CHECK(recorder->allocations == 1);
+    CHECK(recorder->frees == 0);
+    built.prepared.reset();
+    CHECK(recorder->frees == 1);
+    CHECK(recorder->destroyedBlobs == std::vector<uint32_t>({901, 900}));
+
+    auto failingRecorder                                            = makeShared<SRecorder>();
+    failingRecorder->failPropertyAt                                 = 3;
+    CSharedPointer<ITiledAtomicRequestOperations> failingOperations = failingRecorder;
+    const auto                                    failedBuild       = buildTiledTestModeset(resolved.route, 19, failingOperations);
+    CHECK(!static_cast<bool>(failedBuild));
+    CHECK(failedBuild.error == eTiledAtomicError::PROPERTY_ADD_FAILED);
+    CHECK(failingRecorder->frees == 1);
+    CHECK(failingRecorder->destroyedBlobs == std::vector<uint32_t>({901, 900}));
+
+    auto duplicateRecorder                                            = makeShared<SRecorder>();
+    duplicateRecorder->duplicateBlob                                  = true;
+    CSharedPointer<ITiledAtomicRequestOperations> duplicateOperations = duplicateRecorder;
+    const auto                                    duplicateBuild      = buildTiledTestModeset(resolved.route, 19, duplicateOperations);
+    CHECK(!static_cast<bool>(duplicateBuild));
+    CHECK(duplicateBuild.error == eTiledAtomicError::MODE_BLOB_FAILED);
+    CHECK(duplicateRecorder->createdBlobs == std::vector<uint32_t>({900, 900}));
+    CHECK(duplicateRecorder->frees == 1);
+    CHECK(duplicateRecorder->destroyedBlobs == std::vector<uint32_t>({900}));
+
+    return FAILURES == 0 ? 0 : 1;
+}
diff --git a/tests/TiledVisibility.cmake b/tests/TiledVisibility.cmake
index 9e00a20262d7367f6cdc767903693ea971fb1ea0..82f2a68407a79515750db616246aaead9c3a62fa 100644
--- a/tests/TiledVisibility.cmake
+++ b/tests/TiledVisibility.cmake
@@ -74,6 +74,6 @@ if(NOT demangle_result EQUAL 0)
 endif()
 
 if(demangled_output MATCHES
-   "Aquamarine::(NTiling|TiledCrtcAllocator)::|Aquamarine::NDRM::NTiled(CrtcAllocator|Incarnations|Scan|DRMIntegration|OutputBridge)::|Aquamarine::NDRM::.*(Tile|tile|PageFlip|TiledRuntime|TiledFlip|AtomicSubmit|normalizeDRMCallError|submitAtomicRequest|PlaneViewport|PlaneFormats|intersectPlaneFormats|encodePlaneViewport)")
+   "Aquamarine::(NTiling|TiledCrtcAllocator)::|Aquamarine::NDRM::NTiled(Atomic|CrtcAllocator|Incarnations|Scan|DRMIntegration|OutputBridge)::|Aquamarine::NDRM::.*(Tile|tile|PageFlip|TiledRuntime|TiledFlip|AtomicSubmit|normalizeDRMCallError|submitAtomicRequest|PlaneViewport|PlaneFormats|intersectPlaneFormats|encodePlaneViewport)")
   message(FATAL_ERROR "source-private TILE symbol family is dynamically exported")
 endif()