diff options
author | Mary Guillemard <mary.guillemard@collabora.com> | 2024-07-01 11:45:59 +0200 |
---|---|---|
committer | Eric Engestrom <eric@engestrom.ch> | 2024-07-24 18:38:09 +0200 |
commit | 7844f879ab715f4652ac83d07c3b3ee467e1db93 (patch) | |
tree | 394c16a544155af20bf86220b0f3f04fc90832e7 /src/panfrost | |
parent | bbdb0f5b80611508230e7150c01a85a036246379 (diff) |
panvk: Fix image support in vertex jobs
There were various bugs causing images access to fault.
This fixes
"dEQP-VK.memory.pipeline_barrier.host_write_storage_buffer.*" and
possibly other tests.
Fixes: 7bea6f8612e ("panvk: Overhaul the Bifrost descriptor set implementation")
Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30293>
(cherry picked from commit cec45cac846385425772f9431fb0fd707be5e547)
Diffstat (limited to 'src/panfrost')
-rw-r--r-- | src/panfrost/vulkan/bifrost/panvk_vX_cmd_desc_state.c | 5 | ||||
-rw-r--r-- | src/panfrost/vulkan/bifrost/panvk_vX_meta_desc_copy.c | 3 | ||||
-rw-r--r-- | src/panfrost/vulkan/jm/panvk_vX_cmd_dispatch.c | 2 | ||||
-rw-r--r-- | src/panfrost/vulkan/jm/panvk_vX_cmd_draw.c | 12 | ||||
-rw-r--r-- | src/panfrost/vulkan/panvk_meta.h | 3 |
5 files changed, 17 insertions, 8 deletions
diff --git a/src/panfrost/vulkan/bifrost/panvk_vX_cmd_desc_state.c b/src/panfrost/vulkan/bifrost/panvk_vX_cmd_desc_state.c index ac2c02d48d9..9a22aea30c2 100644 --- a/src/panfrost/vulkan/bifrost/panvk_vX_cmd_desc_state.c +++ b/src/panfrost/vulkan/bifrost/panvk_vX_cmd_desc_state.c @@ -205,7 +205,10 @@ panvk_per_arch(cmd_prepare_shader_desc_tables)( if (i == PANVK_BIFROST_DESC_TABLE_UBO) panvk_cmd_fill_dyn_ubos(desc_state, shader, ptr.cpu, desc_count); - if (i == PANVK_BIFROST_DESC_TABLE_IMG) { + /* The image table being actually the attribute table, this is handled + * separately for vertex shaders. */ + if (i == PANVK_BIFROST_DESC_TABLE_IMG && + shader->info.stage != MESA_SHADER_VERTEX) { assert(!shader_desc_state->img_attrib_table); ptr = pan_pool_alloc_desc_array(desc_pool, desc_count, ATTRIBUTE); diff --git a/src/panfrost/vulkan/bifrost/panvk_vX_meta_desc_copy.c b/src/panfrost/vulkan/bifrost/panvk_vX_meta_desc_copy.c index cfe9ba21c20..a2349d989a6 100644 --- a/src/panfrost/vulkan/bifrost/panvk_vX_meta_desc_copy.c +++ b/src/panfrost/vulkan/bifrost/panvk_vX_meta_desc_copy.c @@ -298,7 +298,8 @@ panvk_per_arch(meta_get_copy_desc_job)( struct panvk_device *dev, struct pan_pool *desc_pool, const struct panvk_shader *shader, const struct panvk_descriptor_state *desc_state, - const struct panvk_shader_desc_state *shader_desc_state) + const struct panvk_shader_desc_state *shader_desc_state, + uint32_t attrib_buf_idx_offset) { if (!shader) return (struct panfrost_ptr){0}; diff --git a/src/panfrost/vulkan/jm/panvk_vX_cmd_dispatch.c b/src/panfrost/vulkan/jm/panvk_vX_cmd_dispatch.c index caa323b4934..3b51cc612e7 100644 --- a/src/panfrost/vulkan/jm/panvk_vX_cmd_dispatch.c +++ b/src/panfrost/vulkan/jm/panvk_vX_cmd_dispatch.c @@ -102,7 +102,7 @@ panvk_per_arch(CmdDispatchBase)(VkCommandBuffer commandBuffer, struct panfrost_ptr copy_desc_job = panvk_per_arch(meta_get_copy_desc_job)( dev, &cmdbuf->desc_pool.base, shader, &cmdbuf->state.compute.desc_state, - cs_desc_state); + cs_desc_state, 0); if (copy_desc_job.cpu) util_dynarray_append(&batch->jobs, void *, copy_desc_job.cpu); diff --git a/src/panfrost/vulkan/jm/panvk_vX_cmd_draw.c b/src/panfrost/vulkan/jm/panvk_vX_cmd_draw.c index 4322aa5b28a..975300a7993 100644 --- a/src/panfrost/vulkan/jm/panvk_vX_cmd_draw.c +++ b/src/panfrost/vulkan/jm/panvk_vX_cmd_draw.c @@ -986,7 +986,7 @@ panvk_draw_prepare_tiler_job(struct panvk_cmd_buffer *cmdbuf, struct panvk_shader_desc_state *fs_desc_state = &cmdbuf->state.gfx.fs.desc; struct panfrost_ptr ptr = panvk_per_arch(meta_get_copy_desc_job)( dev, &cmdbuf->desc_pool.base, fs, &cmdbuf->state.gfx.desc_state, - fs_desc_state); + fs_desc_state, 0); if (ptr.cpu) util_dynarray_append(&batch->jobs, void *, ptr.cpu); @@ -1062,9 +1062,12 @@ panvk_draw_prepare_vs_copy_desc_job(struct panvk_cmd_buffer *cmdbuf, const struct panvk_shader *vs = cmdbuf->state.gfx.vs.shader; const struct panvk_shader_desc_state *vs_desc_state = &cmdbuf->state.gfx.vs.desc; + const struct vk_vertex_input_state *vi = + cmdbuf->vk.dynamic_graphics_state.vi; + unsigned num_vbs = util_last_bit(vi->bindings_valid); struct panfrost_ptr ptr = panvk_per_arch(meta_get_copy_desc_job)( dev, &cmdbuf->desc_pool.base, vs, &cmdbuf->state.gfx.desc_state, - vs_desc_state); + vs_desc_state, num_vbs * pan_size(ATTRIBUTE_BUFFER) * 2); if (ptr.cpu) util_dynarray_append(&batch->jobs, void *, ptr.cpu); @@ -1082,7 +1085,7 @@ panvk_draw_prepare_fs_copy_desc_job(struct panvk_cmd_buffer *cmdbuf, struct panvk_batch *batch = cmdbuf->cur_batch; struct panfrost_ptr ptr = panvk_per_arch(meta_get_copy_desc_job)( dev, &cmdbuf->desc_pool.base, fs, &cmdbuf->state.gfx.desc_state, - fs_desc_state); + fs_desc_state, 0); if (ptr.cpu) util_dynarray_append(&batch->jobs, void *, ptr.cpu); @@ -1163,6 +1166,8 @@ panvk_cmd_draw(struct panvk_cmd_buffer *cmdbuf, struct panvk_draw_info *draw) panvk_per_arch(cmd_alloc_tls_desc)(cmdbuf, true); + panvk_draw_prepare_attributes(cmdbuf, draw); + uint32_t used_set_mask = vs->desc_info.used_set_mask | (fs ? fs->desc_info.used_set_mask : 0); @@ -1210,7 +1215,6 @@ panvk_cmd_draw(struct panvk_cmd_buffer *cmdbuf, struct panvk_draw_info *draw) false); panvk_draw_prepare_fs_rsd(cmdbuf, draw); - panvk_draw_prepare_attributes(cmdbuf, draw); panvk_draw_prepare_viewport(cmdbuf, draw); batch->tlsinfo.tls.size = MAX3(vs->info.tls_size, fs ? fs->info.tls_size : 0, batch->tlsinfo.tls.size); diff --git a/src/panfrost/vulkan/panvk_meta.h b/src/panfrost/vulkan/panvk_meta.h index 3bc2b714b05..b54a39d0b16 100644 --- a/src/panfrost/vulkan/panvk_meta.h +++ b/src/panfrost/vulkan/panvk_meta.h @@ -85,7 +85,8 @@ struct panfrost_ptr panvk_per_arch(meta_get_copy_desc_job)( struct panvk_device *dev, struct pan_pool *desc_pool, const struct panvk_shader *shader, const struct panvk_descriptor_state *desc_state, - const struct panvk_shader_desc_state *shader_desc_state); + const struct panvk_shader_desc_state *shader_desc_state, + uint32_t attrib_buf_idx_offset); #endif void panvk_per_arch(meta_init)(struct panvk_device *dev); |