Jetson Linux API Reference

32.5 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NvDrmRenderer Class Reference

Detailed Description

Helper class for rendering using LibDRM.

The renderer requires the file descriptor of a buffer as input. The caller must set the rendering rate in frames per second (FPS).

The caller specifies the width, height, connector, and CRTC index. Based on the connector and CRTC index, the renderer finds a suitable encoder and configures the CRTC mode.

Definition at line 67 of file NvDrmRenderer.h.

Inheritance diagram for NvDrmRenderer:
Collaboration diagram for NvDrmRenderer:

Public Member Functions

 ~NvDrmRenderer ()
 
int enqueBuffer (int fd)
 Enqueues a buffer file descriptor for rendering. More...
 
int dequeBuffer ()
 Dequeues a previously rendered buffer. More...
 
int setFPS (float fps)
 Sets the rendering rate. More...
 
bool enableUniversalPlanes (int enable)
 Enables/disables DRM universal planes client caps, such as DRM_CLIENT_CAP_UNIVERSAL_PLANES. More...
 
uint32_t createDumbFB (uint32_t width, uint32_t height, uint32_t drm_format, NvDrmFB *fb)
 Allocates a framebuffer of size (w, h). More...
 
int removeFB (uint32_t fb_id)
 Destroys (frees) a framebuffer previously allocated by createDumbFB(). More...
 
int drmUtilCloseGemBo (int fd, uint32_t bo_handle)
 Close GEM (Graphics Execution Manager) handles. More...
 
int setPlane (uint32_t pl_index, uint32_t fb_id, uint32_t crtc_x, uint32_t crtc_y, uint32_t crtc_w, uint32_t crtc_h, uint32_t src_x, uint32_t src_y, uint32_t src_w, uint32_t src_h)
 Changes a plane's framebuffer and position. More...
 
int getPlaneCount ()
 Gets total number of planes available. More...
 
int getCrtcCount ()
 Gets count of available CRTCs. More...
 
int getEncoderCount ()
 Gets count of available encoders. More...
 
bool hdrSupported ()
 Checks whether HDR mode is supported on the DRM renderer. More...
 
int setHDRMetadataSmpte2086 (struct drm_tegra_hdr_metadata_smpte_2086)
 Sets the HDR metadata retrieved from the decoder. More...
 
virtual int isInError ()
 Indicates whether the element encountered an error during its operation. More...
 
void getProfilingData (NvElementProfiler::NvElementProfilerData &data)
 Gets profiling data for the element. More...
 
void printProfilingStats (std::ostream &out_stream=std::cout)
 Prints profiling data for the element to an output stream. More...
 
virtual void enableProfiling ()
 Enables profiling for the element. More...
 
bool isProfilingEnabled ()
 Checks whether profiling is enabled for the element. More...
 

Static Public Member Functions

static NvDrmRenderercreateDrmRenderer (const char *name, uint32_t width, uint32_t height, uint32_t w_x, uint32_t w_y, uint32_t connector, uint32_t crtc, struct drm_tegra_hdr_metadata_smpte_2086 metadata, bool streamHDR)
 Creates a new DRM based renderer named name. More...
 

Protected Attributes

int is_in_error
 Indicates if an error was encountered during the operation of the element. More...
 
const char * comp_name
 Specifies the name of the component, for debugging. More...
 
NvElementProfiler profiler
 Profiler for the element. More...
 

Constructor & Destructor Documentation

NvDrmRenderer::~NvDrmRenderer ( )

Member Function Documentation

static NvDrmRenderer* NvDrmRenderer::createDrmRenderer ( const char *  name,
uint32_t  width,
uint32_t  height,
uint32_t  w_x,
uint32_t  w_y,
uint32_t  connector,
uint32_t  crtc,
struct drm_tegra_hdr_metadata_smpte_2086  metadata,
bool  streamHDR 
)
static

Creates a new DRM based renderer named name.

Parameters
[in]nameUnique name to identity the element instance.
[in]widthWidth of the window in pixels.
[in]heightHeight of the window in pixels.
[in]w_xx offset of window location.
[in]w_yy offset of window location.
[in]connectorIndex of connector to use.
[in]crtcIndex of CRTC to use.
[in]metadataContains HDR metadata.
[in]streamHDRFlag indicating that current stream has HDR metadata, and hence metadata is set.
Returns
Reference to the newly created renderer object if successful, or NULL if initialization failed.
uint32_t NvDrmRenderer::createDumbFB ( uint32_t  width,
uint32_t  height,
uint32_t  drm_format,
NvDrmFB fb 
)

Allocates a framebuffer of size (w, h).

Postcondition
If the call is successful, the application must remove (free) the framebuffer by calling removeFB().
Parameters
[in]widthFramebuffer width in pixels.
[in]heightFramebuffer height in pixels.
[in]drm_formatDRM format of _NvDrmBO::bo_handle in *fb.
[out]fbA pointer to an NvDrmFB structure that contains the fb_id and the buffer mapping.
Returns
1 if successful, or 0 otherwise.
int NvDrmRenderer::dequeBuffer ( )

Dequeues a previously rendered buffer.

This is blocking function that waits until a free buffer is available. The renderer retains one buffer, which must not be overwritten by any other component. This buffer can be used when the renderer is closed or after sending an EOS to the component.

Returns
File descriptor of the previously rendered buffer.
int NvDrmRenderer::drmUtilCloseGemBo ( int  fd,
uint32_t  bo_handle 
)

Close GEM (Graphics Execution Manager) handles.

Parameters
fdFD of the buffer.
bo_handlethe gem-handle to be closed.
Returns
1 for success, 0 for failure.
virtual void NvElement::enableProfiling ( )
virtualinherited

Enables profiling for the element.

Reimplemented in NvV4l2Element.

bool NvDrmRenderer::enableUniversalPlanes ( int  enable)

Enables/disables DRM universal planes client caps, such as DRM_CLIENT_CAP_UNIVERSAL_PLANES.

Parameters
[in]enable1 to enable the caps, or 0 to disable.
Returns
true if successful, or false otherwise.
int NvDrmRenderer::enqueBuffer ( int  fd)

Enqueues a buffer file descriptor for rendering.

This is a non-blocking call. The function waits for the estimated rendering time of the next buffer. The estimated rendering time is calculated based on the rendering time of the last buffer and the rendering rate.

Parameters
[in]fdFile descriptor of the exported buffer to render.
Returns
0 if successful, or -1 otherwise.
int NvDrmRenderer::getCrtcCount ( )

Gets count of available CRTCs.

Returns
Count of available CRTCs.
int NvDrmRenderer::getEncoderCount ( )

Gets count of available encoders.

Returns
Count of available encoders.
int NvDrmRenderer::getPlaneCount ( )

Gets total number of planes available.

By default, the count returned includes only "Overlay" type (regular) planes—not "Primary" and "Cursor" planes. If DRM_CLIENT_CAP_UNIVERSAL_PLANES has been enabled with enableUniversalPlanes(), the count returned includes "Primary" and "Cursor" planes as well.

Returns
Count of total planes available.
void NvElement::getProfilingData ( NvElementProfiler::NvElementProfilerData data)
inherited

Gets profiling data for the element.

Returns
A constant reference to the element's profiling data.
bool NvDrmRenderer::hdrSupported ( )

Checks whether HDR mode is supported on the DRM renderer.

Returns
True if HDR mode is supported, or false otherwise.
virtual int NvElement::isInError ( )
inlinevirtualinherited

Indicates whether the element encountered an error during its operation.

Returns
0 if no error was encountered, a non-zero value if an error was encountered.

Reimplemented in NvV4l2Element.

Definition at line 72 of file NvElement.h.

References NvElement::is_in_error.

bool NvElement::isProfilingEnabled ( )
inherited

Checks whether profiling is enabled for the element.

Returns
Boolean value indicating if profiling is enabled.
void NvElement::printProfilingStats ( std::ostream &  out_stream = std::cout)
inherited

Prints profiling data for the element to an output stream.

Parameters
[in]out_streamOutput stream of type std::ostream to print the data to. It takes the default value std::cout if not specified.
int NvDrmRenderer::removeFB ( uint32_t  fb_id)

Destroys (frees) a framebuffer previously allocated by createDumbFB().

Parameters
fb_idID of the framebuffer to be destroyed.
Returns
0 if the framebuffer is successfully destroyed, or -ENOENT if the framebuffer is not found.
int NvDrmRenderer::setFPS ( float  fps)

Sets the rendering rate.

Warning
fps may not be set to zero.
Parameters
[in]fpsRendering rate in frames per second.
Returns
0 if successful, or -1 otherwise.
int NvDrmRenderer::setHDRMetadataSmpte2086 ( struct drm_tegra_hdr_metadata_smpte_2086  )

Sets the HDR metadata retrieved from the decoder.

Returns
0 if successful, or -1 otherwise.
int NvDrmRenderer::setPlane ( uint32_t  pl_index,
uint32_t  fb_id,
uint32_t  crtc_x,
uint32_t  crtc_y,
uint32_t  crtc_w,
uint32_t  crtc_h,
uint32_t  src_x,
uint32_t  src_y,
uint32_t  src_w,
uint32_t  src_h 
)

Changes a plane's framebuffer and position.

Note
The crtc_... and src_... parameters accept the special input value -1, which indicates that the hardware offset value is not to be changed. (Kernel-based DRM drivers return the error code -ERANGE when given this value.)
All setPlane() operations are synced to vblank and are blocking.
Parameters
pl_indexPlane index of the plane to be changed.
fb_idFramebuffer ID of the framebuffer to display on the plane, or -1 to leave the framebuffer unchanged.
crtc_xOffset from left of active display region to show plane.
crtc_yOffset from top of active display region to show plane.
crtc_wWidth of output rectangle on display.
crtc_hHeight of output rectangle on display.
src_xClip offset from left of source framebuffer (Q16.16 fixed point).
src_yClip offset from top of source framebuffer (Q16.16 fixed point).
src_wWidth of source rectangle (Q16.16 fixed point).
src_hHeight of source rectangle (Q16.16 fixed point).
Return values
0if successful.
-EINVALif pl_index is invalid.
-errnootherwise.

Field Documentation

const char* NvElement::comp_name
protectedinherited

Specifies the name of the component, for debugging.

Definition at line 122 of file NvElement.h.

int NvElement::is_in_error
protectedinherited

Indicates if an error was encountered during the operation of the element.

Definition at line 120 of file NvElement.h.

Referenced by NvElement::isInError().

NvElementProfiler NvElement::profiler
protectedinherited

Profiler for the element.

Definition at line 124 of file NvElement.h.


The documentation for this class was generated from the following file: