6.24. VDPAU 互操作性

本节介绍 CUDA 运行时应用程序编程接口的 VDPAU 互操作性函数。

函数

__host__cudaError_t cudaGraphicsVDPAURegisterOutputSurface ( cudaGraphicsResource** resource, VdpOutputSurface vdpSurface, unsigned int  flags )
注册 VdpOutputSurface 对象。
__host__cudaError_t cudaGraphicsVDPAURegisterVideoSurface ( cudaGraphicsResource** resource, VdpVideoSurface vdpSurface, unsigned int  flags )
注册 VdpVideoSurface 对象。
__host__cudaError_t cudaVDPAUGetDevice ( int* device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress )
获取与 VdpDevice 关联的 CUDA 设备。
__host__cudaError_t cudaVDPAUSetVDPAUDevice ( int  device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress )
设置 CUDA 设备以使用 VDPAU 互操作性。

函数

__host__cudaError_t cudaGraphicsVDPAURegisterOutputSurface ( cudaGraphicsResource** resource, VdpOutputSurface vdpSurface, unsigned int  flags )
注册 VdpOutputSurface 对象。
参数
resource
- 指向返回的对象句柄的指针
vdpSurface
- 要注册的 VDPAU 对象
flags
- 映射标志
描述

注册由以下项指定的 VdpOutputSurfacevdpSurface以便 CUDA 访问。已注册对象的句柄作为resource返回。表面的预期用途使用flags指定,如下所示

注意

请注意,此函数也可能返回来自先前异步启动的错误代码。

另请参阅

cudaVDPAUSetVDPAUDevice, cudaGraphicsUnregisterResource, cudaGraphicsSubResourceGetMappedArray, cuGraphicsVDPAURegisterOutputSurface

__host__cudaError_t cudaGraphicsVDPAURegisterVideoSurface ( cudaGraphicsResource** resource, VdpVideoSurface vdpSurface, unsigned int  flags )
注册 VdpVideoSurface 对象。
参数
resource
- 指向返回的对象句柄的指针
vdpSurface
- 要注册的 VDPAU 对象
flags
- 映射标志
描述

注册由以下项指定的 VdpVideoSurfacevdpSurface以便 CUDA 访问。已注册对象的句柄作为resource返回。表面的预期用途使用flags指定,如下所示

注意

请注意,此函数也可能返回来自先前异步启动的错误代码。

另请参阅

cudaVDPAUSetVDPAUDevice, cudaGraphicsUnregisterResource, cudaGraphicsSubResourceGetMappedArray, cuGraphicsVDPAURegisterVideoSurface

__host__cudaError_t cudaVDPAUGetDevice ( int* device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress )
获取与 VdpDevice 关联的 CUDA 设备。
参数
device
- 返回与 vdpDevice 关联的设备,如果与 vdpDevice 关联的设备不是计算设备,则返回 -1。
vdpDevice
- VdpDevice 句柄
vdpGetProcAddress
- VDPAU 的 VdpGetProcAddress 函数指针
返回值

cudaSuccess

描述

返回与 VdpDevice 关联的 CUDA 设备(如果适用)。

注意

请注意,此函数也可能返回来自先前异步启动的错误代码。

另请参阅

cudaVDPAUSetVDPAUDevice, cuVDPAUGetDevice

__host__cudaError_t cudaVDPAUSetVDPAUDevice ( int  device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress )
设置 CUDA 设备以使用 VDPAU 互操作性。
参数
device
- 用于 VDPAU 互操作性的设备
vdpDevice
- 要与之互操作的 VdpDevice
vdpGetProcAddress
- VDPAU 的 VdpGetProcAddress 函数指针
描述

记录vdpDevice作为 CUDA 设备的 VDPAU 互操作性的 VdpDevicedevice并设置device作为调用主机线程的当前设备。

如果需要,此函数将立即初始化device上的主上下文。

如果device已初始化,则此调用将失败,并显示错误 cudaErrorSetOnActiveProcess。在这种情况下,有必要使用 cudaDeviceReset() 重置device,然后才能在device上启用 VDPAU 互操作性。

注意

请注意,此函数也可能返回来自先前异步启动的错误代码。

另请参阅

cudaGraphicsVDPAURegisterVideoSurface, cudaGraphicsVDPAURegisterOutputSurface, cudaDeviceReset