mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-04 10:58:15 +02:00
kk: Add residency set to queues
Unsure how needed this is but makes resource visible in Xcode GPU capture Signed-off-by: Aitor Camacho <aitor@lunarg.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41849>
This commit is contained in:
parent
52168e67b1
commit
d5805b1eaa
5 changed files with 52 additions and 4 deletions
|
|
@ -16,4 +16,10 @@ mtl_command_queue *mtl_new_command_queue(mtl_device *device,
|
|||
|
||||
mtl_command_buffer *mtl_new_command_buffer(mtl_command_queue *cmd_queue);
|
||||
|
||||
void mtl_command_queue_add_residency_set(mtl_command_queue *cmd_queue,
|
||||
mtl_residency_set *set);
|
||||
|
||||
void mtl_command_queue_remove_residency_set(mtl_command_queue *cmd_queue,
|
||||
mtl_residency_set *set);
|
||||
|
||||
#endif /* MTL_COMMAND_QUEUE_H */
|
||||
|
|
@ -26,3 +26,25 @@ mtl_new_command_buffer(mtl_command_queue *cmd_queue)
|
|||
return [[queue commandBuffer] retain];
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mtl_command_queue_add_residency_set(mtl_command_queue *cmd_queue,
|
||||
mtl_residency_set *set)
|
||||
{
|
||||
@autoreleasepool {
|
||||
id<MTLCommandQueue> queue = (id<MTLCommandQueue>)cmd_queue;
|
||||
id<MTLResidencySet> s = (id<MTLResidencySet>)set;
|
||||
return [queue addResidencySet:s];
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mtl_command_queue_remove_residency_set(mtl_command_queue *cmd_queue,
|
||||
mtl_residency_set *set)
|
||||
{
|
||||
@autoreleasepool {
|
||||
id<MTLCommandQueue> queue = (id<MTLCommandQueue>)cmd_queue;
|
||||
id<MTLResidencySet> s = (id<MTLResidencySet>)set;
|
||||
return [queue removeResidencySet:s];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,3 +17,15 @@ mtl_new_command_buffer(mtl_command_queue *cmd_queue)
|
|||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
mtl_command_queue_add_residency_set(mtl_command_queue *cmd_queue,
|
||||
mtl_residency_set *set)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
mtl_command_queue_remove_residency_set(mtl_command_queue *cmd_queue,
|
||||
mtl_residency_set *set)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -297,15 +297,15 @@ kk_DestroyDevice(VkDevice _device, const VkAllocationCallbacks *pAllocator)
|
|||
if (dev->heap)
|
||||
kk_destroy_bo(dev, dev->heap);
|
||||
|
||||
/* Release the residency set last once all BOs are released. */
|
||||
mtl_release(dev->residency_set.handle);
|
||||
simple_mtx_destroy(&dev->residency_set.mutex);
|
||||
|
||||
if (dev->has_queue) {
|
||||
kk_queue_finish(dev, &dev->queue);
|
||||
dev->has_queue = false;
|
||||
}
|
||||
|
||||
/* Release the residency set last once all BOs are released. */
|
||||
mtl_release(dev->residency_set.handle);
|
||||
simple_mtx_destroy(&dev->residency_set.mutex);
|
||||
|
||||
vk_device_finish(&dev->vk);
|
||||
|
||||
vk_free(&dev->vk.alloc, dev);
|
||||
|
|
|
|||
|
|
@ -121,8 +121,12 @@ kk_queue_init(struct kk_device *dev, struct kk_queue *queue,
|
|||
|
||||
queue->main.mtl_handle =
|
||||
mtl_new_command_queue(dev->mtl_handle, KK_MAX_CMD_BUFFERS);
|
||||
mtl_command_queue_add_residency_set(queue->main.mtl_handle,
|
||||
dev->residency_set.handle);
|
||||
queue->pre_gfx.mtl_handle =
|
||||
mtl_new_command_queue(dev->mtl_handle, KK_MAX_CMD_BUFFERS);
|
||||
mtl_command_queue_add_residency_set(queue->pre_gfx.mtl_handle,
|
||||
dev->residency_set.handle);
|
||||
|
||||
queue->vk.driver_submit = kk_queue_submit;
|
||||
|
||||
|
|
@ -132,6 +136,10 @@ kk_queue_init(struct kk_device *dev, struct kk_queue *queue,
|
|||
void
|
||||
kk_queue_finish(struct kk_device *dev, struct kk_queue *queue)
|
||||
{
|
||||
mtl_command_queue_remove_residency_set(queue->main.mtl_handle,
|
||||
dev->residency_set.handle);
|
||||
mtl_command_queue_remove_residency_set(queue->pre_gfx.mtl_handle,
|
||||
dev->residency_set.handle);
|
||||
if (queue->wait_fence)
|
||||
mtl_release(queue->wait_fence);
|
||||
mtl_release(queue->pre_gfx.mtl_handle);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue