[Mesa-dev] [PATCH] radeonsi: Add config parameter to si_shader_apply_scratch_relocs.
Tom Stellard
tom at stellard.net
Thu Apr 21 17:00:34 UTC 2016
On Thu, Apr 21, 2016 at 06:28:15PM +0200, Bas Nieuwenhuizen wrote:
> shader->config is not updated for compute kernels.
>
> Signed-off-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
This fixes compute shaders that use scratch. Thanks.
Reviewed-by: Tom Stellard <thomas.stellard at amd.com>
> ---
> src/gallium/drivers/radeonsi/si_compute.c | 2 +-
> src/gallium/drivers/radeonsi/si_shader.c | 3 ++-
> src/gallium/drivers/radeonsi/si_shader.h | 1 +
> src/gallium/drivers/radeonsi/si_state_shaders.c | 2 +-
> 4 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c
> index 905c169..7e05be5 100644
> --- a/src/gallium/drivers/radeonsi/si_compute.c
> +++ b/src/gallium/drivers/radeonsi/si_compute.c
> @@ -221,7 +221,7 @@ static bool si_setup_compute_scratch_buffer(struct si_context *sctx,
> if (sctx->compute_scratch_buffer != shader->scratch_bo && scratch_needed) {
> uint64_t scratch_va = sctx->compute_scratch_buffer->gpu_address;
>
> - si_shader_apply_scratch_relocs(sctx, shader, scratch_va);
> + si_shader_apply_scratch_relocs(sctx, shader, config, scratch_va);
>
> if (si_shader_binary_upload(sctx->screen, shader))
> return false;
> diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
> index 3bf68eb..c48ae3b 100644
> --- a/src/gallium/drivers/radeonsi/si_shader.c
> +++ b/src/gallium/drivers/radeonsi/si_shader.c
> @@ -5394,13 +5394,14 @@ void si_shader_binary_read_config(struct radeon_shader_binary *binary,
>
> void si_shader_apply_scratch_relocs(struct si_context *sctx,
> struct si_shader *shader,
> + struct si_shader_config *config,
> uint64_t scratch_va)
> {
> unsigned i;
> uint32_t scratch_rsrc_dword0 = scratch_va;
> uint32_t scratch_rsrc_dword1 =
> S_008F04_BASE_ADDRESS_HI(scratch_va >> 32)
> - | S_008F04_STRIDE(shader->config.scratch_bytes_per_wave / 64);
> + | S_008F04_STRIDE(config->scratch_bytes_per_wave / 64);
>
> for (i = 0 ; i < shader->binary.reloc_count; i++) {
> const struct radeon_shader_reloc *reloc =
> diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h
> index 6ea849d..857a682 100644
> --- a/src/gallium/drivers/radeonsi/si_shader.h
> +++ b/src/gallium/drivers/radeonsi/si_shader.h
> @@ -478,6 +478,7 @@ void si_shader_dump(struct si_screen *sscreen, struct si_shader *shader,
> FILE *f);
> void si_shader_apply_scratch_relocs(struct si_context *sctx,
> struct si_shader *shader,
> + struct si_shader_config *config,
> uint64_t scratch_va);
> void si_shader_binary_read_config(struct radeon_shader_binary *binary,
> struct si_shader_config *conf,
> diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
> index d560aae..49e688a 100644
> --- a/src/gallium/drivers/radeonsi/si_state_shaders.c
> +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
> @@ -1634,7 +1634,7 @@ static int si_update_scratch_buffer(struct si_context *sctx,
>
> assert(sctx->scratch_buffer);
>
> - si_shader_apply_scratch_relocs(sctx, shader, scratch_va);
> + si_shader_apply_scratch_relocs(sctx, shader, &shader->config, scratch_va);
>
> /* Replace the shader bo with a new bo that has the relocs applied. */
> r = si_shader_binary_upload(sctx->screen, shader);
> --
> 2.8.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list