다음을 통해 공유


Calling the COPP DDI from a User-Mode Component

This section applies only to Windows Server 2003 SP1 and later, and Windows XP SP2 and later.

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

So that the VMR can notify the video miniport driver to apply protection to the graphics adapter's video output, 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 COPP IOCTLs and the COPP sample functions. The display driver and video miniport driver use the COPP IOCTLs to communicate. For more information, see Calling the COPP DDI from the Display Driver. The motion-compensation code template initiates calls to the COPP sample functions. For more information about using a motion-compensation code template, see Example Code for DirectX VA Devices.

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

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

  2. If the DirectX VA COPP device GUID is present, then the VMR initiates a call to the DdMoCompCreate callback function to initialize a COPP device on the current video session. The CreateMoComp member of DD_MOTIONCOMPCALLBACKS points to the callback function. In the DdMoCompCreate call, a pointer to the COPP device GUID is specified in the lpGuid member of the DD_CREATEMOCOMPDATA structure. The COPP device GUID is defined as follows:

    DEFINE_GUID(DXVA_COPPDevice, 0xd2457add,0x8999,0x45ed,0x8a,0x8a,0xd1,0xaa,0x04,0x7b,0xa4,0xd5);
    

    The display driver must communicate with the video miniport driver by using a COPP IOCTL. If the video miniport driver implements a COPPOpenVideoSession sample function, then the DdMoCompCreate callback function initiates the call to COPPOpenVideoSession.

  3. To determine the length of the variable-length graphics hardware certificate that should be used for the current video session, the VMR initiates a call to the display driver-supplied DdMoCompRender callback function. The RenderMoComp member of DD_MOTIONCOMPCALLBACKS points to the callback function. In the DdMoCompRender call, the dwFunction member of DD_RENDERMOCOMPDATA is set to the value DXVA_COPPGetCertificateLengthFnCode (defined in dxva.h). The display driver does not receive any input in this call; that is, the lpInputData member of DD_RENDERMOCOMPDATA is NULL. The display driver returns the length of the certificate through the lpOutputData member of DD_RENDERMOCOMPDATA; lpOutputData points to a DWORD data type.

    The display driver must communicate with the video miniport driver by using a COPP IOCTL. If the video miniport driver implements a COPPGetCertificateLength sample function, then the DdMoCompRender callback function initiates the call to COPPGetCertificateLength.

  4. To retrieve the certificate used by the graphics hardware, the VMR initiates a call to the display driver-supplied DdMoCompRender callback function. In the DdMoCompRender call, the dwFunction member of DD_RENDERMOCOMPDATA is set to the value DXVA_COPPKeyExchangeFnCode (defined in dxva.h). The display driver does not receive any input in this call; that is, the lpInputData member of DD_RENDERMOCOMPDATA is NULL. The lpBufferInfo member of DD_RENDERMOCOMPDATA points to a single RGB32 system memory surface that contains the space required for the display driver to store the certificate. The display driver returns the 128-bit random number that it generated through the lpOutputData member of DD_RENDERMOCOMPDATA.

    The display driver must communicate with the video miniport driver by using a COPP IOCTL. If the video miniport driver implements a COPPKeyExchange sample function, then the DdMoCompRender callback function initiates the call to COPPKeyExchange.

  5. To set the current video session to protected mode, the VMR initiates a call to the display driver-supplied DdMoCompRender callback function. In the DdMoCompRender call, the dwFunction member of DD_RENDERMOCOMPDATA is set to the value DXVA_COPPSequenceStartFnCode (defined in dxva.h). The lpInputData member of DD_RENDERMOCOMPDATA passes the input command and status sequence start codes to the display driver by pointing to a completed DXVA_COPPSignature structure. The display driver does not return any output; that is, the lpOutputData member of DD_RENDERMOCOMPDATA is NULL.

    The display driver must communicate with the video miniport driver by using a COPP IOCTL. If the video miniport driver implements a COPPSequenceStart sample function, then the DdMoCompRender callback function initiates the call to COPPSequenceStart.

  6. To set the protection level on the physical connector associated with the DirectX VA COPP device, the VMR initiates a call to the display driver-supplied DdMoCompRender callback function. In the DdMoCompRender call, the dwFunction member of DD_RENDERMOCOMPDATA is set to the value DXVA_COPPCommandFnCode (defined in dxva.h). The lpInputData member of DD_RENDERMOCOMPDATA passes the input parameters to the display driver by pointing to a completed DXVA_COPPCommand structure. The display driver does not return any output; that is, the lpOutputData member of DD_RENDERMOCOMPDATA is NULL.

    The display driver must communicate with the video miniport driver by using a COPP IOCTL. If the video miniport driver implements a COPPCommand sample function, then the DdMoCompRender callback function initiates the call to COPPCommand.

  7. To retrieve protection information regarding the physical connector being used, the VMR initiates a call to the display driver-supplied DdMoCompRender callback function. In the DdMoCompRender call, the dwFunction member of DD_RENDERMOCOMPDATA is set to the value DXVA_COPPQueryStatusFnCode (defined in dxva.h). The lpInputData member of DD_RENDERMOCOMPDATA passes the input parameters to the display driver by pointing to a completed DXVA_COPPStatusInput structure. The display driver returns its output through the lpOutputData member of DD_RENDERMOCOMPDATA; lpOutputData points to a DXVA_COPPStatusOutput structure.

    The display driver must communicate with the video miniport driver by using a COPP IOCTL. If the video miniport driver implements a COPPQueryStatus sample function, then the DdMoCompRender callback function initiates the call to COPPQueryStatus.

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

    The display driver must communicate with the video miniport driver by using a COPP IOCTL. If the video miniport driver implements a COPPCloseVideoSession sample function, then the DdMoCompDestroy callback function initiates the call to COPPCloseVideoSession.

  9. The drivers then release any resources used by the DirectX VA COPP device.