Support reverse-PRIME#95
Conversation
Convert DRM device handles and the v2 fence pool from thread-safe Arc/Mutex/atomic ownership to Rc/RefCell/Cell on the core thread. This keeps KMS device lifetime sharing explicit without implying cross-thread backend access. Co-authored-by: Codex <codex@openai.com> Signed-off-by: April Grimoire <april@aprilg.moe>
Handle the RANDR transform, panning, and primary-output requests that can be represented without an internal composition path. Identity transforms and disabled panning are accepted as no-ops, unsupported non-direct RANDR requests now fail explicitly, and primary output metadata survives valid RANDR state rebuilds. Co-authored-by: Codex <codex@openai.com> Signed-off-by: April Grimoire <april@aprilg.moe>
Move KMS card selection behind a shared DrmPlatform interface, keeping node types and selection policy in platform::drm. Put Linux /dev/dri enumeration and sysfs primary/render matching in platform::drm_linux, and keep kms::render_node as a thin platform consumer. Co-authored-by: Codex <codex@openai.com> Signed-off-by: April Grimoire <april@aprilg.moe>
Keep the yserver crate's udev dependency aligned with its cfg-gated DRM hotplug implementation by moving it under a Linux target dependency section. This keeps Linux builds unchanged while removing libudev from non-Linux dependency resolution. Co-authored-by: Codex <codex@openai.com> Signed-off-by: April Grimoire <april@aprilg.moe>
Move normalized KMS Mode and Output records into the shared platform boundary, and move Linux connector, CRTC, plane, EDID, and modifier discovery into platform::drm_linux. Keep drm::modeset focused on direct atomic modeset operations for already-discovered outputs. This keeps KMS callers behind platform::drm while avoiding a generic-looking drm::modeset discovery path for Linux-specific topology handling. Co-authored-by: Codex <codex@openai.com> Signed-off-by: April Grimoire <april@aprilg.moe>
Thread stable KMS provider/output identity through the v2 platform backend by storing active outputs with device-qualified keys, allocating provider IDs separately from output and CRTC IDs, and routing SetCrtcConfig by RANDR output id as well as connector name. Drop the obsolete KmsBackendV2 Send shim now that upstream owns the backend directly on the core-loop thread. Co-authored-by: Codex <codex@openai.com> Signed-off-by: April Grimoire <april@aprilg.moe>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Codex <codex@openai.com>
Retain primary and render node identities together, select the Vulkan physical device matching the initial KMS device through VK_EXT_physical_device_drm, and record mappings for secondary providers. Reject conflicting or ambiguous identities while preserving the generic selection fallback when the extension is unavailable. Co-authored-by: Codex <codex@openai.com> Signed-off-by: April Grimoire <april@aprilg.moe>
Project each opened DRM device into stable RANDR provider state, implement GetProviders and GetProviderInfo wire replies, and validate provider relationship requests with Xorg-compatible provider and capability errors. Keep all provider capabilities clear until cross-GPU transport is implemented. Co-authored-by: Codex <codex@openai.com> Signed-off-by: April Grimoire <april@aprilg.moe>
Record the Vulkan render device and KMS presentation device for each active output and scanout pool. Probe DRM PRIME import, Vulkan device identity, format modifiers, and linear fallback metadata before attempting cross-device allocation, while preserving existing local scanout behavior. Co-authored-by: Codex <codex@openai.com> Signed-off-by: April Grimoire <april@aprilg.moe>
Model DMA-BUF scanout probing as Compatible, Incompatible, or Unknown. Reserve early rejection for conclusive blockers and preserve the historical real export/import attempt when driver identity, PRIME capability, or layout metadata is incomplete. Co-authored-by: Codex <codex@openai.com> Signed-off-by: April Grimoire <april@aprilg.moe>
Advertise the current Vulkan render provider as SourceOutput and secondary KMS devices as SinkOutput. Persist SetProviderOutputSource relationships, project both sides through GetProviderInfo, and notify RANDR subscribers when a relationship changes. Require an attached source before secondary CRTC enable reaches the existing tri-state DMA-BUF probe and real import path. Reject detaching active sinks and cover the wire, fanout, association, and KMS policy boundaries. Co-authored-by: Codex <codex@openai.com> Signed-off-by: April Grimoire <april@aprilg.moe>
Accept a colon-separated YSERVER_DRM_DEVICES list in primary-first order so deployments can retain secondary KMS providers while selecting the Vulkan render source. Keep YSERVER_DRM_DEVICE as the compatible one-device-only override. Reject empty and duplicate list entries and document the multi-GPU LightDM configuration used for hardware testing. Co-authored-by: Codex <codex@openai.com> Signed-off-by: April Grimoire <april@aprilg.moe>
Assign every backend-owned poll fd a unique token and preserve its fd identity through core-loop readiness dispatch. Drain page-flip events only from the KMS device that became readable, avoiding a blocking read from an idle secondary card. Remove the obsolete identity-less PageFlipReady message path and add core-loop and KMS routing regression coverage. Co-authored-by: Codex <codex@openai.com> Signed-off-by: April Grimoire <april@aprilg.moe>
Use the typed DRM connector handle already carried by each discovered output when resolving non-preferred modes. This avoids treating protocol-facing connector names as DRM identity, notably the HDMI-1 versus HDMI-A-1 naming difference. Co-authored-by: Codex <codex@openai.com> Signed-off-by: April Grimoire <april@aprilg.moe>
Automatically associate secondary output providers with the primary render provider and try output-owned scanout before renderer-owned fallback. Validate full three-BO pools on disposable Vulkan devices with atomic TEST_ONLY modesets and real rendering. Retry each renderer allocation representation end to end, preserve the exact successful setup for live allocation, and tear down failed or device-lost probes without leaking resources. Rename the generic DRM Buffer type to DumbBuffer and carry ownership-specific state through scanout teardown and presentation. Co-authored-by: Codex <codex@openai.com> Signed-off-by: April Grimoire <april@aprilg.moe>
Co-authored-by: Codex <codex@openai.com>
Add a completion-fd handoff between source rendering and sink copying, with per-device transfer contexts, copied scanout pools, end-to-end probing, and failure recovery. Co-authored-by: Codex <codex@openai.com>
|
That's amazing! I'll have a look in the morning |
|
Really strong contribution — thank you. The scope is large but well-structured: spec + impl plan in Static gates (local,
|
Reset copied scanout state before RANDR topology rebuilds so surviving outputs cannot retain stale completion jobs or busy BOs. Reject copied scanout when the sink lacks explicit DMA-BUF layout import support, and hide DRI3 on affected multi-device renderers. Resolve fallback render nodes only through a verified sysfs parent match. Co-authored-by: Codex <codex@openai.com>
Force connector probes at topology refresh boundaries and keep the RANDR registry authoritative for EDID, physical dimensions, modes, and exact timings. Correct disconnect notifications and preserve stable connector resources across monitor replacement. Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Codex <codex@openai.com>
Resolve the RANDR conflict by retaining device-qualified output routing alongside upstream resize notifications. Route upstream's retained root overlay through both shared and copied reverse-PRIME composition paths. Co-authored-by: Codex <codex@openai.com>
|
Supposedly fixed. Now the exported copied buffer is first copied into linear layout. Fixed another bug of different monitors plugged into the same port not triggering reprobes of RANDR data. |
|
great, I'm not sure when I can test it though. I don't always have access to that machine. |
|
yserver-hw-mate.log |
|
Sorry, I'll get more hardware to test on. |
|
No worries, you can't test/own all hardware. |
Parse YSERVER_DRM_DEVICES as a comma-separated, primary-first list so stable udev by-path PCI addresses remain intact. Update validation coverage and add a reverse-PRIME device profile using stable paths. Co-authored-by: Codex <codex@openai.com> Signed-off-by: April Grimoire <april@aprilg.moe>
# Conflicts: # crates/yserver/src/kms/render/scene.rs # crates/yserver/src/kms/vk/compositor.rs # crates/yserver/src/kms/vk/scanout.rs
# Conflicts: # crates/yserver/src/kms/render/platform.rs # crates/yserver/src/kms/vk/device.rs # crates/yserver/src/kms/vk/scanout.rs
|
Hello. I resurrected an old desktop and bought a CPU with iGPU, GTX1050 + i3-12100, and couldn't reproduce the issue. I merged the changes upstream. The previous test run is at log level |
|
Oh wow, you bought hardware for yserver ❤️ How exactly did you test on your HW? I output via the iGPU and one vie the dGPU? |
Haha! It's a second-hand CPU (since it's i3-12100). That's the cheapest CPU I can find that fits my motherboard. I can resell it after testing so the cost is infinitesimal. I tested both directions, and they all worked. |
|
I'll test again on Monday (the PC I have for that is in office) |

It finally works!
Now by itself yserver doesn't automatically enable outputs on secondary devices. However,
xrandr --autoworks.After some preparations on modelling the relevant objects, now reverse-PRIME works in three modes:
Yserver now automatically probes which of these modes work.
Changes by commit: