vulkan: Depend on vk_pipeline_layout in vk_cmd_enqueue

Now that we have a common pipeline layout with reference counting, we
don't need these driver hooks for reference counting anymore.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17286>
This commit is contained in:
Jason Ekstrand
2022-06-28 14:54:30 -05:00
committed by Marge Bot
parent aa40a04ad9
commit d06335ed76
5 changed files with 5 additions and 77 deletions
+5 -4
View File
@@ -26,6 +26,7 @@
#include "vk_cmd_enqueue_entrypoints.h"
#include "vk_command_buffer.h"
#include "vk_device.h"
#include "vk_pipeline_layout.h"
#include "vk_util.h"
VKAPI_ATTR void VKAPI_CALL
@@ -202,11 +203,12 @@ unref_pipeline_layout(struct vk_cmd_queue *queue,
{
struct vk_command_buffer *cmd_buffer =
container_of(queue, struct vk_command_buffer, cmd_queue);
struct vk_device *device = cmd_buffer->base.device;
VK_FROM_HANDLE(vk_pipeline_layout, layout,
cmd->u.bind_descriptor_sets.layout);
assert(cmd->type == VK_CMD_BIND_DESCRIPTOR_SETS);
device->unref_pipeline_layout(device, cmd->u.bind_descriptor_sets.layout);
vk_pipeline_layout_unref(cmd_buffer->base.device, layout);
}
VKAPI_ATTR void VKAPI_CALL
@@ -220,7 +222,6 @@ vk_cmd_enqueue_CmdBindDescriptorSets(VkCommandBuffer commandBuffer,
const uint32_t *pDynamicOffsets)
{
VK_FROM_HANDLE(vk_command_buffer, cmd_buffer, commandBuffer);
struct vk_device *device = cmd_buffer->base.device;
struct vk_cmd_queue_entry *cmd =
vk_zalloc(cmd_buffer->cmd_queue.alloc, sizeof(*cmd), 8,
@@ -235,7 +236,7 @@ vk_cmd_enqueue_CmdBindDescriptorSets(VkCommandBuffer commandBuffer,
* command is in the queue. Otherwise, it may get deleted out from under
* us before the command is replayed.
*/
device->ref_pipeline_layout(device, layout);
vk_pipeline_layout_ref(vk_pipeline_layout_from_handle(layout));
cmd->u.bind_descriptor_sets.layout = layout;
cmd->driver_free_cb = unref_pipeline_layout;
-16
View File
@@ -169,22 +169,6 @@ struct vk_device {
bool signal_memory,
struct vk_sync **sync_out);
/** Increments the reference count on a pipeline layout
*
* This is required for vk_enqueue_CmdBindDescriptorSets() to avoid
* use-after-free problems with pipeline layouts. If you're not using
* the command queue, you can ignore this.
*/
void (*ref_pipeline_layout)(struct vk_device *device,
VkPipelineLayout layout);
/** Decrements the reference count on a pipeline layout
*
* See ref_pipeline_layout above.
*/
void (*unref_pipeline_layout)(struct vk_device *device,
VkPipelineLayout layout);
/* Set by vk_device_set_drm_fd() */
int drm_fd;