[Mesa-dev] [PATCH 3/4] radeonsi: Read config values from the .AMDGPU.config ELF section
Tom Stellard
tom at stellard.net
Fri Apr 5 11:54:14 PDT 2013
From: Tom Stellard <thomas.stellard at amd.com>
---
src/gallium/drivers/radeonsi/radeonsi_shader.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c b/src/gallium/drivers/radeonsi/radeonsi_shader.c
index 218997f..0aeecc2 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_shader.c
+++ b/src/gallium/drivers/radeonsi/radeonsi_shader.c
@@ -1175,9 +1175,9 @@ int si_pipe_shader_create(
}
}
- shader->num_sgprs = util_le32_to_cpu(*(uint32_t*)binary.code);
- shader->num_vgprs = util_le32_to_cpu(*(uint32_t*)(binary.code + 4));
- shader->spi_ps_input_ena = util_le32_to_cpu(*(uint32_t*)(binary.code + 8));
+ shader->num_sgprs = util_le32_to_cpu(*(uint32_t*)binary.config);
+ shader->num_vgprs = util_le32_to_cpu(*(uint32_t*)(binary.config + 4));
+ shader->spi_ps_input_ena = util_le32_to_cpu(*(uint32_t*)(binary.config + 8));
radeon_llvm_dispose(&si_shader_ctx.radeon_bld);
tgsi_parse_free(&si_shader_ctx.parse);
@@ -1185,7 +1185,7 @@ int si_pipe_shader_create(
/* copy new shader */
si_resource_reference(&shader->bo, NULL);
shader->bo = si_resource_create_custom(ctx->screen, PIPE_USAGE_IMMUTABLE,
- binary.code_size - 12);
+ binary.code_size);
if (shader->bo == NULL) {
FREE(si_shader_ctx.constants);
FREE(si_shader_ctx.resources);
@@ -1195,11 +1195,11 @@ int si_pipe_shader_create(
ptr = (uint32_t*)rctx->ws->buffer_map(shader->bo->cs_buf, rctx->cs, PIPE_TRANSFER_WRITE);
if (0 /*R600_BIG_ENDIAN*/) {
- for (i = 0; i < (binary.code_size-12)/4; ++i) {
- ptr[i] = util_bswap32(*(uint32_t*)(binary.code+12 + i*4));
+ for (i = 0; i < binary.code_size / 4; ++i) {
+ ptr[i] = util_bswap32(*(uint32_t*)(binary.code + i*4));
}
} else {
- memcpy(ptr, binary.code + 12, binary.code_size - 12);
+ memcpy(ptr, binary.code, binary.code_size);
}
rctx->ws->buffer_unmap(shader->bo->cs_buf);
--
1.8.1.5
More information about the mesa-dev
mailing list