SetDisplayModeDXGI callback function

The SetDisplayModeDXGI function switches to a display mode or primary that the GDI desktop does not support.


pfnSetDisplayMode SetDisplayModeDXGI;

HRESULT __stdcall* SetDisplayModeDXGI(
{ ... }



A pointer to a DXGI_DDI_ARG_SETDISPLAYMODE structure that specifies parameters for setting the display mode.

Return value

SetDisplayModeDXGI returns one of the following values:

Return codeDescription

The display mode was successfully set.


The driver failed to successfully set the display mode.


The driver detected that the graphics adapter was removed. Therefore, the driver did not complete the operation. If the driver never notices the adapter-removal condition, the driver is not required to return this error code.



The Microsoft Direct3D runtime calls SetDisplayModeDXGI to switch to a display mode or primary that the GDI desktop does not support. The following list describes examples of such primaries:

  • Primaries that are created with 10-bits-per-channel (10:10:10:2) display and render target formats (for example, D3DFMT_A2R10G10B10)

  • Multiple-sampled primaries where the multiple-sampling is performed while scanning-out

  • Persistent primaries that full-screen Microsoft DirectX version 10 applications use

The Direct3D runtime calls the user-mode display driver's CreateResource(D3D10) function to create the primary to be scanned out. However, the driver should program the hardware to scan out only when its SetDisplayModeDXGI function is called. Therefore, the runtime sets the hResource and SubResourceIndex members of the DXGI_DDI_ARG_SETDISPLAYMODE structure that is pointed to by the pDisplayModeData parameter to the primary that was created through the call to the driver's CreateResourceD3D10 function. The driver should then translate the primary that hResource and SubResourceIndex represent to a primary allocation handle. After the driver makes this translation, the driver should pass the resulting handle in a call to the pfnSetDisplayModeCb function, which then initiates a call to the display miniport driver's DxgkDdiCommitVidPn function.

The user-mode display driver can set the hPrimaryAllocation member of the D3DDDICB_SETDISPLAYMODE structure in the call to pfnSetDisplayModeCb to scan out any allocation. However, the allocation must be marked as a primary (that is, the user-mode display driver must have set the Primary bit-field flag in the Flags member of the D3DDDI_ALLOCATIONINFO structure in a call to the pfnAllocateCb function to create the allocation).


Target platform


Available in Windows Vista and later versions of the Windows operating systems.


Dxgiddi.h (include D3d10umddi.h)

See also




Send comments about this topic to Microsoft