Why NvEglRenderer calls eglCreateSyncKHR/eglClientWaitSyncKHR along with eglSwapBuffers?

Hi,
I am trying to improve NvEglRenderer to synchronize rendering with camera capture.
I cannot understand why NvEglRenderer calls eglCreateSyncKHR before eglSwapBuffers and eglClientWaitSyncKHR after.

I see some other examples:

http://mobile3dgraphics.blogspot.com/2013/01/consumerproducer-approach-for.html
One thread calls:
    gl<Various>
    eglCreateSyncKHR
    eglSwapBuffers
Another thread calls:
    eglClientWaitSyncKHR
    eglGetSyncAttribKHR
    eglDestroySyncKHR

This makes sense - one thread creates sync and passes to another thread, which waits on it.

The same here:

https://android.googlesource.com/platform/frameworks/native/+/e6288e2/opengl/libs/EGL/eglApi.cpp
threadLoop: 
    eglClientWaitSyncKHR
    eglDestroySyncKHR
eglSwapBuffersWithDamageKHR:
    eglCreateSyncKHR
    FrameCompletionThread::queueSync(sync);
    eglSwapBuffers

Again, one thread creates sync and passes to another thread, which waits on it.

But NvEglRenderer never passes egl_sync to another thread. These are called all in one thread:

    gl<Various>
    eglCreateSyncKHR
    eglSwapBuffers
    eglClientWaitSyncKHR
    eglDestroySyncKHR

This makes no sense. eglSwapBuffers already waits for display flip, right?
Why do you need second wait in eglClientWaitSyncKHR?

Thank you

Hi,
We will check this with our teams. Please remove the function calls and see if it works well.

Hi,
Our teams have some discussion and confirm that eglSwapBuffers() does not block until the swap is complete. So if the code requires the swap to be complete, we need to use eglClientWaitSync()

I my tests I found that eglClientWaitSyncKHR is only needed if I modify the submitted buffer immediately after return from render(). If I skip calling eglClientWaitSyncKHR, then the modifications are applied immediately and corrupt the previous frame.
But if I allocate an array of buffers and hold rendered buffer unchanged until the next call to render(), then eglCreateSyncKHR/eglClientWaitSyncKHR/eglDestroySyncKHR appear to be unnecessary.

In order to synchronize display and camera I need to get the time of DP vsync/flip as accurately as possible.
Could recording time of return from eglSwapBuffers or eglClientWaitSyncKHR be used to estimate the vsync?
Which once would be closer to vsync: eglSwapBuffers or eglClientWaitSyncKHR?
Or is there a better way to get vsync time using EGL interface?