[Mesa-dev] [PATCH 10/14] freedreno/ir3: some header file cleanup
Rob Clark
robdclark at gmail.com
Mon Nov 12 15:50:54 UTC 2018
Clean up some of the low-hanging-fruit usages of freedreno_util.h
Signed-off-by: Rob Clark <robdclark at gmail.com>
---
.../drivers/freedreno/ir3/disasm-a3xx.c | 7 ++++++-
src/gallium/drivers/freedreno/ir3/instr-a3xx.h | 3 +++
src/gallium/drivers/freedreno/ir3/ir3.c | 3 ++-
src/gallium/drivers/freedreno/ir3/ir3.h | 3 ++-
.../drivers/freedreno/ir3/ir3_cmdline.c | 2 --
.../drivers/freedreno/ir3/ir3_compiler_nir.c | 18 +++++++-----------
src/gallium/drivers/freedreno/ir3/ir3_cp.c | 2 +-
src/gallium/drivers/freedreno/ir3/ir3_group.c | 2 --
.../drivers/freedreno/ir3/ir3_legalize.c | 3 +--
src/gallium/drivers/freedreno/ir3/ir3_ra.c | 2 --
src/gallium/drivers/freedreno/ir3/ir3_shader.h | 5 ++---
11 files changed, 24 insertions(+), 26 deletions(-)
diff --git a/src/gallium/drivers/freedreno/ir3/disasm-a3xx.c b/src/gallium/drivers/freedreno/ir3/disasm-a3xx.c
index 247175f142c..4cf45ce9227 100644
--- a/src/gallium/drivers/freedreno/ir3/disasm-a3xx.c
+++ b/src/gallium/drivers/freedreno/ir3/disasm-a3xx.c
@@ -30,9 +30,14 @@
#include <util/u_debug.h>
-#include "disasm.h"
#include "instr-a3xx.h"
+/* bitmask of debug flags */
+enum debug_t {
+ PRINT_RAW = 0x1, /* dump raw hexdump */
+ PRINT_VERBOSE = 0x2,
+};
+
static enum debug_t debug;
#define printf debug_printf
diff --git a/src/gallium/drivers/freedreno/ir3/instr-a3xx.h b/src/gallium/drivers/freedreno/ir3/instr-a3xx.h
index 8ec64b6eb35..7f60ee5fd4c 100644
--- a/src/gallium/drivers/freedreno/ir3/instr-a3xx.h
+++ b/src/gallium/drivers/freedreno/ir3/instr-a3xx.h
@@ -27,6 +27,7 @@
#define PACKED __attribute__((__packed__))
#include <stdint.h>
+#include <stdio.h>
#include <stdbool.h>
#include <assert.h>
@@ -866,4 +867,6 @@ static inline bool is_ssbo(opc_t opc)
}
}
+int disasm_a3xx(uint32_t *dwords, int sizedwords, int level, FILE *out);
+
#endif /* INSTR_A3XX_H_ */
diff --git a/src/gallium/drivers/freedreno/ir3/ir3.c b/src/gallium/drivers/freedreno/ir3/ir3.c
index 3f1216bdaa7..3d1c4449b12 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3.c
@@ -30,9 +30,10 @@
#include <stdbool.h>
#include <errno.h>
+#include "util/bitscan.h"
#include "util/ralloc.h"
+#include "util/u_math.h"
-#include "freedreno_util.h"
#include "instr-a3xx.h"
/* simple allocator to carve allocations out of an up-front allocated heap,
diff --git a/src/gallium/drivers/freedreno/ir3/ir3.h b/src/gallium/drivers/freedreno/ir3/ir3.h
index d031b570ec8..ea3218828df 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3.h
+++ b/src/gallium/drivers/freedreno/ir3/ir3.h
@@ -27,11 +27,12 @@
#include <stdint.h>
#include <stdbool.h>
+#include "compiler/shader_enums.h"
+
#include "util/u_debug.h"
#include "util/list.h"
#include "instr-a3xx.h"
-#include "disasm.h" /* TODO move 'gl_shader_stage' somewhere else.. */
/* low level intermediate representation of an adreno shader program */
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c b/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c
index d1e1af0d0b6..77fba9f4445 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c
@@ -37,8 +37,6 @@
#include "tgsi/tgsi_text.h"
#include "tgsi/tgsi_dump.h"
-#include "freedreno_util.h"
-
#include "ir3_compiler.h"
#include "ir3_nir.h"
#include "instr-a3xx.h"
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
index 83f9a3605cc..75c00a02224 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
@@ -31,8 +31,6 @@
#include "util/u_memory.h"
#include "util/u_inlines.h"
-#include "freedreno_util.h"
-
#include "ir3_compiler.h"
#include "ir3_shader.h"
#include "ir3_nir.h"
@@ -40,6 +38,12 @@
#include "instr-a3xx.h"
#include "ir3.h"
+/* for conditionally setting boolean flag(s): */
+#define COND(bool, val) ((bool) ? (val) : 0)
+
+#define DBG(fmt, ...) \
+ do { debug_printf("%s:%d: "fmt "\n", \
+ __FUNCTION__, __LINE__, ##__VA_ARGS__); } while (0)
struct ir3_context {
struct ir3_compiler *compiler;
@@ -182,7 +186,7 @@ compile_init(struct ir3_compiler *compiler,
NIR_PASS_V(ctx->s, nir_convert_from_ssa, true);
if (ir3_shader_debug & IR3_DBG_DISASM) {
- DBG("dump nir%dv%d: type=%d, k={cts=%u,hp=%u}",
+ printf("dump nir%dv%d: type=%d, k={cts=%u,hp=%u}",
so->shader->id, so->id, so->type,
so->key.color_two_side, so->key.half_precision);
nir_print_shader(ctx->s, stdout);
@@ -3270,14 +3274,10 @@ static void
setup_input(struct ir3_context *ctx, nir_variable *in)
{
struct ir3_shader_variant *so = ctx->so;
- unsigned array_len = MAX2(glsl_get_length(in->type), 1);
unsigned ncomp = glsl_get_components(in->type);
unsigned n = in->data.driver_location;
unsigned slot = in->data.location;
- DBG("; in: slot=%u, len=%ux%u, drvloc=%u",
- slot, array_len, ncomp, n);
-
/* let's pretend things other than vec4 don't exist: */
ncomp = MAX2(ncomp, 4);
@@ -3370,15 +3370,11 @@ static void
setup_output(struct ir3_context *ctx, nir_variable *out)
{
struct ir3_shader_variant *so = ctx->so;
- unsigned array_len = MAX2(glsl_get_length(out->type), 1);
unsigned ncomp = glsl_get_components(out->type);
unsigned n = out->data.driver_location;
unsigned slot = out->data.location;
unsigned comp = 0;
- DBG("; out: slot=%u, len=%ux%u, drvloc=%u",
- slot, array_len, ncomp, n);
-
/* let's pretend things other than vec4 don't exist: */
ncomp = MAX2(ncomp, 4);
compile_assert(ctx, ncomp == 4);
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_cp.c b/src/gallium/drivers/freedreno/ir3/ir3_cp.c
index 10c144cacb0..e8e8cc311e3 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_cp.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_cp.c
@@ -24,7 +24,7 @@
* Rob Clark <robclark at freedesktop.org>
*/
-#include "freedreno_util.h"
+#include <math.h>
#include "ir3.h"
#include "ir3_shader.h"
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_group.c b/src/gallium/drivers/freedreno/ir3/ir3_group.c
index 28fd97ffb05..570055973e8 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_group.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_group.c
@@ -24,8 +24,6 @@
* Rob Clark <robclark at freedesktop.org>
*/
-#include "freedreno_util.h"
-
#include "ir3.h"
/*
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_legalize.c b/src/gallium/drivers/freedreno/ir3/ir3_legalize.c
index 18bdc6ceb1f..ff4c644eab5 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_legalize.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_legalize.c
@@ -24,10 +24,9 @@
* Rob Clark <robclark at freedesktop.org>
*/
+#include "util/ralloc.h"
#include "util/u_math.h"
-#include "freedreno_util.h"
-
#include "ir3.h"
/*
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_ra.c b/src/gallium/drivers/freedreno/ir3/ir3_ra.c
index 8dfa8195606..ad09c4018d3 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_ra.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_ra.c
@@ -29,8 +29,6 @@
#include "util/ralloc.h"
#include "util/bitset.h"
-#include "freedreno_util.h"
-
#include "ir3.h"
#include "ir3_compiler.h"
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_shader.h b/src/gallium/drivers/freedreno/ir3/ir3_shader.h
index 270b9c09110..d32ef10a160 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_shader.h
+++ b/src/gallium/drivers/freedreno/ir3/ir3_shader.h
@@ -27,12 +27,13 @@
#ifndef IR3_SHADER_H_
#define IR3_SHADER_H_
+#include <stdio.h>
+
#include "pipe/p_state.h"
#include "compiler/shader_enums.h"
#include "util/bitscan.h"
#include "ir3.h"
-#include "disasm.h"
struct glsl_type;
@@ -412,8 +413,6 @@ ir3_shader_stage(struct ir3_shader *shader)
* Helper/util:
*/
-#include "pipe/p_shader_tokens.h"
-
static inline int
ir3_find_output(const struct ir3_shader_variant *so, gl_varying_slot slot)
{
--
2.19.1
More information about the mesa-dev
mailing list