vulkan: Track which objects are client-visible
When dealing with debug logging, it's useful to track when an object's construction is finished and it's now visible to the client. We can detect this pretty easily by setting a flag the first time foo_to_handle is called. As long as drivers only ever call that function at the end of object construction (they all do to my knowledge), this should be a reliable mechanism for detecting when a client knows about a handle. Tested-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13045>
This commit is contained in:
committed by
Marge Bot
parent
a815b2b3c1
commit
571b5f5000
@@ -38,6 +38,7 @@ vk_object_base_init(struct vk_device *device,
|
||||
base->_loader_data.loaderMagic = ICD_LOADER_MAGIC;
|
||||
base->type = obj_type;
|
||||
base->device = device;
|
||||
base->client_visible = false;
|
||||
base->object_name = NULL;
|
||||
util_sparse_array_init(&base->private_data, sizeof(uint64_t), 8);
|
||||
}
|
||||
|
||||
@@ -44,6 +44,9 @@ struct vk_object_base {
|
||||
|
||||
struct vk_device *device;
|
||||
|
||||
/* True if this object is fully constructed and visible to the client */
|
||||
bool client_visible;
|
||||
|
||||
/* For VK_EXT_private_data */
|
||||
struct util_sparse_array private_data;
|
||||
|
||||
@@ -85,6 +88,8 @@ vk_object_base_from_u64_handle(uint64_t handle, VkObjectType obj_type)
|
||||
__driver_type ## _to_handle(struct __driver_type *_obj) \
|
||||
{ \
|
||||
vk_object_base_assert_valid(&_obj->__base, __VK_TYPE); \
|
||||
if (_obj != NULL) \
|
||||
_obj->__base.client_visible = true; \
|
||||
return (__VkType) _obj; \
|
||||
}
|
||||
|
||||
@@ -103,6 +108,8 @@ vk_object_base_from_u64_handle(uint64_t handle, VkObjectType obj_type)
|
||||
__driver_type ## _to_handle(struct __driver_type *_obj) \
|
||||
{ \
|
||||
vk_object_base_assert_valid(&_obj->__base, __VK_TYPE); \
|
||||
if (_obj != NULL) \
|
||||
_obj->__base.client_visible = true; \
|
||||
return (__VkType)(uintptr_t) _obj; \
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user