[VideoOut] Run state changes after pending command streams

Co-authored-by: Sekai <140012992+igettingit@users.noreply.github.com>
This commit is contained in:
ParantezTech 2026-10-06 17:47:34 +03:00
parent fef6800291
commit 018ab6a7b9
2 changed files with 23 additions and 0 deletions

View File

@ -66,6 +66,9 @@ internal sealed class VulkanGuestGpuBackend : IGuestGpuBackend
public IdleOutcome SubmitDone(ICpuMemory memory) =>
VulkanVideoPresenter.SubmitDone(memory);
public void RunAfterPendingCommandStreams(Action work) =>
VulkanVideoPresenter.RunAfterPendingCommandStreams(work);
public void RegisterKnownDisplayBuffer(ulong address, uint guestFormat) =>
VulkanVideoPresenter.RegisterKnownDisplayBuffer(address, guestFormat);

View File

@ -72,6 +72,26 @@ internal static unsafe partial class VulkanVideoPresenter
? testStream.Done()
: IdleOutcome.Completed;
public static void RunAfterPendingCommandStreams(Action work)
{
ArgumentNullException.ThrowIfNull(work);
if (TryGetActivePresenter(out var presenter))
{
if (presenter.Relay.TryRunAfterAcceptedCommandStreams(work))
{
return;
}
if (!HostSessionControl.IsShutdownRequested && !Volatile.Read(ref _closed) &&
!Volatile.Read(ref _presenterCloseRequested))
{
throw SubmissionScheduler.Fatal("The GPU worker rejected an ordered video-out state change.");
}
}
work();
}
// The blocked heads of the stream this memory submits to; null when no stream exists for it.
internal static BlockedSnapshot? SnapshotBlockedCommandStream(ICpuMemory? memory)
{