static bool do_wait(struct vrend_fence *fence, bool can_block)
{
   bool done = false;
   int timeout = can_block ? 1000000000 : 0;

#ifdef HAVE_EPOXY_EGL_H
   if (vrend_state.use_egl_fence) {
      do {
         done = virgl_egl_client_wait_fence(egl, fence->eglsyncobj, timeout);
      } while (!done && can_block);
      return done;
   }
#endif

   do {
      GLenum glret = glClientWaitSync(fence->glsyncobj, 0, timeout);
      if (glret == GL_WAIT_FAILED) {
         vrend_printf( "wait sync failed: illegal fence object %p\n", fence->glsyncobj);
      }
      done = glret != GL_TIMEOUT_EXPIRED;
   } while (!done && can_block);

   return done;
}
static bool do_wait(struct vrend_fence *fence, bool can_block)
{
   bool done = false;
   int timeout = can_block ? 1000000000 : 0;

#ifdef HAVE_EPOXY_EGL_H
   if (vrend_state.use_egl_fence) {
      do {
         done = virgl_egl_client_wait_fence(egl, fence->eglsyncobj, timeout);
      } while (!done && can_block);
      return done;
   }
#endif

   do {
      GLenum glret = glClientWaitSync(fence->glsyncobj, 0, timeout);
      if (glret == GL_WAIT_FAILED) {
         vrend_printf( "wait sync failed: illegal fence object %p\n", fence->glsyncobj);
      }
      done = glret != GL_TIMEOUT_EXPIRED;
   } while (!done && can_block);

   return done;
}