UMDEtwLogMapAllocation - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// umdprovider.h

void UMDEtwLogMapAllocation(
  ULONGLONG                  hD3DAllocation,
  ULONGLONG                  hDxgAllocation,
  ULONGLONG                  Offset,
  ULONGLONG                  Size,
  UMDETW_ALLOCATION_USAGE    Usage,
  UMDETW_ALLOCATION_SEMANTIC Semantic
);
View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nf-umdprovider-umdetwlogmapallocation)

UMDEtwLogMapAllocation function

Description

Describes how a Microsoft DirectX graphics kernel subsystem (Dxgkrnl.sys) memory allocation, or a portion of the allocation, is being used.

Parameters

hD3DAllocation

A handle to the Direct3D allocation.

For Direct3D 10 user-mode drivers, the handle will be the value of the hResource parameter of the CreateResource(D3D10) function. For Direct3D 9 user-mode drivers, the handle will be the value of the pResource parameter that the driver returns in the CreateResource function.

The driver can set this value to NULL if it uses allocations internally.

hDxgAllocation

A handle to the DirectX graphics kernel subsystem (Dxgkrnl.sys) allocation that the Direct3D allocation is mapped to.

Offset

The starting address, in bytes, of the Direct3D allocation within the Dxgkrnl allocation.

Size

The size, in bytes, of the Direct3D allocation within the Dxgkrnl allocation.

Usage

A UMDETW_ALLOCATION_USAGE structure that indicates the reason for this mapping.

Semantic

If the allocation is used internally by the user-mode driver, this is a UMDETW_ALLOCATION_SEMANTIC structure that indicates what the allocation is used for.

Remarks

The user-mode display driver must completely account for the video memory it allocates, so it must call this function to log an event every time the allocation changes.

Examples of when to call this function are:

UMDEtwLogMapAllocation is defined inline in Umdprovider.h as:

FORCEINLINE void LogMapAllocation(BOOLEAN Enter,
                    ULONGLONG hD3DAllocation,
                    ULONGLONG hDxgAllocation,
                    ULONGLONG Offset,
                    ULONGLONG Size,
                    UMDETW_ALLOCATION_USAGE Usage,
                    UMDETW_ALLOCATION_SEMANTIC Semantic)
{
    if (Enabled)
    {
        EVENT_DATA_DESCRIPTOR Descriptors[6];

        // Create a description of the event
        EventDataDescCreate(&Descriptors[0], &hD3DAllocation, 8);
        EventDataDescCreate(&Descriptors[1], &hDxgAllocation, 8);
        EventDataDescCreate(&Descriptors[2], &Offset, 8);
        EventDataDescCreate(&Descriptors[3], &Size, 8);
        EventDataDescCreate(&Descriptors[4], &Usage, 4);
        EventDataDescCreate(&Descriptors[5], &Semantic, 4);

        // Log the event
        EventWrite(
            RegHandle,
            Enter ? (InRundown ? &RundownAllocationEvent : &MapAllocationEvent) : &UnmapAllocationEvent,
            sizeof(Descriptors) / sizeof(Descriptors[0]),
            Descriptors
        );
    }
}

FORCEINLINE void UMDEtwLogMapAllocation(ULONGLONG hD3DAllocation,
                            ULONGLONG hDxgAllocation,
                            ULONGLONG Offset,
                            ULONGLONG Size,
                            UMDETW_ALLOCATION_USAGE Usage,
                            UMDETW_ALLOCATION_SEMANTIC Semantic)
{
    LogMapAllocation(TRUE,
                     hD3DAllocation,
                     hDxgAllocation,
                     Offset,
                     Size,
                     Usage,
                     Semantic);
}

See also

CreateResource

CreateResource(D3D10)

UMDETW_ALLOCATION_SEMANTIC

UMDETW_ALLOCATION_USAGE