Sharing the backing store with KMD

Starting in Windows 11 version 22H2, the WDDM API was extended to allow access to a graphics allocation backing store from the kernel-mode driver (KMD). Using this API, both the user-mode driver (UMD) and KMD can access the same allocation memory. This feature can be used when UMD is running on the host or in a virtual machine using GPU paravirtualization (GPU-PV).

This feature has been back-ported to Windows 10 version 20H1. The DDI is available for WDDM 3.1 drivers or newer.

WDDM graphics allocations and backing stores

Each graphics allocation in the WDDM model has a backing store, which is a committed memory buffer that holds the allocation content when it is not in video memory.

A graphics allocation is created by calling D3DKMTCreateAllocation. UMD passes private data for this allocation, which Dxgkrnl passes to KMD through a call to DXGKDDI_CREATEALLOCATION. KMD returns the desired allocation flags to Dxgkrnl.

Checking for feature availability

To check whether the backing store sharing feature is available, KMD must first call one of the following callbacks with FeatureId set to DXGK_FEATURE_SHARE_BACKING_STORE_WITH_KMD:

The feature can only be used if the callback succeeds and Enable is set to TRUE.

Feature flow

Once KMD has successfully determined that the feature is enabled, UMD calls D3DKMTCreateAllocation to create a shared CPU-visible allocation and instructs KMD via private data that the allocation has to be shared with KMD. In the course of this call, the following occurs:

Properties of the allocation

The allocation created in this way must have the following properties:

  • The allocation is allowed to be only in the system memory segment.
  • The allocation must be created as shared.
  • The allocation cannot use existing system memory as backing store.
  • UMD can do any operation as for a regular allocation.