aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2019-07-01 17:26:09 +0200
committerBas Nieuwenhuizen <[email protected]>2019-07-04 10:52:26 +0000
commitcb07f91489d164f15bdd43e174cc4d8a65be4cc0 (patch)
tree5aac67577e45bc642d6c3a31f0b94086ba5d68d7 /src/gallium/drivers/r600
parent510e74ff48d035d1c3f4112738132b9d8d823c93 (diff)
amd/common: move ac_shader_{binary,reloc} into r600 and rename
They are no longer used by radeonsi or radv. Reviewed-by: Bas Nieuwenhuizen <[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r600')
-rw-r--r--src/gallium/drivers/r600/evergreen_compute.c35
-rw-r--r--src/gallium/drivers/r600/evergreen_compute_internal.h39
-rw-r--r--src/gallium/drivers/r600/r600_pipe_common.c21
-rw-r--r--src/gallium/drivers/r600/r600_pipe_common.h6
4 files changed, 65 insertions, 36 deletions
diff --git a/src/gallium/drivers/r600/evergreen_compute.c b/src/gallium/drivers/r600/evergreen_compute.c
index 1536210c7ef..dea01e48505 100644
--- a/src/gallium/drivers/r600/evergreen_compute.c
+++ b/src/gallium/drivers/r600/evergreen_compute.c
@@ -84,6 +84,25 @@ writable images will consume TEX slots, VTX slots too because of linear indexing
*/
+MAYBE_UNUSED
+static void radeon_shader_binary_init(struct r600_shader_binary *b)
+{
+ memset(b, 0, sizeof(*b));
+}
+
+MAYBE_UNUSED
+static void radeon_shader_binary_clean(struct r600_shader_binary *b)
+{
+ if (!b)
+ return;
+ FREE(b->code);
+ FREE(b->config);
+ FREE(b->rodata);
+ FREE(b->global_symbol_offsets);
+ FREE(b->relocs);
+ FREE(b->disasm_string);
+}
+
struct r600_resource *r600_compute_buffer_alloc_vram(struct r600_screen *screen,
unsigned size)
{
@@ -186,7 +205,7 @@ static void evergreen_cs_set_constant_buffer(struct r600_context *rctx,
#ifdef HAVE_OPENCL
static void parse_symbol_table(Elf_Data *symbol_table_data,
const GElf_Shdr *symbol_table_header,
- struct ac_shader_binary *binary)
+ struct r600_shader_binary *binary)
{
GElf_Sym symbol;
unsigned i = 0;
@@ -230,7 +249,7 @@ static void parse_symbol_table(Elf_Data *symbol_table_data,
static void parse_relocs(Elf *elf, Elf_Data *relocs, Elf_Data *symbols,
unsigned symbol_sh_link,
- struct ac_shader_binary *binary)
+ struct r600_shader_binary *binary)
{
unsigned i;
@@ -238,12 +257,12 @@ static void parse_relocs(Elf *elf, Elf_Data *relocs, Elf_Data *symbols,
return;
}
binary->relocs = CALLOC(binary->reloc_count,
- sizeof(struct ac_shader_reloc));
+ sizeof(struct r600_shader_reloc));
for (i = 0; i < binary->reloc_count; i++) {
GElf_Sym symbol;
GElf_Rel rel;
char *symbol_name;
- struct ac_shader_reloc *reloc = &binary->relocs[i];
+ struct r600_shader_reloc *reloc = &binary->relocs[i];
gelf_getrel(relocs, i, &rel);
gelf_getsym(symbols, GELF_R_SYM(rel.r_info), &symbol);
@@ -256,7 +275,7 @@ static void parse_relocs(Elf *elf, Elf_Data *relocs, Elf_Data *symbols,
}
static void r600_elf_read(const char *elf_data, unsigned elf_size,
- struct ac_shader_binary *binary)
+ struct r600_shader_binary *binary)
{
char *elf_buffer;
Elf *elf;
@@ -335,7 +354,7 @@ static void r600_elf_read(const char *elf_data, unsigned elf_size,
}
static const unsigned char *r600_shader_binary_config_start(
- const struct ac_shader_binary *binary,
+ const struct r600_shader_binary *binary,
uint64_t symbol_offset)
{
unsigned i;
@@ -348,7 +367,7 @@ static const unsigned char *r600_shader_binary_config_start(
return binary->config;
}
-static void r600_shader_binary_read_config(const struct ac_shader_binary *binary,
+static void r600_shader_binary_read_config(const struct r600_shader_binary *binary,
struct r600_bytecode *bc,
uint64_t symbol_offset,
boolean *use_kill)
@@ -384,7 +403,7 @@ static void r600_shader_binary_read_config(const struct ac_shader_binary *binary
}
static unsigned r600_create_shader(struct r600_bytecode *bc,
- const struct ac_shader_binary *binary,
+ const struct r600_shader_binary *binary,
boolean *use_kill)
{
diff --git a/src/gallium/drivers/r600/evergreen_compute_internal.h b/src/gallium/drivers/r600/evergreen_compute_internal.h
index db3f24d3822..4f3ba564fd0 100644
--- a/src/gallium/drivers/r600/evergreen_compute_internal.h
+++ b/src/gallium/drivers/r600/evergreen_compute_internal.h
@@ -30,10 +30,47 @@
#include <llvm-c/Core.h>
#endif
+struct r600_shader_reloc {
+ char name[32];
+ uint64_t offset;
+};
+
+struct r600_shader_binary {
+ unsigned code_size;
+ unsigned config_size;
+ /** The number of bytes of config information for each global symbol.
+ */
+ unsigned config_size_per_symbol;
+ unsigned rodata_size;
+ unsigned global_symbol_count;
+ unsigned reloc_count;
+
+ /** Shader code */
+ unsigned char *code;
+
+ /** Config/Context register state that accompanies this shader.
+ * This is a stream of dword pairs. First dword contains the
+ * register address, the second dword contains the value.*/
+ unsigned char *config;
+
+
+ /** Constant data accessed by the shader. This will be uploaded
+ * into a constant buffer. */
+ unsigned char *rodata;
+
+ /** List of symbol offsets for the shader */
+ uint64_t *global_symbol_offsets;
+
+ struct r600_shader_reloc *relocs;
+
+ /** Disassembled shader in a string. */
+ char *disasm_string;
+};
+
struct r600_pipe_compute {
struct r600_context *ctx;
- struct ac_shader_binary binary;
+ struct r600_shader_binary binary;
enum pipe_shader_ir ir_type;
diff --git a/src/gallium/drivers/r600/r600_pipe_common.c b/src/gallium/drivers/r600/r600_pipe_common.c
index 566c63cc4d8..9eee322a28b 100644
--- a/src/gallium/drivers/r600/r600_pipe_common.c
+++ b/src/gallium/drivers/r600/r600_pipe_common.c
@@ -60,27 +60,6 @@ struct r600_multi_fence {
};
/*
- * shader binary helpers.
- */
-void radeon_shader_binary_init(struct ac_shader_binary *b)
-{
- memset(b, 0, sizeof(*b));
-}
-
-void radeon_shader_binary_clean(struct ac_shader_binary *b)
-{
- if (!b)
- return;
- FREE(b->code);
- FREE(b->config);
- FREE(b->rodata);
- FREE(b->global_symbol_offsets);
- FREE(b->relocs);
- FREE(b->disasm_string);
- FREE(b->llvm_ir_string);
-}
-
-/*
* pipe_context
*/
diff --git a/src/gallium/drivers/r600/r600_pipe_common.h b/src/gallium/drivers/r600/r600_pipe_common.h
index b43b7eecd10..c5929c24fb0 100644
--- a/src/gallium/drivers/r600/r600_pipe_common.h
+++ b/src/gallium/drivers/r600/r600_pipe_common.h
@@ -34,8 +34,6 @@
#include <stdio.h>
-#include "amd/common/ac_binary.h"
-
#include "radeon/radeon_winsys.h"
#include "util/disk_cache.h"
@@ -48,7 +46,6 @@
#include "util/u_threaded_context.h"
struct u_log_context;
-
#define ATI_VENDOR_ID 0x1002
#define R600_RESOURCE_FLAG_TRANSFER (PIPE_RESOURCE_FLAG_DRV_PRIV << 0)
@@ -132,9 +129,6 @@ struct r600_perfcounters;
struct tgsi_shader_info;
struct r600_qbo_state;
-void radeon_shader_binary_init(struct ac_shader_binary *b);
-void radeon_shader_binary_clean(struct ac_shader_binary *b);
-
/* Only 32-bit buffer allocations are supported, gallium doesn't support more
* at the moment.
*/