mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 00:10:20 +01:00
venus: further cleanup vn_relax_init to take instance instead of ring
For multi-ring, later we can just check primary ring alive status. Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26179>
This commit is contained in:
parent
f6adc60822
commit
70e8d1397e
4 changed files with 18 additions and 17 deletions
|
|
@ -165,19 +165,19 @@ vn_watchdog_acquire(struct vn_watchdog *watchdog, bool alive)
|
|||
void
|
||||
vn_relax_fini(struct vn_relax_state *state)
|
||||
{
|
||||
vn_watchdog_release(state->watchdog);
|
||||
vn_watchdog_release(&state->instance->ring.watchdog);
|
||||
}
|
||||
|
||||
struct vn_relax_state
|
||||
vn_relax_init(struct vn_ring *ring, const char *reason)
|
||||
vn_relax_init(struct vn_instance *instance, const char *reason)
|
||||
{
|
||||
struct vn_watchdog *watchdog = &ring->instance->ring.watchdog;
|
||||
struct vn_ring *ring = &instance->ring.ring;
|
||||
struct vn_watchdog *watchdog = &instance->ring.watchdog;
|
||||
if (vn_watchdog_acquire(watchdog, true))
|
||||
vn_ring_unset_status_bits(ring, VK_RING_STATUS_ALIVE_BIT_MESA);
|
||||
|
||||
return (struct vn_relax_state){
|
||||
.ring = ring,
|
||||
.watchdog = watchdog,
|
||||
.instance = instance,
|
||||
.iter = 0,
|
||||
.reason = reason,
|
||||
};
|
||||
|
|
@ -186,7 +186,6 @@ vn_relax_init(struct vn_ring *ring, const char *reason)
|
|||
void
|
||||
vn_relax(struct vn_relax_state *state)
|
||||
{
|
||||
struct vn_ring *ring = state->ring;
|
||||
uint32_t *iter = &state->iter;
|
||||
const char *reason = state->reason;
|
||||
|
||||
|
|
@ -210,16 +209,17 @@ vn_relax(struct vn_relax_state *state)
|
|||
* another 2047 shorter sleeps)
|
||||
*/
|
||||
if (unlikely(*iter % (1 << warn_order) == 0)) {
|
||||
struct vn_instance *instance = ring->instance;
|
||||
struct vn_instance *instance = state->instance;
|
||||
vn_log(instance, "stuck in %s wait with iter at %d", reason, *iter);
|
||||
|
||||
struct vn_watchdog *watchdog = state->watchdog;
|
||||
struct vn_ring *ring = &instance->ring.ring;
|
||||
const uint32_t status = vn_ring_load_status(ring);
|
||||
if (status & VK_RING_STATUS_FATAL_BIT_MESA) {
|
||||
vn_log(instance, "aborting on ring fatal error at iter %d", *iter);
|
||||
abort();
|
||||
}
|
||||
|
||||
struct vn_watchdog *watchdog = &instance->ring.watchdog;
|
||||
const bool alive = status & VK_RING_STATUS_ALIVE_BIT_MESA;
|
||||
if (vn_watchdog_acquire(watchdog, alive))
|
||||
vn_ring_unset_status_bits(ring, VK_RING_STATUS_ALIVE_BIT_MESA);
|
||||
|
|
|
|||
|
|
@ -202,8 +202,7 @@ struct vn_watchdog {
|
|||
};
|
||||
|
||||
struct vn_relax_state {
|
||||
struct vn_ring *ring;
|
||||
struct vn_watchdog *watchdog;
|
||||
struct vn_instance *instance;
|
||||
uint32_t iter;
|
||||
const char *reason;
|
||||
};
|
||||
|
|
@ -306,7 +305,7 @@ vn_watchdog_fini(struct vn_watchdog *watchdog)
|
|||
}
|
||||
|
||||
struct vn_relax_state
|
||||
vn_relax_init(struct vn_ring *ring, const char *reason);
|
||||
vn_relax_init(struct vn_instance *instance, const char *reason);
|
||||
|
||||
void
|
||||
vn_relax(struct vn_relax_state *state);
|
||||
|
|
|
|||
|
|
@ -1786,7 +1786,7 @@ vn_WaitForFences(VkDevice device,
|
|||
memcpy(fences, pFences, sizeof(*fences) * fenceCount);
|
||||
|
||||
struct vn_relax_state relax_state =
|
||||
vn_relax_init(&dev->instance->ring.ring, "client");
|
||||
vn_relax_init(dev->instance, "client");
|
||||
while (result == VK_NOT_READY) {
|
||||
result = vn_remove_signaled_fences(device, fences, &fenceCount);
|
||||
result =
|
||||
|
|
@ -1798,7 +1798,7 @@ vn_WaitForFences(VkDevice device,
|
|||
vk_free(alloc, fences);
|
||||
} else {
|
||||
struct vn_relax_state relax_state =
|
||||
vn_relax_init(&dev->instance->ring.ring, "client");
|
||||
vn_relax_init(dev->instance, "client");
|
||||
while (result == VK_NOT_READY) {
|
||||
result = vn_find_first_signaled_fence(device, pFences, fenceCount);
|
||||
result =
|
||||
|
|
@ -2301,7 +2301,7 @@ vn_WaitSemaphores(VkDevice device,
|
|||
memcpy(values, pWaitInfo->pValues, sizeof(*values) * semaphore_count);
|
||||
|
||||
struct vn_relax_state relax_state =
|
||||
vn_relax_init(&dev->instance->ring.ring, "client");
|
||||
vn_relax_init(dev->instance, "client");
|
||||
while (result == VK_NOT_READY) {
|
||||
result = vn_remove_signaled_semaphores(device, semaphores, values,
|
||||
&semaphore_count);
|
||||
|
|
@ -2314,7 +2314,7 @@ vn_WaitSemaphores(VkDevice device,
|
|||
vk_free(alloc, semaphores);
|
||||
} else {
|
||||
struct vn_relax_state relax_state =
|
||||
vn_relax_init(&dev->instance->ring.ring, "client");
|
||||
vn_relax_init(dev->instance, "client");
|
||||
while (result == VK_NOT_READY) {
|
||||
result = vn_find_first_signaled_semaphore(
|
||||
device, pWaitInfo->pSemaphores, pWaitInfo->pValues,
|
||||
|
|
|
|||
|
|
@ -102,7 +102,8 @@ vn_ring_wait_seqno(struct vn_ring *ring, uint32_t seqno)
|
|||
/* A renderer wait incurs several hops and the renderer might poll
|
||||
* repeatedly anyway. Let's just poll here.
|
||||
*/
|
||||
struct vn_relax_state relax_state = vn_relax_init(ring, "ring seqno");
|
||||
struct vn_relax_state relax_state =
|
||||
vn_relax_init(ring->instance, "ring seqno");
|
||||
do {
|
||||
if (vn_ring_get_seqno_status(ring, seqno)) {
|
||||
vn_relax_fini(&relax_state);
|
||||
|
|
@ -139,7 +140,8 @@ vn_ring_wait_space(struct vn_ring *ring, uint32_t size)
|
|||
VN_TRACE_FUNC();
|
||||
|
||||
/* see the reasoning in vn_ring_wait_seqno */
|
||||
struct vn_relax_state relax_state = vn_relax_init(ring, "ring space");
|
||||
struct vn_relax_state relax_state =
|
||||
vn_relax_init(ring->instance, "ring space");
|
||||
do {
|
||||
vn_relax(&relax_state);
|
||||
if (vn_ring_has_space(ring, size, &head)) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue