[Mesa-dev] [PATCH 5/6] radeon/ac: switch to ac_shader_binary_config_start()

Timothy Arceri tarceri at itsqueeze.com
Mon Feb 27 00:49:54 UTC 2017


For radeonsi we could probably switch to
ac_shader_binary_read_config(). However the functions have
diverged so just share this helper for now.
---
 src/gallium/drivers/r600/evergreen_compute.c | 3 ++-
 src/gallium/drivers/radeonsi/si_shader.c     | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_compute.c b/src/gallium/drivers/r600/evergreen_compute.c
index 2d5130f..2ddcbb3 100644
--- a/src/gallium/drivers/r600/evergreen_compute.c
+++ b/src/gallium/drivers/r600/evergreen_compute.c
@@ -19,20 +19,21 @@
  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  * USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
  * Authors:
  *      Adam Rak <adam.rak at streamnovation.com>
  */
 
 #include <stdio.h>
 #include <errno.h>
+#include "ac_binary.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_state.h"
 #include "pipe/p_context.h"
 #include "util/u_blitter.h"
 #include "util/list.h"
 #include "util/u_transfer.h"
 #include "util/u_surface.h"
 #include "util/u_pack_color.h"
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
@@ -180,21 +181,21 @@ static void evergreen_cs_set_constant_buffer(struct r600_context *rctx,
 
 #ifdef HAVE_OPENCL
 
 static void r600_shader_binary_read_config(const struct ac_shader_binary *binary,
 					   struct r600_bytecode *bc,
 					   uint64_t symbol_offset,
 					   boolean *use_kill)
 {
        unsigned i;
        const unsigned char *config =
-               radeon_shader_binary_config_start(binary, symbol_offset);
+               ac_shader_binary_config_start(binary, symbol_offset);
 
        for (i = 0; i < binary->config_size_per_symbol; i+= 8) {
                unsigned reg =
                        util_le32_to_cpu(*(uint32_t*)(config + i));
                unsigned value =
                        util_le32_to_cpu(*(uint32_t*)(config + i + 4));
                switch (reg) {
                /* R600 / R700 */
                case R_028850_SQ_PGM_RESOURCES_PS:
                case R_028868_SQ_PGM_RESOURCES_VS:
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index e51b7c9..8e51ae8 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -26,27 +26,27 @@
  *      Christian König <christian.koenig at amd.com>
  */
 
 #include "gallivm/lp_bld_const.h"
 #include "gallivm/lp_bld_gather.h"
 #include "gallivm/lp_bld_intr.h"
 #include "gallivm/lp_bld_logic.h"
 #include "gallivm/lp_bld_arit.h"
 #include "gallivm/lp_bld_flow.h"
 #include "gallivm/lp_bld_misc.h"
-#include "radeon/radeon_elf_util.h"
 #include "util/u_memory.h"
 #include "util/u_string.h"
 #include "tgsi/tgsi_build.h"
 #include "tgsi/tgsi_util.h"
 #include "tgsi/tgsi_dump.h"
 
+#include "ac_binary.h"
 #include "ac_llvm_util.h"
 #include "si_shader_internal.h"
 #include "si_pipe.h"
 #include "sid.h"
 
 
 static const char *scratch_rsrc_dword0_symbol =
 	"SCRATCH_RSRC_DWORD0";
 
 static const char *scratch_rsrc_dword1_symbol =
@@ -5749,21 +5749,21 @@ static void si_llvm_emit_polygon_stipple(struct si_shader_context *ctx,
 			      LLVMConstReal(ctx->f32, -1), "");
 	lp_build_intrinsic(builder, "llvm.AMDGPU.kill", ctx->voidt, &bit, 1, 0);
 }
 
 void si_shader_binary_read_config(struct ac_shader_binary *binary,
 				  struct si_shader_config *conf,
 				  unsigned symbol_offset)
 {
 	unsigned i;
 	const unsigned char *config =
-		radeon_shader_binary_config_start(binary, symbol_offset);
+		ac_shader_binary_config_start(binary, symbol_offset);
 	bool really_needs_scratch = false;
 
 	/* LLVM adds SGPR spills to the scratch size.
 	 * Find out if we really need the scratch buffer.
 	 */
 	for (i = 0; i < binary->reloc_count; i++) {
 		const struct ac_shader_reloc *reloc = &binary->relocs[i];
 
 		if (!strcmp(scratch_rsrc_dword0_symbol, reloc->name) ||
 		    !strcmp(scratch_rsrc_dword1_symbol, reloc->name)) {
-- 
2.9.3



More information about the mesa-dev mailing list