I am using Jetson TX2 for h264 video decoding and rendering with Tegra API JetPack 4.3 Ubuntu 18.04 and I have a question about right using of NvEglRenderer.
I need to render 3 NvBuffer into 3 different X windows in 1 process. So I create 3 separate threads for rendering. I create NvEglRenderer with
createEglRenderer() function inside each thread and set fps to 25. But it gives me something about 20 fps.
I try to reproduce this on 00_video_decode sample. When I run 3 separate processes of application I get 25 fps easily. I even run 9 processes in the same time and they work good. I add 2 more NvEglRenderer in
context_t struct of 00_video_decode sample like this:
create them in function
static void query_and_set_capture(context_t * ctx):
ctx->renderer = NvEglRenderer::createEglRenderer("renderer0", window_width, window_height, ctx->window_x, ctx->window_y);
ctx->renderer1 = NvEglRenderer::createEglRenderer("renderer1", window_width, window_height, ctx->window_x, ctx->window_y);
ctx->renderer2 = NvEglRenderer::createEglRenderer("renderer2", window_width, window_height, ctx->window_x, ctx->window_y);
and add calls
NvEglRenderer::render(int fd) for each new NvEglRenderer where it is needed.
I get something about 20 fps again.
I add profiling inside NvEglRenderer.cpp in my application. It shows me that NvEglRenderer spend most of its time on condition variable waiting when I launch 1 NvEglRenderer in 1 process. But when I run 3 NvEglRenderer in 3 separate threads in 1 process it spend most of its time on calling egl functions: glEGLImageTargetTexture2DOES, eglCreateSyncKHR, eglClientWaitSyncKHR etc.
It looks like
NvEglRenderer::createEglRenderer() makes it possible to use multiple NvEglRenderer in 1 process. So it is not obvious to me why I can’t get 25 fps. What I am doing wrong? Is it possible to use more than 1 NvEglRenderer in 1 process?