Decreasing display latency with libDrmRenderer

Hey, I was reading your code of the libDrmRenderer and I was wondering about one thing, maybe you can help me out.
In libDrmRenderer the schedule-buffer-for-page-flip-function is called right away when we get the page-flip-done event. If I am right, this means the next buffer to display is read out of queue and scheduled for page-flip right after the page-flip of the previous buffer happens. This seems to me to add some delay, because there could have been a new buffer between the time I schedule the buffer for page-flip and the actual page flip event. (with 60Hz display, the delay could be 16ms.)

Am I wrong with my assumption and is there maybe a better way to do this to reduce delay? Can I use VBlank callback or use waitForVBlank function to schedule my buffer for page-flip or is it already to late when vblank callback ist called?

Best regards,
jb

EDIT:
I have found in the documentation a note:
" drmModePageFlip does not wait for rendering to complete, nor is future rendering blocked until the flip completes. This differs from KMS based implementations that utilize implicit synchronization. When using EGLOutput together with DRM-NVDC, synchronization is handled internally."

Does that mean I can call this function again with a new buffer so that the old one will be overwritten? This would be different from other implementations I have read about where it will return -EBUSY if called already before the next flip was done.

Hi,
In NvDrmRender the function drmModePageFlip() is called for every frame and the frame is rendered in next vsync. So if it it called between vsync there should be no latency.

There is an issue in rendering 60fps. Please refer to
Jetson/L4T/r32.5.x patches - eLinux.org
[MMAPI] 08_video_dec_drm cannot render in 60fps

If you hit the issue, please apply the patch and give it a try.