eglCreateSyncKHR emulation

It appears that eglCreateSyncKHR in PVRVFrame may not be properly supporting a NULL attrib_list (SDK 2016 R1.1, Win32).

On the platform I’m testing on, PVRVFrame reports EGL_KHR_fence_sync support.

When I capture a trace, PVRTrace recorder serializes and PVRTraceGUI displays the function query for the required EGL extension functions:

[scode lang=“c”]Call UID 4114: Thread 22360: eglGetProcAddress (eglCreateSyncKHR) : 0x32e9c20
…[/scode]

The function addresses returned appear to be within libEGL.dll, which is good. However, when the app calls eglCreateSyncKHR via the function pointer, that triggers an access violation on a NULL pointer dereference, with no eglCreateSyncKHR serialized into the PVRTrace file. The line of code:

[scode lang=“c”] m_SyncObj = eglCreateSyncKHR_my( eglDisplay, EGL_SYNC_FENCE_KHR, NULL );[/scode]

Testing a theory, I changed this to:

[scode lang=“c”] EGLint attribs[] = { EGL_NONE };
m_SyncObj = eglCreateSyncKHR_my( eglDisplay, EGL_SYNC_FENCE_KHR, attribs );[/scode]

That at least gets past the crash and results in eglCreateSyncKHR, eglClientWaitSyncKHR, and eglDestroySyncKHR calls in the trace log. Though I’m still getting a hang on eglClientWaitSyncKHR, so it’s too soon to say whether there might not be another issue. Continuing to dig…

Related: In the KHR_fence_sync spec, I see:

[quote]If “type” is EGL_SYNC_FENCE_KHR, a fence sync object is created. In
this case “attrib_list” must be NULL or empty (containing only
EGL_NONE). [/quote]

[blockquote]Though I’m still getting a hang on eglClientWaitSyncKHR, so it’s too soon to say whether there might not be another issue. Continuing to dig…[/blockquote]

Just to wrap this up, it turns out that the mentioned eglClientWaitSyncKHR hang was due to a logic error in the app (specifically: not flushing the eglCreateSyncKHR signal into the pipeline when using multiple contexts).

So the only EGL_KHR_fence_sync problems I hit are 1) the above-mentioned one w.r.t. a NULL attrib_list argument to eglCreateSyncKHR, and 2) this one:

Thanks.

Hi Dark_Photon,
First of all, thank you for your testing. This issue has been resolved in changelist 4029283.
You can use EGLint attribs[] = { EGL_NONE }; as a workaround solution for now.
the code path should be as same as the attribs == NULL.

Thanks,
Kevin