tu_bo_list_init(struct tu_bo_list *list)
{
list->count = list->capacity = 0;
- list->handles = NULL;
+ list->bo_infos = NULL;
}
void
tu_bo_list_destroy(struct tu_bo_list *list)
{
- free(list->handles);
+ free(list->bo_infos);
}
void
list->count = 0;
}
+/**
+ * \a flags consists of MSM_SUBMIT_BO_FLAGS.
+ */
uint32_t
tu_bo_list_add(struct tu_bo_list *list,
- const struct tu_bo *bo)
+ const struct tu_bo *bo,
+ uint32_t flags)
{
uint32_t handle = bo->gem_handle;
for (uint32_t i = 0; i < list->count; ++i) {
- if (list->handles[i] == handle)
+ if (list->bo_infos[i].handle == handle) {
+ list->bo_infos[i].flags |= flags;
return i;
+ }
}
+ /* grow list->bo_infos if needed */
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)
+ struct drm_msm_gem_submit_bo *new_bo_infos = realloc(
+ list->bo_infos, new_capacity * sizeof(struct drm_msm_gem_submit_bo));
+ if (!new_bo_infos)
return ~0;
- list->handles = new_handles;
+ list->bo_infos = new_bo_infos;
list->capacity = new_capacity;
}
uint32_t ret = list->count;
- list->handles[list->count] = handle;
+ list->bo_infos[list->count] = (struct drm_msm_gem_submit_bo) {
+ .flags = flags,
+ .handle = bo->gem_handle,
+ .presumed = bo->iova,
+ };
++list->count;
return ret;
struct tu_cs *cs = &cmdbuf->cs;
for (unsigned i = 0; i < cs->entry_count; ++i, ++entry_idx) {
cmds[entry_idx].type = MSM_SUBMIT_CMD_BUF;
- cmds[entry_idx].submit_idx =
- tu_bo_list_add(&bo_list, cs->entries[i].bo);
+ cmds[entry_idx].submit_idx = tu_bo_list_add(
+ &bo_list, cs->entries[i].bo, MSM_SUBMIT_BO_READ);
cmds[entry_idx].submit_offset = cs->entries[i].offset;
cmds[entry_idx].size = cs->entries[i].size;
cmds[entry_idx].pad = 0;
}
}
- struct drm_msm_gem_submit_bo bos[bo_list.count];
- for (unsigned i = 0; i < bo_list.count; ++i) {
- bos[i].flags = MSM_SUBMIT_BO_READ | MSM_SUBMIT_BO_WRITE;
- bos[i].handle = bo_list.handles[i];
- bos[i].presumed = 0;
- }
-
uint32_t flags = MSM_PIPE_3D0;
if (last_submit) {
flags |= MSM_SUBMIT_FENCE_FD_OUT;
struct drm_msm_gem_submit req = {
.flags = flags,
.queueid = queue->msm_queue_id,
- .bos = (uint64_t)(uintptr_t)bos,
+ .bos = (uint64_t)(uintptr_t) bo_list.bo_infos,
.nr_bos = bo_list.count,
.cmds = (uint64_t)(uintptr_t)cmds,
.nr_cmds = entry_count,
#include "vk_alloc.h"
#include "vk_debug_report.h"
+#include "drm/msm_drm.h"
#include "tu_descriptor_set.h"
#include "tu_extensions.h"
{
uint32_t count;
uint32_t capacity;
- uint32_t *handles;
+ struct drm_msm_gem_submit_bo *bo_infos;
};
-void tu_bo_list_init(struct tu_bo_list *list);
-void tu_bo_list_destroy(struct tu_bo_list *list);
-void tu_bo_list_reset(struct tu_bo_list *list);
-uint32_t tu_bo_list_add(struct tu_bo_list *list,
- const struct tu_bo *bo);
+void
+tu_bo_list_init(struct tu_bo_list *list);
+void
+tu_bo_list_destroy(struct tu_bo_list *list);
+void
+tu_bo_list_reset(struct tu_bo_list *list);
+uint32_t
+tu_bo_list_add(struct tu_bo_list *list,
+ const struct tu_bo *bo,
+ uint32_t flags);
struct tu_cs_entry
{