AGC: on RADV and lavapipe a host-pointer import calls ImportWatched(staysWatched=false), so HTILE metadata leaves write-watch coverage #8759

Closed
opened 2026-10-20 23:52:17 +00:00 by oneandonlydean · 4 comments
oneandonlydean commented 2026-10-20 23:52:17 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T23:52:17Z.


On devices whose host-import probe reports "host imports resolve write protection: yes" (RADV, and lavapipe the same way), the host-pointer import calls ImportWatched(..., staysWatched=false). That takes the imported range out of the write watch. For an HTILE metadata range, Watched(htileAddress, metadataBytes) (GuestMemory.cpp:1630, tracker.watched && tracker.covers(range)) is then false after the import.

Effect seen in #7233: recognition and the HTILE-clear dispatch work, but Arm's CollectWritesUncached returns generation 0 because the range is no longer covered. CompleteHtileDepthClear (DepthSurface.cpp:1969) skips surfaces with clearGeneration == 0, so the native depth-clear completion path never engages on these devices. It fails safe: no completed-clear claim is made, and the range keeps the import-window comparison path. On NVIDIA the range stays watched and the path runs.

The import and watch logic comes from 406c72d9be (13 Oct) and e56a7c2351 (14 Oct); #7233 does not touch ImportWatched or staysWatched. Reproduction: agc_driver_native_multisample_depth_tests --clears on RADV (Mesa 25.2.8 and 26.2.4, 3 of 3) and on lavapipe (Mesa 26.2.4, 3 of 3, with and without /dev/udmabuf). Traces are in the #7233 thread (SleglJan, 19 and 20 Oct).

Possible fix: keep the metadata range watched for driver dispatches on host-pointer imports. That is a production change, separate from #7233, which only makes its test skip the write-coverage assertion when Watched says the range isn't tracked.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5951642130 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/8759). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-20T23:52:17Z. --- On devices whose host-import probe reports "host imports resolve write protection: yes" (RADV, and lavapipe the same way), the host-pointer import calls `ImportWatched(..., staysWatched=false)`. That takes the imported range out of the write watch. For an HTILE metadata range, `Watched(htileAddress, metadataBytes)` (GuestMemory.cpp:1630, `tracker.watched && tracker.covers(range)`) is then false after the import. Effect seen in #7233: recognition and the HTILE-clear dispatch work, but Arm's `CollectWritesUncached` returns generation 0 because the range is no longer covered. `CompleteHtileDepthClear` (DepthSurface.cpp:1969) skips surfaces with `clearGeneration == 0`, so the native depth-clear completion path never engages on these devices. It fails safe: no completed-clear claim is made, and the range keeps the import-window comparison path. On NVIDIA the range stays watched and the path runs. The import and watch logic comes from 406c72d9be (13 Oct) and e56a7c2351 (14 Oct); #7233 does not touch `ImportWatched` or `staysWatched`. Reproduction: `agc_driver_native_multisample_depth_tests --clears` on RADV (Mesa 25.2.8 and 26.2.4, 3 of 3) and on lavapipe (Mesa 26.2.4, 3 of 3, with and without /dev/udmabuf). Traces are in the #7233 thread (SleglJan, 19 and 20 Oct). Possible fix: keep the metadata range watched for driver dispatches on host-pointer imports. That is a production change, separate from #7233, which only makes its test skip the write-coverage assertion when `Watched` says the range isn't tracked.
MarcZX10 commented 2026-10-20 23:54:30 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T23:54:30Z.


I traced this against current main: GuestBufferMemory.cpp chooses watchedHostPointer = !state.unwatchImports on non-Windows and passes that to ImportWatched. When it is false, ImportWatched un-watches the imported range after the import. DepthSurface::NoteHtileDepthClear and DepthSurface::CheckCurrent require the HTILE range to remain Watched, so this is a real interaction between the host-import policy and the native clear proof, separate from #7233's write-coverage fix.

I would keep any production change scoped to the HTILE clear range rather than overriding the host-import watch policy for every imported buffer. A regression should exercise the staysWatched=false import path and prove the clear path still records the completed HTILE store on RADV/lavapipe, while retaining the existing CPU-write/import-window checks. Is anyone already preparing that focused change or test?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6304466355 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/8759#issuecomment-6304466355). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-20T23:54:30Z. --- I traced this against current `main`: `GuestBufferMemory.cpp` chooses `watchedHostPointer = !state.unwatchImports` on non-Windows and passes that to `ImportWatched`. When it is false, `ImportWatched` un-watches the imported range after the import. `DepthSurface::NoteHtileDepthClear` and `DepthSurface::CheckCurrent` require the HTILE range to remain `Watched`, so this is a real interaction between the host-import policy and the native clear proof, separate from #7233's write-coverage fix. I would keep any production change scoped to the HTILE clear range rather than overriding the host-import watch policy for every imported buffer. A regression should exercise the `staysWatched=false` import path and prove the clear path still records the completed HTILE store on RADV/lavapipe, while retaining the existing CPU-write/import-window checks. Is anyone already preparing that focused change or test?
MarcZX10 commented 2026-10-21 01:03:50 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T01:03:50Z.


Update: the current #7233 head eb55d58728f367f527253b3ae5b30ed45030fdf3 keeps the existing safe refusal on devices whose HTILE range is not watched. Its test now uses the live driver import policy, skips the write-coverage assertion when the range is uncovered, and asserts that the production path declines the clear with native multisample depth clear requires tracked HTILE generations. It does not implement the proposed production change to complete this path on RADV/lavapipe. I do not have a validated standalone implementation ready yet; that remains a separate open task.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6305392268 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/8759#issuecomment-6305392268). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-21T01:03:50Z. --- Update: the current #7233 head `eb55d58728f367f527253b3ae5b30ed45030fdf3` keeps the existing safe refusal on devices whose HTILE range is not watched. Its test now uses the live driver import policy, skips the write-coverage assertion when the range is uncovered, and asserts that the production path declines the clear with `native multisample depth clear requires tracked HTILE generations`. It does not implement the proposed production change to complete this path on RADV/lavapipe. I do not have a validated standalone implementation ready yet; that remains a separate open task.
Amoenus commented 2026-10-21 03:18:21 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Amoenus on 2026-10-21T03:18:21Z.


Windows scope datapoint: #7233 eb55 adapted onto main cd700 also takes the expected uncovered-HTILE refusal on our RTX 5080 and Radeon Graphics, 3/3 fresh processes per device. Each clear run has 26 completed-output cases plus that one refusal (checked=27 unavailable=0), not 27 completed outputs. The fixture is byte-identical to eb55; our adapted-parent control adds only the independent #7371 BDA regression, without its production handoff.

Maintained evidence and exact pins. Both fixture and live-driver contexts select the requested GPU, and both scratch private-import probes report that write watch is kept. The actual metadata span is nevertheless uncovered after dispatch. We have not isolated the Windows cause or demonstrated that it follows the non-Windows ImportWatched(staysWatched=false) path. This is a coverage limitation to preserve, not confirmation of the Linux diagnosis on Windows.

The issue body's NVIDIA tracked-path statement should therefore be scoped to the reported Linux NVIDIA configurations. The new expected refusal makes the fixture pass here without fixing production completion for that case. No title-unblock claim. AI-assisted: yes (Codex); author responsible.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6307169340 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/8759#issuecomment-6307169340). Originally posted by [Amoenus](https://github.com/Amoenus) on 2026-10-21T03:18:21Z. --- <!-- codex-8759-windows-scope-v1 --> Windows scope datapoint: #7233 eb55 adapted onto main cd700 also takes the expected uncovered-HTILE refusal on our **RTX 5080 and Radeon Graphics**, 3/3 fresh processes per device. Each clear run has 26 completed-output cases plus that one refusal (`checked=27 unavailable=0`), not 27 completed outputs. The fixture is byte-identical to eb55; our adapted-parent control adds only the independent #7371 BDA regression, without its production handoff. [Maintained evidence and exact pins](https://github.com/boykopovar/AnyPS5/pull/7233#issuecomment-6244828184). Both fixture and live-driver contexts select the requested GPU, and both scratch private-import probes report that write watch is kept. The actual metadata span is nevertheless uncovered after dispatch. **We have not isolated the Windows cause or demonstrated that it follows the non-Windows `ImportWatched(staysWatched=false)` path.** This is a coverage limitation to preserve, not confirmation of the Linux diagnosis on Windows. The issue body's NVIDIA tracked-path statement should therefore be scoped to the reported Linux NVIDIA configurations. The new expected refusal makes the fixture pass here without fixing production completion for that case. No title-unblock claim. AI-assisted: yes (Codex); author responsible.
MarcZX10 commented 2026-10-21 05:28:37 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T05:28:37Z.


Thanks for the Windows datapoint. I will keep the ImportWatched(staysWatched=false) explanation scoped to the reported Linux RADV/lavapipe paths; these Windows runs hit the same safe refusal, but do not establish that they use the same unwatch path. The issue remains about the Linux coverage loss, and the Windows cause is still open.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6308802795 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/8759#issuecomment-6308802795). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-21T05:28:37Z. --- Thanks for the Windows datapoint. I will keep the `ImportWatched(staysWatched=false)` explanation scoped to the reported Linux RADV/lavapipe paths; these Windows runs hit the same safe refusal, but do not establish that they use the same unwatch path. The issue remains about the Linux coverage loss, and the Windows cause is still open.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#8759
No description provided.