From 48fc65413c8607390b2ed8cdaccac490d8c8fdae Mon Sep 17 00:00:00 2001 From: Bas Nieuwenhuizen Date: Fri, 22 Nov 2019 01:51:36 +0100 Subject: radv: Fix timeline semaphore refcounting. Was totally broken ... Removed two if(point) {} because point is always non-NULL and we were counting on that already for counting, since we NULL our references to semaphores without active point earlier. Fixes: 4aa75bb3bdd "radv: Add wait-before-submit support for timelines." Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2137 Reviewed-by: Samuel Pitoiset --- src/amd/vulkan/radv_device.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 9add671998e..e33f80aa5e4 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -3973,8 +3973,7 @@ radv_finalize_timelines(struct radv_device *device, pthread_mutex_lock(&wait_sems[i]->timeline.mutex); struct radv_timeline_point *point = radv_timeline_find_point_at_least_locked(device, &wait_sems[i]->timeline, wait_values[i]); - if (point) - --point->wait_count; + point->wait_count -= 2; pthread_mutex_unlock(&wait_sems[i]->timeline.mutex); } } @@ -3983,11 +3982,9 @@ radv_finalize_timelines(struct radv_device *device, pthread_mutex_lock(&signal_sems[i]->timeline.mutex); struct radv_timeline_point *point = radv_timeline_find_point_at_least_locked(device, &signal_sems[i]->timeline, signal_values[i]); - if (point) { - signal_sems[i]->timeline.highest_submitted = - MAX2(signal_sems[i]->timeline.highest_submitted, point->value); - point->wait_count--; - } + signal_sems[i]->timeline.highest_submitted = + MAX2(signal_sems[i]->timeline.highest_submitted, point->value); + point->wait_count -= 2; radv_timeline_trigger_waiters_locked(&signal_sems[i]->timeline, processing_list); pthread_mutex_unlock(&signal_sems[i]->timeline.mutex); } @@ -5581,8 +5578,6 @@ radv_timeline_wait_locked(struct radv_device *device, if (!point) return VK_SUCCESS; - point->wait_count++; - pthread_mutex_unlock(&timeline->mutex); bool success = device->ws->wait_syncobj(device->ws, &point->syncobj, 1, true, abs_timeout); -- cgit v1.2.3