diff options
author | Chia-I Wu <[email protected]> | 2019-01-17 10:23:19 -0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2019-03-11 10:01:41 -0700 |
commit | 7ad01913bd2122c108a51a32aa40cc2b23aed768 (patch) | |
tree | eb5c460a7c8923b4473df7d4029f2574cb662f5d /src/freedreno/vulkan/tu_cmd_buffer.c | |
parent | c969d8b975072221adc898a34cf9bc5be8ab3402 (diff) |
turnip: build drm_msm_gem_submit_bo array directly
Build drm_msm_gem_submit_bo array directly in tu_bo_list. We might
change this again, but this is good enough for now.
There are other issues as well, such as not using
VkAllocationCallbacks and sloppy error checking. We should revisit
this in the near future. Same to tu_cs.
Diffstat (limited to 'src/freedreno/vulkan/tu_cmd_buffer.c')
-rw-r--r-- | src/freedreno/vulkan/tu_cmd_buffer.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/freedreno/vulkan/tu_cmd_buffer.c b/src/freedreno/vulkan/tu_cmd_buffer.c index 4600f1ffa2f..d58e8e1bd0f 100644 --- a/src/freedreno/vulkan/tu_cmd_buffer.c +++ b/src/freedreno/vulkan/tu_cmd_buffer.c @@ -35,13 +35,13 @@ void 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 @@ -50,27 +50,39 @@ tu_bo_list_reset(struct tu_bo_list *list) 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; |