venus: ensure sfb can catch device lost

Similar to qfb except that we skip sfb consistency validation here.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40790>
This commit is contained in:
Yiwei Zhang 2026-04-03 20:56:25 -07:00 committed by Marge Bot
parent 20533207d3
commit e3afacb7b3

View file

@ -2204,6 +2204,7 @@ vn_get_semaphore_counter_value(VkDevice dev_handle,
struct vn_device *dev = vn_device_from_handle(dev_handle);
struct vn_semaphore *sem = vn_semaphore_from_handle(sem_handle);
ASSERTED struct vn_sync_payload *payload = sem->payload;
bool check_device_lost = false;
assert(payload->type == VN_SYNC_TYPE_DEVICE_ONLY);
@ -2262,6 +2263,9 @@ vn_get_semaphore_counter_value(VkDevice dev_handle,
simple_mtx_unlock(&sem->feedback.cmd_mtx);
sem->feedback.signaled_counter = counter;
} else if (relax_state && vn_relax_warn(relax_state)) {
/* upon vn_relax warn order and when sfb doesn't progress */
check_device_lost = true;
}
/* vn_SignalSemaphore writes the sfb signaled_counter without updating
@ -2270,6 +2274,21 @@ vn_get_semaphore_counter_value(VkDevice dev_handle,
counter = MAX2(counter, sem->feedback.signaled_counter);
simple_mtx_unlock(&sem->feedback.counter_mtx);
if (check_device_lost) {
/* Emit a synchronous vkGetSemaphoreCounterValue to catch renderer
* device lost without tangling with sfb internals.
*/
uint64_t tmp;
VkResult result = vn_call_vkGetSemaphoreCounterValue(
dev->primary_ring, dev_handle, sem_handle, &tmp);
if (result == VK_ERROR_DEVICE_LOST) {
vn_log(dev->instance, "aborting on sfb device lost");
abort();
}
if (result != VK_SUCCESS)
return result;
}
*out_value = counter;
} else {
VkResult result = vn_call_vkGetSemaphoreCounterValue(