r600/sfn: rework getting a vector and uniforms from the value pool
[mesa.git] / src / amd / common / ac_rtld.h
index 0d93488fbbb81cefa2bcebb2ed502ab97d6e25f6..a4343d9b3ef50a95d23a06f92efef204a149030a 100644 (file)
 #include <stdint.h>
 #include <stddef.h>
 
+#include "util/u_dynarray.h"
+#include "compiler/shader_enums.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct ac_rtld_part;
 struct ac_shader_config;
+struct radeon_info;
+
+struct ac_rtld_symbol {
+       const char *name;
+       uint32_t size;
+       uint32_t align;
+       uint64_t offset; /* filled in by ac_rtld_open */
+       unsigned part_idx; /* shader part in which this symbol appears */
+};
+
+struct ac_rtld_options {
+       /* Loader will insert an s_sethalt 1 instruction as the
+        * first instruction. */
+       bool halt_at_entry:1;
+};
 
 /* Lightweight wrapper around underlying ELF objects. */
 struct ac_rtld_binary {
+       struct ac_rtld_options options;
+       unsigned wave_size;
+
        /* Required buffer sizes, currently read/executable only. */
        uint64_t rx_size;
 
+       /* Size of executable code, for reporting purposes. */
+       uint64_t exec_size;
+
        uint64_t rx_end_markers;
 
        unsigned num_parts;
        struct ac_rtld_part *parts;
+
+       struct util_dynarray lds_symbols;
+       uint32_t lds_size;
 };
 
 /**
@@ -54,9 +85,31 @@ struct ac_rtld_binary {
 typedef bool (*ac_rtld_get_external_symbol_cb)(
        void *cb_data, const char *symbol, uint64_t *value);
 
-bool ac_rtld_open(struct ac_rtld_binary *binary, unsigned num_parts,
-                 const char * const *elf_ptrs,
-                 const size_t *elf_sizes);
+/**
+ * Lifetimes of \ref info, in-memory ELF objects, and the names of
+ * \ref shared_lds_symbols must extend until \ref ac_rtld_close is called on
+ * the opened binary.
+ */
+struct ac_rtld_open_info {
+       const struct radeon_info *info;
+       struct ac_rtld_options options;
+       gl_shader_stage shader_type;
+       unsigned wave_size;
+
+       unsigned num_parts;
+       const char * const *elf_ptrs; /* in-memory ELF objects of each part */
+       const size_t *elf_sizes; /* sizes of corresponding in-memory ELF objects in bytes */
+
+       /* Shared LDS symbols are layouted such that they are accessible from
+        * all shader parts. Non-shared (private) LDS symbols of one part may
+        * overlap private LDS symbols of another shader part.
+        */
+       unsigned num_shared_lds_symbols;
+       const struct ac_rtld_symbol *shared_lds_symbols;
+};
+
+bool ac_rtld_open(struct ac_rtld_binary *binary,
+                 struct ac_rtld_open_info i);
 
 void ac_rtld_close(struct ac_rtld_binary *binary);
 
@@ -85,4 +138,8 @@ struct ac_rtld_upload_info {
 
 bool ac_rtld_upload(struct ac_rtld_upload_info *u);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* AC_RTLD_H */