venus: trace vn_ring_wait_space
It is good to know that we run out of ring space and have to wait. This happens easily with fossilize-replay because encoding a vkCreateGraphicsPipeline takes microseconds while executing it can take milliseconds, >100ms sometimes. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14966>
This commit is contained in:
parent
7cb2e9a8f0
commit
5f3e50b27c
|
@ -101,19 +101,40 @@ vn_ring_wait_seqno(const struct vn_ring *ring, uint32_t seqno)
|
|||
} while (true);
|
||||
}
|
||||
|
||||
static bool
|
||||
vn_ring_has_space(const struct vn_ring *ring,
|
||||
uint32_t size,
|
||||
uint32_t *out_head)
|
||||
{
|
||||
const uint32_t head = vn_ring_load_head(ring);
|
||||
if (likely(ring->cur + size - head <= ring->buffer_size)) {
|
||||
*out_head = head;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
vn_ring_wait_space(const struct vn_ring *ring, uint32_t size)
|
||||
{
|
||||
assert(size <= ring->buffer_size);
|
||||
|
||||
/* see the reasoning in vn_ring_wait_seqno */
|
||||
uint32_t iter = 0;
|
||||
do {
|
||||
const uint32_t head = vn_ring_load_head(ring);
|
||||
if (ring->cur + size - head <= ring->buffer_size)
|
||||
return head;
|
||||
vn_relax(&iter, "ring space");
|
||||
} while (true);
|
||||
uint32_t head;
|
||||
if (likely(vn_ring_has_space(ring, size, &head)))
|
||||
return head;
|
||||
|
||||
{
|
||||
VN_TRACE_FUNC();
|
||||
|
||||
/* see the reasoning in vn_ring_wait_seqno */
|
||||
uint32_t iter = 0;
|
||||
do {
|
||||
vn_relax(&iter, "ring space");
|
||||
if (vn_ring_has_space(ring, size, &head))
|
||||
return head;
|
||||
} while (true);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in New Issue