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: 7bea6f8612 ("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>
This commit is contained in:
Mary Guillemard
2024-07-01 11:45:59 +02:00
committed by Marge Bot
parent 3b1b672849
commit cec45cac84
5 changed files with 17 additions and 8 deletions

View File

@@ -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);

View File

@@ -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};

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);