DXGKDDI_SUSPENDCONTEXT callback function

Instruct the GPU to suspend a context. If the GPU doesn’t acknowledge the suspend completion within the TDR (timeout detection and recovery) timeout, the OS will detect the engine timeout and perform engine reset.

Syntax

DXGKDDI_SUSPENDCONTEXT DxgkddiSuspendcontext;

NTSTATUS DxgkddiSuspendcontext(
  IN_CONST_HANDLE hAdapter,
  IN_CONST_PDXGKARG_SUSPENDCONTEXT pSuspendContext
)
{...}

Parameters

hAdapter

The hardware context to be preempted and marked as suspended. This type of preemption request does not have a grace period, and is expected to be honored by the GPU as soon as possible..

pSuspendContext

Pointer to a DXGKARG_SUSPENDCONTEXT structure that contains a monotonically increasing per-context value that will be reported by the GPU context suspended interrupt once the preemption request is completed. Until the fence is signaled, the OS cannot assume GPU is suspended.

Return Value

Return STATUS_SUCCESS if the context is already suspended at the time of this call. Otherwise, this value is set to STATUS_PENDING, and the suspend operation will be finished when contextSuspendFence is signaled via an interrupt.

Remarks

Register your implementation of this callback function by setting the appropriate member of DXGKARG_SUSPENDCONTEXT and then calling DxgkddiSuspendContext.

Even though the round robin preemption can be initiated by the GPU, the OS still needs a way to preempt the context for other reasons, for example if it needs to move its allocations around, or perform a GPU power transition.

The context suspend value is necessary to handle cases when the OS suspends a context, doesn’t wait for the suspend acknowledgment, resumes, and suspends a context again. The suspend value will allow the OS to distinguish between the previous suspend acknowledgement and the latest one.

Once a context is suspended, it is assumed that all references to it are gone from the GPU, and the OS is free to destroy the context or move its memory around. Unlike WDDM 2.3 or earlier, no separate NULL context switch command (previously indicated by ContextSwitch flag in DdiSubmitCommandVirtual) is present in WDDM 2.4 scheduling mode, because DdiSuspendContext is supposed to do this work.

Requirements

   
Header d3dkmddi.h