static bool find_ctx0_fence_locked(struct list_head *fence_list,
                                   void *fence_cookie,
                                   bool *seen_first,
                                   struct vrend_fence **fence)
{
   struct vrend_fence *iter;

   LIST_FOR_EACH_ENTRY(iter, fence_list, fences) {
      /* only consider ctx0 fences */
      if (iter->ctx != vrend_state.ctx0)
         continue;

      if (iter->fence_cookie == fence_cookie) {
         *fence = iter;
         return true;
      }

      if (!*seen_first) {
         if (fence_cookie < iter->fence_cookie)
            return true;
         *seen_first = true;
      }
   }

   return false;
}
static bool find_ctx0_fence_locked(struct list_head *fence_list,
                                   void *fence_cookie,
                                   bool *seen_first,
                                   struct vrend_fence **fence)
{
   struct vrend_fence *iter;

   LIST_FOR_EACH_ENTRY(iter, fence_list, fences) {
       
      if (iter->ctx != vrend_state.ctx0)
         continue;

      if (iter->fence_cookie == fence_cookie) {
         *fence = iter;
         return true;
      }

      if (!*seen_first) {
         if (fence_cookie < iter->fence_cookie)
            return true;
         *seen_first = true;
      }
   }

   return false;
}