Repository navigation
Show the second screen on hybrid laptops, carried onto current main - #98
Merged
Merged
Conversation
The attach block this branch extended is gone from reconcile_virtual_display: the second screen worker turns the display on now. The conflict keeps that side; the attach work moves into the worker in the next commit.
…d screen worker The worker now does what the removed attach block did: just before each Enable it names the main screen's graphics card and writes the modes (prepare_vdd_settings), it waits 30 s for Extend after "kept your desktop off it", it brings an attached display to the iPad's mode and logs the card the driver renders on, and it reports the device and logs a display snapshot while the display is still on: when the Enable task fails (turning off a device it enabled that cannot show a display), when no display attaches, when a mode change ends a long start, and when the second screen shows no picture (no_frames, duplication_failed).
…tes the settings file
…Setup's, and keep the pin record on a failed write
… fix/hybrid-second-screen
… fix/hybrid-second-screen
…d new card before the settings file is replaced, and replace the record as the settings file is
… fix/hybrid-second-screen
whoisaldo
marked this pull request as ready for review
October 27, 2026 08:45
whoisaldo
added a commit
that referenced
this pull request
Oct 27, 2026
…laptops (#97, #98) When an iPad connects in Second screen mode the PC now streams its main display at once, turns the virtual display on in the background, and switches to it once it shows a real picture. If it doesn't within 5 seconds the PC goes back to mirroring and says why. One worker turns the virtual display on and off, at most once every 10 seconds, so reconnects no longer make the screen blink. NVIDIA and Intel encoders answer a keyframe request with a real keyframe, so a reconnecting iPad gets a picture at once. Includes #98: the virtual display driver is pinned to the GPU that drives the screens on hybrid laptops, only when this PC may change the driver's settings.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Stacked on #97 (
fix/second-screen-fallback): this branch merges #97 and targets it. It carries the never-merged #72 forward ("Show the second screen on hybrid laptops and say why it didn't appear"). 0.3.2 shipped without it.From #72, unchanged in intent (see #72):
vdd_settings.xmlnames the graphics card that drives the main screen. The bundled driver reads that name on every device add and takes the first adapter whose name matches, ignoring case. Without a name it picks the card with the most memory, which on Intel + NVIDIA laptops drives no screen.Added on this branch before #97:
Where #72's attach work lives after #97
#97 removed the attach block from
reconcile_virtual_display; one worker thread incapture/second_screen.rsnow makes every change. Each piece of #72's attach work moved into that worker:prepare_vdd_settings)Driver::prepare, just before the Enable, after the toggle gapvdd::enable)Driver::enablereturns the task's report; the worker reports the device, logs the snapshot, and turns off a device it enabled that cannot show a display (after the 10 s gap)Driver::report(AttachTimeout), before the Disablesettle_vdd_mode) and the card the driver renders onDriver::settle, before the switch onto the displayETERNAL_SIMULATE_ATTACH_TIMEOUTNew with #97: a second screen that shows no picture (
no_frames,duplication_failed) logs the snapshot, with the card it rendered on, while the display is still on, and then goes back to the mirror. It does not set a device problem: the device worked.Review fixes
vdd_device=no_monitor.vdd_settings.xmlis replaced only on a driver Setup installed, or when it is empty,default, or the last name this host wrote (recorded invdd-pin.txtin the app data folder). This holds whether or not Match the iPad's resolution rewrites the whole file. When this host has no card to name, it takes back its own earlier name, so the file never keeps a name the log says was not made.no_frames,duplication_failed) has its own Stream page notice instead of "Windows didn't add the second screen in time".How it was tested
macOS:
cargo fmt --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace: 557 passed.Windows 11 (RTX 5080 desktop with AMD integrated graphics), in a separate worktree:
cargo fmt --check,cargo build --workspace,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace --no-fail-fast(548 passed; two timing tests,startup::reporterandtelemetryidle uploader, failed once under load and passed three times each alone), and the six VDD and installer PowerShell tests.Unit tests for the worker (paused clock, fake driver): the card is named before the Enable, and an attached display is settled before the switch. A timeout is reported before its Disable. A failed Enable is reported, and a device it enabled that cannot show a display is turned off after the gap, but a missing device is not. The start after "kept your desktop off it" waits 30 s, while other failures wait the usual 10 s; Extend chosen 20 s in brings the second screen up. A mode change after 2 s or more is reported once. A second screen without a picture is reported before its Disable, from both the transport tick and the next capture generation. Also tested: the ownership rule for both the edit-only and the whole-file rewrite, a marker for another driver install, an unreadable settings file, a failed write, a mode change while the mode is set, and the no-picture notice.
Enable task on the same PC (three runs each, display attached every time):
mainWith the driver named to the AMD iGPU:
main3.8–4.0 s, this branch 4.4–4.7 s, display on the desktop at 3.4–3.7 s for both. In an earlier run on a busy PC, three Enable runs (both scripts) did not finish within the harness's 25 s window. They exited 0 later, and a rerun was clean.Native run, debug host from this branch, Second screen selected, a test client connecting:
Not reproduced here: the hybrid-laptop failure itself. The fix still needs a check on an Intel + NVIDIA laptop.