if (unlikely(*iter % (1 << warn_order) == 0)) {
vn_log(NULL, "stuck in %s wait with iter at %d", reason, *iter);
- if (vn_ring_fatal(ring)) {
- vn_log(NULL, "aborting on ring fatal error");
+ const uint32_t status = vn_ring_load_status(ring);
+ if (status & VK_RING_STATUS_FATAL_BIT_MESA) {
+ vn_log(NULL, "aborting on ring fatal error at iter %d", *iter);
abort();
}
memory_order_release);
}
-static uint32_t
+uint32_t
vn_ring_load_status(const struct vn_ring *ring)
{
/* must be called and ordered after vn_ring_store_tail for idle status */
return atomic_load_explicit(ring->shared.status, memory_order_seq_cst);
}
-bool
-vn_ring_fatal(const struct vn_ring *ring)
+void
+vn_ring_unset_status_bits(struct vn_ring *ring, uint32_t mask)
{
- return vn_ring_load_status(ring) & VK_RING_STATUS_FATAL_BIT_MESA;
+ atomic_fetch_and_explicit(ring->shared.status, ~mask,
+ memory_order_seq_cst);
}
static void
struct vn_ring_shared {
const volatile atomic_uint *head;
volatile atomic_uint *tail;
- const volatile atomic_uint *status;
+ volatile atomic_uint *status;
void *buffer;
void *extra;
};
struct vn_ring_submit *
vn_ring_get_submit(struct vn_ring *ring, uint32_t shmem_count);
+uint32_t
+vn_ring_load_status(const struct vn_ring *ring);
+
+void
+vn_ring_unset_status_bits(struct vn_ring *ring, uint32_t mask);
+
bool
vn_ring_submit(struct vn_ring *ring,
struct vn_ring_submit *submit,
void
vn_ring_wait(struct vn_ring *ring, uint32_t seqno);
-bool
-vn_ring_fatal(const struct vn_ring *ring);
-
#endif /* VN_RING_H */