L4T Multimedia API Reference28.1 Release |
Helper class for rendering using LibDRM.
The renderer requires the fd of a buffer as an input. The caller must set the rendering rate, in terms of frames per second (FPS).
The caller specifies the width, height connector and crtc index. Based on connector and crtc index, the renderer finds a suitable encoder and configures the crtc mode.
Definition at line 66 of file NvDrmRenderer.h.
Public Member Functions | |
~NvDrmRenderer () | |
int | enqueBuffer (int fd) |
Enqueues a buffer fd for rendering. More... | |
int | dequeBuffer () |
Dequeues a previously rendered buffer. More... | |
int | setFPS (float fps) |
Sets the rendering rate in terms of frames per second. 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 a framebuffer. 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... | |
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 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) |
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... | |
NvDrmRenderer::~NvDrmRenderer | ( | ) |
|
static |
Creates a new DRM based renderer named name.
[in] | name | Unique name to identity the element instance. |
[in] | width | Width of the window in pixels. |
[in] | height | Height of the window in pixels. |
[in] | w_x | x offset of window location. |
[in] | w_y | y offset of window location. |
[in] | connector | index of connector to use. |
[in] | crtc | index of crtc to use. |
uint32_t NvDrmRenderer::createDumbFB | ( | uint32_t | width, |
uint32_t | height, | ||
uint32_t | drm_format, | ||
NvDrmFB * | fb | ||
) |
Allocates a framebuffer of size (w, h).
[in] | width | Framebuffer width in pixels. |
[in] | height | Framebuffer height in pixels. |
[in] | drm_format | DRM format of the bo_handle(s). |
[out] | fb | A pointer to an NvDrmFB structure that contains the fb_id and the buffer mapping. |
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 last buffer can be used when the renderer is closed or after sending an EOS to the component.
|
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
.
[in] | enable | 1 or 0 to enable/disable the caps. |
int NvDrmRenderer::enqueBuffer | ( | int | fd | ) |
Enqueues a buffer fd for rendering.
This is a non-blocking call. This function waits until the rendering time of the next buffer. The rendering time is calculated based on the rendering time of the last buffer and the rendering rate fps.
[in] | fd | FD of the exported buffer to render. |
int NvDrmRenderer::getCrtcCount | ( | ) |
Gets count of available crtcs.
int NvDrmRenderer::getEncoderCount | ( | ) |
Gets 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.
|
inherited |
Gets profiling data for the element.
|
inlinevirtualinherited |
Indicates whether the element encountered an error during its operation.
Reimplemented in NvV4l2Element.
Definition at line 72 of file NvElement.h.
References NvElement::is_in_error.
|
inherited |
Checks whether profiling is enabled for the element.
|
inherited |
Prints profiling data for the element to an output stream.
[in] | out_stream | Output 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 a framebuffer.
Destroys (frees) a framebuffer previously allocated by createDumbFB().
fb_id | The ID of the framebuffer to destroy. |
-ENOENT
if the framebuffer is not found. int NvDrmRenderer::setFPS | ( | float | fps | ) |
Sets the rendering rate in terms of frames per second.
[in] | fps | Render rate in terms of frames per second |
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.
-ERANGE
when given this value.)setPlane
operations are synced to vblank and are blocking.pl_index | Plane Index of the plane to be changed. |
fb_id | Framebuffer ID of the framebuffer to display on the plane, or -1 to leave the framebuffer unchanged. |
crtc_x | Offset from left of active display region to show plane. |
crtc_y | Offset from top of active display region to show plane. |
crtc_w | Width of output rectangle on display. |
crtc_h | Height of output rectangle on display. |
src_x | Clip offset from left of source framebuffer (Q16.16 fixed point). |
src_y | Clip offset from top of source framebuffer (Q16.16 fixed point). |
src_w | Width of source rectangle (Q16.16 fixed point). |
src_h | Height of source rectangle (Q16.16 fixed point). |
0 | if successful. |
-EINVAL | if pl_index is invalid. |
-errno | otherwise. |
|
protectedinherited |
Specifies the name of the component, for debugging.
Definition at line 122 of file NvElement.h.
|
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().
|
protectedinherited |
Profiler for the element.
Definition at line 124 of file NvElement.h.