anv: try to help coverity understand we're not racing

Coverity notices that in this case part of the decision to go down the
locked path invovles reading a flag, which is turn set inside the
protected code. Additional threads can decide they need to go down the
locked path, and then wait on the lock, even though the first thread
willse the device_registered to true, which would have otherwise
prevented them from going down the locked path.

What Coverity doesn't know, is that it is a violation of the Vulkan API
contract to call this function from two different threads, so in
practice that cann't happen. We'll move the setting of the
image_device_registered out of the locked area to see if that pacifies
Coverity, and if not then we'll just ignore it.

CID: 1662067
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37582>
This commit is contained in:
Dylan Baker 2025-09-25 18:46:44 +00:00 committed by Marge Bot
parent aa28fcb610
commit 74018f41ab

View file

@ -3151,8 +3151,8 @@ anv_bind_image_memory(struct anv_device *device,
!image->device_registered) {
pthread_mutex_lock(&device->mutex);
list_addtail(&image->link, &device->image_private_objects);
image->device_registered = true;
pthread_mutex_unlock(&device->mutex);
image->device_registered = true;
}
if (bind_status)