17 #ifndef __NV_DRM_RENDERER_H__
18 #define __NV_DRM_RENDERER_H__
24 #include <unordered_map>
86 uint32_t height, uint32_t w_x, uint32_t w_y,
87 uint32_t connector, uint32_t crtc,
88 struct drm_tegra_hdr_metadata_smpte_2086 metadata,
243 struct timespec last_render_time;
247 uint32_t width, height;
248 uint32_t drm_conn_id;
250 uint32_t drm_crtc_id;
255 bool renderingStarted;
260 std::queue<int> freeBuffers;
261 std::queue<int> pendingBuffers;
262 std::unordered_map <int, int> map_list;
266 pthread_t render_thread;
268 pthread_mutex_t render_lock;
269 pthread_cond_t render_cond;
270 pthread_mutex_t enqueue_lock;
271 pthread_cond_t enqueue_cond;
272 pthread_mutex_t dequeue_lock;
273 pthread_cond_t dequeue_cond;
276 uint64_t render_time_sec;
278 uint64_t render_time_nsec;
283 NvDrmRenderer(
const char *name, uint32_t width, uint32_t height,
284 uint32_t w_x, uint32_t w_y, uint32_t connector, uint32_t crtc,
285 struct drm_tegra_hdr_metadata_smpte_2086 metadata,
bool streamHDR);
294 static void * renderThread(
void *arg);
300 static void page_flip_handler(
int fd,
unsigned int frame,
301 unsigned int sec,
unsigned int usec,
void *data);
307 int renderInternal(
int fd);
312 int createDumbBO(
int w,
int h,
int bpp,
NvDrmBO *bo);
Helper class for rendering using LibDRM.
int setFPS(float fps)
Sets the rendering rate in terms of frames per second.
uint32_t createDumbFB(uint32_t width, uint32_t height, uint32_t drm_format, NvDrmFB *fb)
Allocates a framebuffer of size (w, h).
Holds information about the frame.
Holds a buffer object handle.
int format
Frame format, such as DRM_FORMAT_RGB332.
int getCrtcCount()
Gets count of available crtcs.
int getEncoderCount()
Gets count of available encoders.
static const ProfilerField PROFILER_FIELD_FPS
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.
int setHDRMetadataSmpte2086(struct drm_tegra_hdr_metadata_smpte_2086)
Sets the HDR metadata retrieved from the decoder.
NVIDIA Multimedia API: NvElement Base Class
uint32_t bo_handle
DRM buffer index.
static const ProfilerField PROFILER_FIELD_TOTAL_UNITS
int getPlaneCount()
Gets total number of planes available.
Every element has a unique name that can be used for identifying the element in debug logs...
struct _NvDrmFB NvDrmFB
Holds information about the frame.
int removeFB(uint32_t fb_id)
Destroys a framebuffer.
bool enableUniversalPlanes(int enable)
Enables/disables DRM universal planes client caps, such as DRM_CLIENT_CAP_UNIVERSAL_PLANES.
int pitch
Memory layout of the DRM buffer.
int enqueBuffer(int fd)
Enqueues a buffer fd for rendering.
int width
Width of the DRM buffer, in pixels.
struct _NvDrmBO NvDrmBO
Holds a buffer object handle.
static const ProfilerField PROFILER_FIELD_LATE_UNITS
int height
Height of the frame, in pixels.
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, struct drm_tegra_hdr_metadata_smpte_2086 metadata, bool streamHDR)
Creates a new DRM based renderer named name.
int num_buffers
Number of DRM buffers, which depends on the buffer format.
bool hdrSupported()
Checks if HDR mode is supported on the DRM renderer.
uint8_t * data
Mapped CPU accessible address.
int width
Width of the frame, in pixels.
NvDrmBO bo[4]
DRM buffer handles.
int height
Heigth of the DRM buffer, in pixels.
int dequeBuffer()
Dequeues a previously rendered buffer.