#include "vk_format.h"
+static void
+tu_bo_list_init(struct tu_bo_list *list)
+{
+ list->count = list->capacity = 0;
+ list->handles = NULL;
+}
+
+static void
+tu_bo_list_destroy(struct tu_bo_list *list)
+{
+ free(list->handles);
+}
+
+static void
+tu_bo_list_reset(struct tu_bo_list *list)
+{
+ list->count = 0;
+}
+
+static uint32_t
+tu_bo_list_add(struct tu_bo_list *list,
+ const struct tu_bo *bo)
+{
+ uint32_t handle = bo->gem_handle;
+ for (uint32_t i = 0; i < list->count; ++i) {
+ if (list->handles[i] == handle)
+ return i;
+ }
+
+ if (list->count == list->capacity) {
+ uint32_t new_capacity = MAX2(2 * list->count, 16);
+ uint32_t *new_handles = realloc(list->handles, new_capacity * sizeof(uint32_t));
+ if (!new_handles)
+ return ~0;
+ list->handles = new_handles;
+ list->capacity = new_capacity;
+ }
+
+ uint32_t ret = list->count;
+ list->handles[list->count] = handle;
+ ++list->count;
+
+ return ret;
+}
+
const struct tu_dynamic_state default_dynamic_state = {
.viewport =
{
cmd_buffer->queue_family_index = TU_QUEUE_GENERAL;
}
+ tu_bo_list_init(&cmd_buffer->bo_list);
+
*pCommandBuffer = tu_cmd_buffer_to_handle(cmd_buffer);
list_inithead(&cmd_buffer->upload.list);
for (unsigned i = 0; i < VK_PIPELINE_BIND_POINT_RANGE_SIZE; i++)
free(cmd_buffer->descriptors[i].push_set.set.mapped_ptr);
+ tu_bo_list_destroy(&cmd_buffer->bo_list);
vk_free(&cmd_buffer->pool->alloc, cmd_buffer);
}
{
cmd_buffer->record_result = VK_SUCCESS;
+ tu_bo_list_reset(&cmd_buffer->bo_list);
+
for (unsigned i = 0; i < VK_PIPELINE_BIND_POINT_RANGE_SIZE; i++) {
cmd_buffer->descriptors[i].dirty = 0;
cmd_buffer->descriptors[i].valid = 0;
VkDeviceQueueCreateFlags flags;
};
-struct tu_bo_list
-{
- unsigned capacity;
- pthread_mutex_t mutex;
-};
-
struct tu_device
{
VK_LOADER_DATA _loader_data;
mtx_t shader_slab_mutex;
struct tu_device_extension_table enabled_extensions;
-
- /* Whether the driver uses a global BO list. */
- bool use_global_bo_list;
-
- struct tu_bo_list bo_list;
};
struct tu_bo
TU_CMD_BUFFER_STATUS_PENDING,
};
+struct tu_bo_list
+{
+ uint32_t count;
+ uint32_t capacity;
+ uint32_t *handles;
+};
+
struct tu_cmd_buffer
{
VK_LOADER_DATA _loader_data;
struct tu_cmd_buffer_upload upload;
- uint32_t scratch_size_needed;
- uint32_t compute_scratch_size_needed;
- uint32_t esgs_ring_size_needed;
- uint32_t gsvs_ring_size_needed;
- bool tess_rings_needed;
- bool sample_positions_needed;
+ struct tu_bo_list bo_list;
VkResult record_result;
-
- /**
- * Whether a query pool has been resetted and we have to flush caches.
- */
- bool pending_reset_query;
};
bool