freedreno: eglDupNativeFenceFDANDROID() fails when no previous render
When using freedreno (mesa 19.3) on Android 8.1 (A200, i.MX53) there is no rendering in the boot animation (and little after that).
The logs show (for the surface flinger process) "E GLConsumer: [BootAnimation#0] syncForReleaseLocked: error dup'ing native fence fd: 0x3000"
This is due to this code in GLConsumer::syncForReleaseLocked (in http://androidxref.com/8.1.0_r33/xref/frameworks/native/libs/gui/GLConsumer.cpp#697)
EGLSyncKHR sync = eglCreateSyncKHR(dpy, EGL_SYNC_NATIVE_FENCE_ANDROID, NULL); if (sync == EGL_NO_SYNC_KHR) { GLC_LOGE("syncForReleaseLocked: error creating EGL fence: %#x", eglGetError()); return UNKNOWN_ERROR; } glFlush(); int fenceFd = eglDupNativeFenceFDANDROID(dpy, sync); eglDestroySyncKHR(dpy, sync); if (fenceFd == EGL_NO_NATIVE_FENCE_FD_ANDROID) { GLC_LOGE("syncForReleaseLocked: error dup'ing native fence " "fd: %#x", eglGetError()); return UNKNOWN_ERROR; }
Hacking this to return OK instead of UNKNOWN_ERROR makes it work.
The problem appears to be that when the process has never rendered the fence fd is not created. Since this code is called to release the old buffer before acquiring the new an error here means that nothing is ever rendered...
Using etnaviv (on i.MX6) works.
I think this is may be related to
commit 20f677f6 Author: Rob Clark robdclark@gmail.com Date: Tue Jul 17 09:54:23 2018 -0400
freedreno: get rid of noop render