Calling the ProcAmp Control DDI from a User-Mode Component

A user-mode component, such as the VMR, initiates calls to the ProcAmp Control DDI.

So that the VMR can access ProcAmp control functionality, the display driver must implement the motion compensation callback functions, which are defined by members of the DD_MOTIONCOMPCALLBACKS structure.

To simplify driver development, driver writers can use a motion-compensation code template, and implement the ProcAmp control sample functions. The motion-compensation template calls its ProcAmp control sample functions to perform ProcAmp control operations. For more information about using a motion-compensation template, see Example Code for DirectX VA Devices.

The following steps explain how the VMR initiates calls to the ProcAmp Control DDI:

  1. When the VMR is added to a filter graph, it initiates a call to the driver-supplied DdMoCompGetGuids callback function to retrieve the list of devices supported by the driver. The GetMoCompGuids member of DD_MOTIONCOMPCALLBACKS points to this callback function. For more information about a filter graph, see KS Minidriver Architecture.

  2. If the deinterlace container device GUID is present, the VMR initiates a call to the DdMoCompCreate callback function to create an instance of the device. The CreateMoComp member of DD_MOTIONCOMPCALLBACKS points to the callback function. In the DdMoCompCreate call, a pointer to the container device GUID is specified in the lpGuid member of the DD_CREATEMOCOMPDATA structure. The container device GUID is defined as follows:

    DEFINE_GUID(DXVA_DeinterlaceContainerDevice, 0x0e85cb93,0x3046,0x4ff0,0xae,0xcc,0xd5,0x8c,0xb5,0xf0,0x35,0xfd);
    
  3. To determine capabilities of the ProcAmp control device, the VMR initiates a call to the driver-supplied DdMoCompRender callback function. The RenderMoComp member of DD_MOTIONCOMPCALLBACKS points to the callback function. In the DdMoCompRender call, the DXVA_ProcAmpControlQueryCapsFnCode constant (defined in dxva.h) is set in the dwFunction member of the DD_RENDERMOCOMPDATA structure. The lpInputData member of DD_RENDERMOCOMPDATA passes the input parameters to the driver by pointing to a DXVA_VideoDesc structure. The driver returns its output through the lpOutputData member of DD_RENDERMOCOMPDATA; lpOutputData points to a DXVA_ProcAmpControlCaps structure.

    If the driver implements a ProcAmpControlQueryCaps sample function, the DdMoCompRender callback function calls ProcAmpControlQueryCaps.

  4. For each ProcAmp adjustment property supported by the hardware, the VMR initiates a call to the driver-supplied DdMoCompRendercallback function. In the DdMoCompRender call, the DXVA_ProcAmpControlQueryCapsFnCode constant (defined in dxva.h) is set in the dwFunction member of DD_RENDERMOCOMPDATA. The lpInputData member of DD_RENDERMOCOMPDATA passes the input parameters to the driver by pointing to a completed DXVA_ProcAmpControlQueryRange structure. The driver returns its output through the lpOutputData member of DD_RENDERMOCOMPDATA; lpOutputData points to a DXVA_VideoPropertyRange structure.

    If the driver implements a ProcAmpControlQueryRange sample function, the DdMoCompRender callback function calls ProcAmpControlQueryRange.

  5. After the VMR has determined the ProcAmp adjustment capabilities of the hardware, it initiates a call to DdMoCompCreate to create an instance of the ProcAmp control device. In the DdMoCompCreate call, a pointer to the ProcAmp control device GUID is specified in the lpGuid member of DD_CREATEMOCOMPDATA. The ProcAmp control device GUID is defined as follows:

    DEFINE_GUID(DXVA_ProcAmpControlDevice, 0x9f200913,0x2ffd,0x4056,0x9f,0x1e,0xe1,0xb5,0x08,0xf2,0x2d,0xcf); 
    

    If the driver implements a ProcAmpControlOpenStream sample function, the DdMoCompCreate callback function calls ProcAmpControlOpenStream.

  6. For each ProcAmp adjusting operation, the VMR initiates a call to the driver-supplied DdMoCompRendercallback function. In the DdMoCompRender call, the DXVA_ProcAmpControlQueryCapsFnCode constant (defined in dxva.h) is set in the dwFunction member of DD_RENDERMOCOMPDATA. The lpBufferInfo member of DD_RENDERMOCOMPDATA points to an array of two buffers that describe the destination and source surfaces. The lpInputData member of DD_RENDERMOCOMPDATA passes the input parameters to the driver by pointing to a completed DXVA_ProcAmpControlBlt structure. The driver does not return any output; that is, the lpOutputData member of DD_RENDERMOCOMPDATA is NULL.

    If the driver implements a ProcAmpControlBlt sample function, the DdMoCompRender callback function calls ProcAmpControlBlt.

  7. When the VMR no longer needs to perform any more ProcAmp control operations, the driver-supplied DdMoCompDestroy callback function is called. The DestroyMoComp member of DD_MOTIONCOMPCALLBACKS points to the callback function.

    If the driver implements a ProcAmpControlCloseStream sample function, the DdMoCompDestroy callback function calls ProcAmpControlCloseStream.

  8. The driver releases any resources used by the ProcAmp control device.