6.43. VDPAU互操作性

本节介绍CUDA底层驱动应用程序编程接口中的VDPAU互操作性功能。

Functions

CUresult cuGraphicsVDPAURegisterOutputSurface ( CUgraphicsResource* pCudaResource, VdpOutputSurface vdpSurface, unsigned int  flags )
Registers a VDPAU VdpOutputSurface object.
CUresult cuGraphicsVDPAURegisterVideoSurface ( CUgraphicsResource* pCudaResource, VdpVideoSurface vdpSurface, unsigned int  flags )
Registers a VDPAU VdpVideoSurface object.
CUresult cuVDPAUCtxCreate ( CUcontext* pCtx, unsigned int  flags, CUdevice device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress )
Create a CUDA context for interoperability with VDPAU.
CUresult cuVDPAUGetDevice ( CUdevice* pDevice, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress )
Gets the CUDA device associated with a VDPAU device.

Functions

CUresult cuGraphicsVDPAURegisterOutputSurface ( CUgraphicsResource* pCudaResource, VdpOutputSurface vdpSurface, unsigned int  flags )
注册一个VDPAU VdpOutputSurface对象。
参数
pCudaResource
- Pointer to the returned object handle
vdpSurface
- The VdpOutputSurface to be registered
flags
- Map flags
描述

将由vdpSurface指定的VdpOutputSurface注册为可供CUDA访问。注册对象的句柄将作为pCudaResource返回。该表面的预期用途通过flags参数指定,具体如下:

  • CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE: 指定不提供关于该资源使用方式的提示。因此默认假设该资源将被CUDA读取和写入。这是默认值。

  • CU_GRAPHICS_MAP_RESOURCE_FLAGS_READ_ONLY: 指定CUDA不会写入该资源。

  • CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITE_DISCARD: 指定CUDA不会读取该资源,而是会覆盖资源的全部内容,因此资源中原先存储的所有数据都不会被保留。

VdpOutputSurface 呈现为一个子资源数组,可通过 cuGraphicsSubResourceGetMappedArray 返回的指针进行访问。有效的 arrayIndex 值的确切数量取决于 VDPAU 表面格式。具体映射关系如下表所示。mipLevel 必须为 0。

Note:

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

另请参阅:

cuCtxCreate, cuVDPAUCtxCreate, cuGraphicsVDPAURegisterVideoSurface, cuGraphicsUnregisterResource, cuGraphicsResourceSetMapFlags, cuGraphicsMapResources, cuGraphicsUnmapResources, cuGraphicsSubResourceGetMappedArray, cuVDPAUGetDevice, cudaGraphicsVDPAURegisterOutputSurface

CUresult cuGraphicsVDPAURegisterVideoSurface ( CUgraphicsResource* pCudaResource, VdpVideoSurface vdpSurface, unsigned int  flags )
注册一个VDPAU VdpVideoSurface对象。
参数
pCudaResource
- Pointer to the returned object handle
vdpSurface
- The VdpVideoSurface to be registered
flags
- Map flags
描述

将由vdpSurface指定的VdpVideoSurface注册为可供CUDA访问。注册对象的句柄将作为pCudaResource返回。该表面的预期用途通过flags参数指定,具体如下:

  • CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE: 指定不提供关于该资源使用方式的提示。因此默认假设该资源将被CUDA读取和写入。这是默认值。

  • CU_GRAPHICS_MAP_RESOURCE_FLAGS_READ_ONLY: 指定CUDA不会写入该资源。

  • CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITE_DISCARD: 指定CUDA不会读取该资源,而是会覆盖资源的全部内容,因此资源中原先存储的所有数据都不会被保留。

VdpVideoSurface 呈现为一个子资源数组,可通过 cuGraphicsSubResourceGetMappedArray 返回的指针进行访问。有效的 arrayIndex 值的确切数量取决于 VDPAU 表面格式。具体映射关系如下表所示。mipLevel 必须为 0。

Note:

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

另请参阅:

cuCtxCreate, cuVDPAUCtxCreate, cuGraphicsVDPAURegisterOutputSurface, cuGraphicsUnregisterResource, cuGraphicsResourceSetMapFlags, cuGraphicsMapResources, cuGraphicsUnmapResources, cuGraphicsSubResourceGetMappedArray, cuVDPAUGetDevice, cudaGraphicsVDPAURegisterVideoSurface

CUresult cuVDPAUCtxCreate ( CUcontext* pCtx, unsigned int  flags, CUdevice device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress )
为与VDPAU互操作创建CUDA上下文。
参数
pCtx
- Returned CUDA context
flags
- Options for CUDA context creation
device
- Device on which to create the context
vdpDevice
- The VdpDevice to interop with
vdpGetProcAddress
- VDPAU's VdpGetProcAddress function pointer
描述

创建一个新的CUDA上下文,初始化VDPAU互操作性,并将CUDA上下文与调用线程关联。在执行任何其他VDPAU互操作性操作之前必须调用此函数。如果所需的VDPAU驱动程序功能不可用,可能会失败。关于flags参数的使用,请参阅cuCtxCreate()

Note:

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

另请参阅:

cuCtxCreate, cuGraphicsVDPAURegisterVideoSurface, cuGraphicsVDPAURegisterOutputSurface, cuGraphicsUnregisterResource, cuGraphicsResourceSetMapFlags, cuGraphicsMapResources, cuGraphicsUnmapResources, cuGraphicsSubResourceGetMappedArray, cuVDPAUGetDevice

CUresult cuVDPAUGetDevice ( CUdevice* pDevice, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress )
获取与VDPAU设备关联的CUDA设备。
参数
pDevice
- Device associated with vdpDevice
vdpDevice
- A VdpDevice handle
vdpGetProcAddress
- VDPAU's VdpGetProcAddress function pointer
描述

如果适用,返回与vdpDevice关联的CUDA设备到*pDevice中。

Note:

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

另请参阅:

cuCtxCreate, cuVDPAUCtxCreate, cuGraphicsVDPAURegisterVideoSurface, cuGraphicsVDPAURegisterOutputSurface, cuGraphicsUnregisterResource, cuGraphicsResourceSetMapFlags, cuGraphicsMapResources, cuGraphicsUnmapResources, cuGraphicsSubResourceGetMappedArray, cudaVDPAUGetDevice