gallium/util: replace pipe_mutex_lock() with mtx_lock()
[mesa.git] / src / gallium / winsys / virgl / vtest / virgl_vtest_winsys.c
index b19c456149354be0b92a131673ae680a31b054f0..70bd6aff9bfa4f04250083b52190aa625ff60510 100644 (file)
@@ -144,7 +144,7 @@ virgl_cache_flush(struct virgl_vtest_winsys *vtws)
    struct list_head *curr, *next;
    struct virgl_hw_res *res;
 
-   pipe_mutex_lock(vtws->mutex);
+   mtx_lock(&vtws->mutex);
    curr = vtws->delayed.next;
    next = curr->next;
 
@@ -189,7 +189,7 @@ static void virgl_vtest_resource_reference(struct virgl_vtest_winsys *vtws,
       if (!can_cache_resource(old)) {
          virgl_hw_res_destroy(vtws, old);
       } else {
-         pipe_mutex_lock(vtws->mutex);
+         mtx_lock(&vtws->mutex);
          virgl_cache_list_check_free(vtws);
 
          old->start = os_time_get();
@@ -333,7 +333,7 @@ virgl_vtest_winsys_resource_cache_create(struct virgl_winsys *vws,
        bind != VIRGL_BIND_VERTEX_BUFFER && bind != VIRGL_BIND_CUSTOM)
       goto alloc;
 
-   pipe_mutex_lock(vtws->mutex);
+   mtx_lock(&vtws->mutex);
 
    res = NULL;
    curr = vtws->delayed.next;
@@ -343,7 +343,7 @@ virgl_vtest_winsys_resource_cache_create(struct virgl_winsys *vws,
    while (curr != &vtws->delayed) {
       curr_res = LIST_ENTRY(struct virgl_hw_res, curr, head);
 
-      if (!res && (ret = virgl_is_res_compat(vtws, curr_res, size, bind, format) > 0))
+      if (!res && ((ret = virgl_is_res_compat(vtws, curr_res, size, bind, format)) > 0))
          res = curr_res;
       else if (os_time_timeout(curr_res->start, curr_res->end, now)) {
          LIST_DEL(&curr_res->head);
@@ -544,7 +544,7 @@ static bool virgl_fence_wait(struct virgl_winsys *vws,
    struct virgl_hw_res *res = virgl_hw_res(fence);
 
    if (timeout == 0)
-      return virgl_vtest_resource_is_busy(vdws, res);
+      return !virgl_vtest_resource_is_busy(vdws, res);
 
    if (timeout != PIPE_TIMEOUT_INFINITE) {
       int64_t start_time = os_time_get();
@@ -619,7 +619,7 @@ virgl_vtest_winsys_destroy(struct virgl_winsys *vws)
 
    virgl_cache_flush(vtws);
 
-   pipe_mutex_destroy(vtws->mutex);
+   mtx_destroy(&vtws->mutex);
    FREE(vtws);
 }
 
@@ -637,7 +637,7 @@ virgl_vtest_winsys_wrap(struct sw_winsys *sws)
 
    vtws->usecs = 1000000;
    LIST_INITHEAD(&vtws->delayed);
-   pipe_mutex_init(vtws->mutex);
+   (void) mtx_init(&vtws->mutex, mtx_plain);
 
    vtws->base.destroy = virgl_vtest_winsys_destroy;