summaryrefslogtreecommitdiff
path: root/src/nouveau
diff options
context:
space:
mode:
authorFaith Ekstrand <faith.ekstrand@collabora.com>2023-09-25 18:08:50 -0500
committerMarge Bot <emma+marge@anholt.net>2023-09-26 05:05:27 +0000
commitebf9d6d9c363a49076bfa77d1423c3036f3b4ec7 (patch)
tree529c7b7467abe72b020b900f70cb0be1711d364c /src/nouveau
parent8a1602f187ac2c5e9b871c5da430dead1375c867 (diff)
downloadmesa-ebf9d6d9c363a49076bfa77d1423c3036f3b4ec7.tar.gz
mesa-ebf9d6d9c363a49076bfa77d1423c3036f3b4ec7.tar.bz2
mesa-ebf9d6d9c363a49076bfa77d1423c3036f3b4ec7.zip
nvk: Don't store the descriptor pool BO in the set
Instead, store an address, size, and mapped pointer. This is more consistent with how things like images work. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25357>
Diffstat (limited to 'src/nouveau')
-rw-r--r--src/nouveau/vulkan/nvk_descriptor_set.c25
-rw-r--r--src/nouveau/vulkan/nvk_descriptor_set.h10
2 files changed, 15 insertions, 20 deletions
diff --git a/src/nouveau/vulkan/nvk_descriptor_set.c b/src/nouveau/vulkan/nvk_descriptor_set.c
index a05e9243951..54526247421 100644
--- a/src/nouveau/vulkan/nvk_descriptor_set.c
+++ b/src/nouveau/vulkan/nvk_descriptor_set.c
@@ -30,10 +30,10 @@ desc_ubo_data(struct nvk_descriptor_set *set, uint32_t binding,
&set->layout->binding[binding];
uint32_t offset = binding_layout->offset + elem * binding_layout->stride;
- assert(offset < set->bo_size);
+ assert(offset < set->size);
if (size_out != NULL)
- *size_out = set->bo_size - offset;
+ *size_out = set->size - offset;
return (char *)set->mapped_ptr + offset;
}
@@ -293,7 +293,7 @@ nvk_push_descriptor_set_update(struct nvk_push_descriptor_set *push_set,
assert(layout->non_variable_descriptor_buffer_size < sizeof(push_set->data));
struct nvk_descriptor_set set = {
.layout = layout,
- .bo_size = sizeof(push_set->data),
+ .size = sizeof(push_set->data),
.mapped_ptr = push_set->data,
};
@@ -476,28 +476,27 @@ nvk_descriptor_set_create(struct nvk_device *dev,
if (pool->entry_count == pool->max_entry_count)
return VK_ERROR_OUT_OF_POOL_MEMORY;
- set->bo_size = layout->non_variable_descriptor_buffer_size;
+ set->size = layout->non_variable_descriptor_buffer_size;
if (layout->binding_count > 0 &&
(layout->binding[layout->binding_count - 1].flags &
VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT_EXT)) {
uint32_t stride = layout->binding[layout->binding_count-1].stride;
- set->bo_size += stride * variable_count;
+ set->size += stride * variable_count;
}
- if (set->bo_size > 0) {
- if (pool->current_offset + set->bo_size > pool->size)
+ if (set->size > 0) {
+ if (pool->current_offset + set->size > pool->size)
return VK_ERROR_OUT_OF_POOL_MEMORY;
- set->bo = pool->bo;
set->mapped_ptr = (uint32_t *)(pool->mapped_ptr + pool->current_offset);
- set->bo_offset = pool->current_offset;
+ set->addr = pool->bo->offset + pool->current_offset;
}
- pool->entries[pool->entry_count].offset = set->bo_offset;
- pool->entries[pool->entry_count].size = set->bo_size;
+ pool->entries[pool->entry_count].offset = pool->current_offset;
+ pool->entries[pool->entry_count].size = set->size;
pool->entries[pool->entry_count].set = set;
- pool->current_offset += ALIGN(set->bo_size, NVK_MIN_UBO_ALIGNMENT);
+ pool->current_offset += ALIGN(set->size, NVK_MIN_UBO_ALIGNMENT);
pool->entry_count++;
vk_descriptor_set_layout_ref(&layout->vk);
@@ -717,7 +716,7 @@ nvk_push_descriptor_set_update_template(
{
struct nvk_descriptor_set tmp_set = {
.layout = layout,
- .bo_size = sizeof(push_set->data),
+ .size = sizeof(push_set->data),
.mapped_ptr = push_set->data,
};
nvk_descriptor_set_write_template(&tmp_set, template, data);
diff --git a/src/nouveau/vulkan/nvk_descriptor_set.h b/src/nouveau/vulkan/nvk_descriptor_set.h
index 00d90ed56d5..4af417a0b82 100644
--- a/src/nouveau/vulkan/nvk_descriptor_set.h
+++ b/src/nouveau/vulkan/nvk_descriptor_set.h
@@ -52,10 +52,9 @@ VK_DEFINE_NONDISP_HANDLE_CASTS(nvk_descriptor_pool, base, VkDescriptorPool,
struct nvk_descriptor_set {
struct vk_object_base base;
struct nvk_descriptor_set_layout *layout;
- uint32_t bo_offset;
- uint32_t bo_size;
- struct nouveau_ws_bo *bo;
void *mapped_ptr;
+ uint64_t addr;
+ uint32_t size;
struct nvk_buffer_address dynamic_buffers[];
};
@@ -66,10 +65,7 @@ VK_DEFINE_NONDISP_HANDLE_CASTS(nvk_descriptor_set, base, VkDescriptorSet,
static inline uint64_t
nvk_descriptor_set_addr(const struct nvk_descriptor_set *set)
{
- if (set->bo == NULL)
- return 0;
-
- return set->bo->offset + set->bo_offset;
+ return set->addr;
}
struct nvk_push_descriptor_set {