Revert "radv: upload the PS epilog in the existing pipeline BO"
This is completely broken because the PS epilog has refcount and
radv_upload_shaders() updates its VA.
This reverts commit 7c34b31db2
.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18632>
This commit is contained in:

committed by
Marge Bot

parent
0fc38b358b
commit
299d294304
@@ -1408,6 +1408,8 @@ radv_emit_ps_epilog(struct radv_cmd_buffer *cmd_buffer)
|
|||||||
*/
|
*/
|
||||||
assert(G_00B848_VGPRS(ps_shader->config.rsrc1) >= G_00B848_VGPRS(ps_epilog->rsrc1));
|
assert(G_00B848_VGPRS(ps_shader->config.rsrc1) >= G_00B848_VGPRS(ps_epilog->rsrc1));
|
||||||
|
|
||||||
|
radv_cs_add_buffer(cmd_buffer->device->ws, cmd_buffer->cs, ps_epilog->bo);
|
||||||
|
|
||||||
assert((ps_epilog->va >> 32) == cmd_buffer->device->physical_device->rad_info.address32_hi);
|
assert((ps_epilog->va >> 32) == cmd_buffer->device->physical_device->rad_info.address32_hi);
|
||||||
|
|
||||||
struct radv_userdata_info *loc =
|
struct radv_userdata_info *loc =
|
||||||
|
@@ -3108,14 +3108,8 @@ non_uniform_access_callback(const nir_src *src, void *_)
|
|||||||
VkResult
|
VkResult
|
||||||
radv_upload_shaders(struct radv_device *device, struct radv_pipeline *pipeline)
|
radv_upload_shaders(struct radv_device *device, struct radv_pipeline *pipeline)
|
||||||
{
|
{
|
||||||
struct radv_shader_part *ps_epilog = NULL;
|
|
||||||
uint32_t code_size = 0;
|
uint32_t code_size = 0;
|
||||||
|
|
||||||
if (pipeline->type == RADV_PIPELINE_GRAPHICS) {
|
|
||||||
struct radv_graphics_pipeline *graphics_pipeline = radv_pipeline_to_graphics(pipeline);
|
|
||||||
ps_epilog = graphics_pipeline->ps_epilog;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Compute the total code size. */
|
/* Compute the total code size. */
|
||||||
for (int i = 0; i < MESA_VULKAN_SHADER_STAGES; i++) {
|
for (int i = 0; i < MESA_VULKAN_SHADER_STAGES; i++) {
|
||||||
struct radv_shader *shader = pipeline->shaders[i];
|
struct radv_shader *shader = pipeline->shaders[i];
|
||||||
@@ -3129,10 +3123,6 @@ radv_upload_shaders(struct radv_device *device, struct radv_pipeline *pipeline)
|
|||||||
code_size += align(pipeline->gs_copy_shader->code_size, RADV_SHADER_ALLOC_ALIGNMENT);
|
code_size += align(pipeline->gs_copy_shader->code_size, RADV_SHADER_ALLOC_ALIGNMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ps_epilog) {
|
|
||||||
code_size += align(ps_epilog->code_size, RADV_SHADER_ALLOC_ALIGNMENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Allocate memory for all shader binaries. */
|
/* Allocate memory for all shader binaries. */
|
||||||
pipeline->slab = radv_pipeline_slab_create(device, pipeline, code_size);
|
pipeline->slab = radv_pipeline_slab_create(device, pipeline, code_size);
|
||||||
if (!pipeline->slab)
|
if (!pipeline->slab)
|
||||||
@@ -3166,15 +3156,6 @@ radv_upload_shaders(struct radv_device *device, struct radv_pipeline *pipeline)
|
|||||||
if (!radv_shader_binary_upload(device, pipeline->gs_copy_shader->binary,
|
if (!radv_shader_binary_upload(device, pipeline->gs_copy_shader->binary,
|
||||||
pipeline->gs_copy_shader, dest_ptr))
|
pipeline->gs_copy_shader, dest_ptr))
|
||||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||||
|
|
||||||
slab_offset += align(pipeline->gs_copy_shader->code_size, RADV_SHADER_ALLOC_ALIGNMENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ps_epilog) {
|
|
||||||
ps_epilog->va = slab_va + slab_offset;
|
|
||||||
|
|
||||||
void *dest_ptr = slab_ptr + slab_offset;
|
|
||||||
radv_shader_part_binary_upload(ps_epilog->binary, dest_ptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
|
@@ -2516,17 +2516,35 @@ radv_create_ps_epilog(struct radv_device *device, const struct radv_ps_epilog_ke
|
|||||||
(void **)&binary);
|
(void **)&binary);
|
||||||
|
|
||||||
epilog = radv_shader_part_create(binary, info.wave_size);
|
epilog = radv_shader_part_create(binary, info.wave_size);
|
||||||
if (!epilog) {
|
if (!epilog)
|
||||||
free(binary);
|
goto fail_create;
|
||||||
return NULL;
|
|
||||||
}
|
/* Allocate memory and upload the epilog. */
|
||||||
|
epilog->alloc = radv_alloc_shader_memory(device, epilog->code_size, NULL);
|
||||||
|
if (!epilog->alloc)
|
||||||
|
goto fail_alloc;
|
||||||
|
|
||||||
|
epilog->bo = epilog->alloc->arena->bo;
|
||||||
|
epilog->va = radv_buffer_get_va(epilog->bo) + epilog->alloc->offset;
|
||||||
|
|
||||||
|
void *dest_ptr = epilog->alloc->arena->ptr + epilog->alloc->offset;
|
||||||
|
radv_shader_part_binary_upload(binary, dest_ptr);
|
||||||
|
|
||||||
if (options.dump_shader) {
|
if (options.dump_shader) {
|
||||||
fprintf(stderr, "Fragment epilog");
|
fprintf(stderr, "Fragment epilog");
|
||||||
fprintf(stderr, "\ndisasm:\n%s\n", epilog->disasm_string);
|
fprintf(stderr, "\ndisasm:\n%s\n", epilog->disasm_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(epilog->binary);
|
||||||
|
epilog->binary = NULL;
|
||||||
|
|
||||||
return epilog;
|
return epilog;
|
||||||
|
|
||||||
|
fail_alloc:
|
||||||
|
radv_shader_part_destroy(device, epilog);
|
||||||
|
fail_create:
|
||||||
|
free(binary);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Reference in New Issue
Block a user