sourCEntral - mobile manpages

pdf

EGL Interoperability

NAME

EGL Interoperability −

Functions

cudaError_t cudaEGLStreamConsumerAcquireFrame (cudaEglStreamConnection *conn, cudaGraphicsResource_t *pCudaResource, cudaStream_t *pStream, unsigned int timeout)
Acquire an image frame from the EGLStream with CUDA as a consumer.

cudaError_t cudaEGLStreamConsumerConnect
(cudaEglStreamConnection *conn, EGLStreamKHR eglStream)
Connect CUDA to EGLStream as a consumer.

cudaError_t cudaEGLStreamConsumerConnectWithFlags
(cudaEglStreamConnection *conn, EGLStreamKHR eglStream, unsigned int flags)
Connect CUDA to EGLStream as a consumer with given flags.

cudaError_t cudaEGLStreamConsumerReleaseFrame
(cudaEglStreamConnection *conn, cudaGraphicsResource_t pCudaResource, cudaStream_t *pStream)
Releases the last frame acquired from the EGLStream.

cudaError_t cudaEGLStreamProducerConnect
(cudaEglStreamConnection *conn, EGLStreamKHR eglStream, EGLint width, EGLint height)
Connect CUDA to EGLStream as a producer.

cudaError_t cudaEGLStreamProducerDisconnect
(cudaEglStreamConnection *conn)
Disconnect CUDA as a producer to EGLStream .

cudaError_t cudaEGLStreamProducerPresentFrame
(cudaEglStreamConnection *conn, cudaEglFrame eglframe, cudaStream_t *pStream)
Present a CUDA eglFrame to the EGLStream with CUDA as a producer.

cudaError_t cudaEGLStreamProducerReturnFrame
(cudaEglStreamConnection *conn, cudaEglFrame *eglframe, cudaStream_t *pStream)
Return the CUDA eglFrame to the EGLStream last released by the consumer.

cudaError_t cudaGraphicsEGLRegisterImage
(struct cudaGraphicsResource **pCudaResource, EGLImageKHR image, unsigned int flags)
Registers an EGL image.

cudaError_t cudaGraphicsResourceGetMappedEglFrame
(cudaEglFrame *eglFrame, cudaGraphicsResource_t resource, unsigned int index, unsigned int mipLevel)
Get an eglFrame through which to access a registered EGL graphics resource.

Detailed Description

This section describes the EGL interoperability functions of the CUDA runtime application programming interface. Note that mapping of EGL resources is performed with the graphics API agnostic, resource mapping interface described in Graphics Interopability.

Function Documentation

cudaError_t cudaEGLStreamConsumerAcquireFrame (cudaEglStreamConnection * conn, cudaGraphicsResource_t * pCudaResource, cudaStream_t * pStream, unsigned int timeout)
Acquire an image frame from EGLStreamKHR. cudaGraphicsResourceGetMappedEglFrame can be called on pCudaResource to get cudaEglFrame.

Parameters:

conn - Connection on which to acquire
pCudaResource
- CUDA resource on which the EGLStream frame will be mapped for use.
pStream
- CUDA stream for synchronization and any data migrations implied by cudaEglResourceLocationFlags.
timeout
- Desired timeout in usec.

Returns:

cudaSuccess, cudaErrorInvalidValue, cudaErrorUnknown

See also:

cudaEGLStreamConsumerConnect, cudaEGLStreamConsumerDisconnect, cudaEGLStreamConsumerReleaseFrame

cudaError_t cudaEGLStreamConsumerConnect (cudaEglStreamConnection * conn, EGLStreamKHR eglStream)
Connect CUDA as a consumer to EGLStreamKHR specified by eglStream.

The EGLStreamKHR is an EGL object that transfers a sequence of image frames from one API to another.

Parameters:

conn - Pointer to the returned connection handle
eglStream
- EGLStreamKHR handle

Returns:

cudaSuccess, cudaErrorInvalidValue, cudaErrorUnknown

See also:

cudaEGLStreamConsumerDisconnect, cudaEGLStreamConsumerAcquireFrame, cudaEGLStreamConsumerReleaseFrame

cudaError_t cudaEGLStreamConsumerConnectWithFlags (cudaEglStreamConnection * conn, EGLStreamKHR eglStream, unsigned int flags)
Connect CUDA as a consumer to EGLStreamKHR specified by stream with specified flags defined by cudaEglResourceLocationFlags.

The flags specify whether the consumer wants to access frames from system memory or video memory. Default is cudaEglResourceLocationVidmem.

Parameters:

conn - Pointer to the returned connection handle
eglStream
- EGLStreamKHR handle
flags
- Flags denote intended location - system or video.

Returns:

cudaSuccess, cudaErrorInvalidValue, cudaErrorUnknown

See also:

cudaEGLStreamConsumerDisconnect, cudaEGLStreamConsumerAcquireFrame, cudaEGLStreamConsumerReleaseFrame

cudaError_t cudaEGLStreamConsumerReleaseFrame (cudaEglStreamConnection * conn, cudaGraphicsResource_t pCudaResource, cudaStream_t * pStream)
Release the acquired image frame specified by pCudaResource to EGLStreamKHR.

Parameters:

conn - Connection on which to release
pCudaResource
- CUDA resource whose corresponding frame is to be released
pStream
- CUDA stream on which release will be done.

Returns:

cudaSuccess, cudaErrorInvalidValue, cudaErrorUnknown

See also:

cudaEGLStreamConsumerConnect, cudaEGLStreamConsumerDisconnect, cudaEGLStreamConsumerAcquireFrame,

cudaError_t cudaEGLStreamProducerConnect (cudaEglStreamConnection * conn, EGLStreamKHR eglStream, EGLint width, EGLint height)
Connect CUDA as a producer to EGLStreamKHR specified by stream.

The EGLStreamKHR is an EGL object that transfers a sequence of image frames from one API to another.

Parameters:

conn - Pointer to the returned connection handle
eglStream
- EGLStreamKHR handle
width
- width of the image to be submitted to the stream
height
- height of the image to be submitted to the stream

Returns:

cudaSuccess, cudaErrorInvalidValue, cudaErrorUnknown

See also:

cudaEGLStreamProducerDisconnect, cudaEGLStreamProducerPresentFrame, cudaEGLStreamProducerReturnFrame

cudaError_t cudaEGLStreamProducerDisconnect (cudaEglStreamConnection * conn)
Disconnect CUDA as a producer to EGLStreamKHR.

Parameters:

conn - Connection to disconnect.

Returns:

cudaSuccess, cudaErrorInvalidValue, cudaErrorUnknown

See also:

cudaEGLStreamProducerConnect, cudaEGLStreamProducerPresentFrame, cudaEGLStreamProducerReturnFrame

cudaError_t cudaEGLStreamProducerPresentFrame (cudaEglStreamConnection * conn, cudaEglFrame eglframe, cudaStream_t * pStream)
The cudaEglFrame is defined as:

typedef struct cudaEglFrame_st {
union {
cudaArray_t pArray[CUDA_EGL_MAX_PLANES];
struct cudaPitchedPtr pPitch[CUDA_EGL_MAX_PLANES];
} frame;
cudaEglPlaneDesc planeDesc[CUDA_EGL_MAX_PLANES];
unsigned int planeCount;
cudaEglFrameType frameType;
cudaEglColorFormat eglColorFormat;
} cudaEglFrame;

Parameters:

conn - Connection on which to present the CUDA array
eglframe
- CUDA Eglstream Proucer Frame handle to be sent to the consumer over EglStream.
pStream
- CUDA stream on which to present the frame.

Returns:

cudaSuccess, cudaErrorInvalidValue, cudaErrorUnknown

See also:

cudaEGLStreamProducerConnect, cudaEGLStreamProducerDisconnect, cudaEGLStreamProducerReturnFrame

cudaError_t cudaEGLStreamProducerReturnFrame (cudaEglStreamConnection * conn, cudaEglFrame * eglframe, cudaStream_t * pStream)
This API can potentially return cudaErrorLaunchTimeout if the consumer has not returned a frame to EGL stream. If timeout is returned the application can retry.

Parameters:

conn - Connection on which to present the CUDA array
eglframe
- CUDA Eglstream Proucer Frame handle returned from the consumer over EglStream.
pStream
- CUDA stream on which to return the frame.

Returns:

cudaSuccess, cudaErrorLaunchTimeout, cudaErrorInvalidValue, cudaErrorUnknown

See also:

cudaEGLStreamProducerConnect, cudaEGLStreamProducerDisconnect, cudaEGLStreamProducerPresentFrame,

cudaError_t cudaGraphicsEGLRegisterImage (struct cudaGraphicsResource ** pCudaResource, EGLImageKHR image, unsigned int flags)
Registers the EGLImageKHR specified by image for access by CUDA. A handle to the registered object is returned as pCudaResource. Additional Mapping/Unmapping is not required for the registered resource and cudaGraphicsResourceGetMappedEglFrame can be directly called on the pCudaResource.

The application will be responsible for synchronizing access to shared objects. The application must ensure that any pending operation which access the objects have completed before passing control to CUDA. This may be accomplished by issuing and waiting for glFinish command on all GLcontexts (for OpenGL and likewise for other APIs). The application will be also responsible for ensuring that any pending operation on the registered CUDA resource has completed prior to executing subsequent commands in other APIs accessing the same memory objects. This can be accomplished by calling cuCtxSynchronize or cuEventSynchronize (preferably).

The surface’s intended usage is specified using flags, as follows:

cudaGraphicsRegisterFlagsNone: Specifies no hints about how this resource will be used. It is therefore assumed that this resource will be read from and written to by CUDA. This is the default value.

cudaGraphicsRegisterFlagsReadOnly: Specifies that CUDA will not write to this resource.

cudaGraphicsRegisterFlagsWriteDiscard: Specifies that CUDA will not read from this resource and will write over the entire contents of the resource, so none of the data previously stored in the resource will be preserved.

The EGLImageKHR is an object which can be used to create EGLImage target resource. It is defined as a void pointer. typedef void* EGLImageKHR

Parameters:

pCudaResource - Pointer to the returned object handle
image
- An EGLImageKHR image which can be used to create target resource.
flags
- Map flags

Returns:

cudaSuccess, cudaErrorInvalidResourceHandle, cudaErrorInvalidValue, cudaErrorUnknown

See also:

cudaGraphicsUnregisterResource, cudaGraphicsResourceGetMappedEglFrame

cudaError_t cudaGraphicsResourceGetMappedEglFrame (cudaEglFrame * eglFrame, cudaGraphicsResource_t resource, unsigned int index, unsigned int mipLevel)
Returns in *eglFrame an eglFrame pointer through which the registered graphics resource resource may be accessed. This API can only be called for EGL graphics resources.

The cudaEglFrame is defined as

typedef struct cudaEglFrame_st {
union {
cudaArray_t pArray[CUDA_EGL_MAX_PLANES];
struct cudaPitchedPtr pPitch[CUDA_EGL_MAX_PLANES];
} frame;
cudaEglPlaneDesc planeDesc[CUDA_EGL_MAX_PLANES];
unsigned int planeCount;
cudaEglFrameType frameType;
cudaEglColorFormat eglColorFormat;
} cudaEglFrame;

Parameters:

eglFrame - Returned eglFrame.
resource
- Registered resource to access.
index
- Index for cubemap surfaces.
mipLevel
- Mipmap level for the subresource to access.

Returns:

cudaSuccess, cudaErrorInvalidValue, cudaErrorUnknown

See also:

cudaGraphicsSubResourceGetMappedArray, cudaGraphicsResourceGetMappedPointer

Author

Generated automatically by Doxygen from the source code.

pdf