amd/common: move ac_shader_{binary,reloc} into r600 and rename

They are no longer used by radeonsi or radv.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
Nicolai Hähnle
2019-07-01 17:26:09 +02:00
committed by Bas Nieuwenhuizen
parent 510e74ff48
commit cb07f91489
6 changed files with 65 additions and 75 deletions
-38
View File
@@ -32,44 +32,6 @@
extern "C" {
#endif
struct ac_shader_reloc {
char name[32];
uint64_t offset;
};
struct ac_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 ac_shader_reloc *relocs;
/** Disassembled shader in a string. */
char *disasm_string;
char *llvm_ir_string;
};
struct ac_shader_config {
unsigned num_sgprs;
unsigned num_vgprs;
-1
View File
@@ -35,7 +35,6 @@
extern "C" {
#endif
struct ac_shader_binary;
struct ac_compiler_passes;
enum ac_func_attr {
+27 -8
View File
@@ -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)
{
@@ -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;
@@ -59,27 +59,6 @@ struct r600_multi_fence {
} gfx_unflushed;
};
/*
* 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
*/
@@ -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.
*/