Clean up some of the low-hanging-fruit usages of freedreno_util.h
Signed-off-by: Rob Clark <robdclark@gmail.com>
#include <util/u_debug.h>
#include <util/u_debug.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
static enum debug_t debug;
#define printf debug_printf
#define PACKED __attribute__((__packed__))
#include <stdint.h>
#define PACKED __attribute__((__packed__))
#include <stdint.h>
#include <stdbool.h>
#include <assert.h>
#include <stdbool.h>
#include <assert.h>
+int disasm_a3xx(uint32_t *dwords, int sizedwords, int level, FILE *out);
+
#endif /* INSTR_A3XX_H_ */
#endif /* INSTR_A3XX_H_ */
#include <stdbool.h>
#include <errno.h>
#include <stdbool.h>
#include <errno.h>
+#include "util/bitscan.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,
#include "instr-a3xx.h"
/* simple allocator to carve allocations out of an up-front allocated heap,
#include <stdint.h>
#include <stdbool.h>
#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 "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 */
/* low level intermediate representation of an adreno shader program */
#include "tgsi/tgsi_text.h"
#include "tgsi/tgsi_dump.h"
#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"
#include "ir3_compiler.h"
#include "ir3_nir.h"
#include "instr-a3xx.h"
#include "util/u_memory.h"
#include "util/u_inlines.h"
#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"
#include "ir3_compiler.h"
#include "ir3_shader.h"
#include "ir3_nir.h"
#include "instr-a3xx.h"
#include "ir3.h"
#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;
struct ir3_context {
struct ir3_compiler *compiler;
NIR_PASS_V(ctx->s, nir_convert_from_ssa, true);
if (ir3_shader_debug & IR3_DBG_DISASM) {
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);
so->shader->id, so->id, so->type,
so->key.color_two_side, so->key.half_precision);
nir_print_shader(ctx->s, stdout);
setup_input(struct ir3_context *ctx, nir_variable *in)
{
struct ir3_shader_variant *so = ctx->so;
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;
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);
/* let's pretend things other than vec4 don't exist: */
ncomp = MAX2(ncomp, 4);
setup_output(struct ir3_context *ctx, nir_variable *out)
{
struct ir3_shader_variant *so = ctx->so;
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;
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);
/* let's pretend things other than vec4 don't exist: */
ncomp = MAX2(ncomp, 4);
compile_assert(ctx, ncomp == 4);
* Rob Clark <robclark@freedesktop.org>
*/
* Rob Clark <robclark@freedesktop.org>
*/
-#include "freedreno_util.h"
#include "ir3.h"
#include "ir3_shader.h"
#include "ir3.h"
#include "ir3_shader.h"
* Rob Clark <robclark@freedesktop.org>
*/
* Rob Clark <robclark@freedesktop.org>
*/
-#include "freedreno_util.h"
-
* Rob Clark <robclark@freedesktop.org>
*/
* Rob Clark <robclark@freedesktop.org>
*/
+#include "util/ralloc.h"
-#include "freedreno_util.h"
-
#include "util/ralloc.h"
#include "util/bitset.h"
#include "util/ralloc.h"
#include "util/bitset.h"
-#include "freedreno_util.h"
-
#include "ir3.h"
#include "ir3_compiler.h"
#include "ir3.h"
#include "ir3_compiler.h"
#ifndef IR3_SHADER_H_
#define IR3_SHADER_H_
#ifndef IR3_SHADER_H_
#define IR3_SHADER_H_
#include "pipe/p_state.h"
#include "compiler/shader_enums.h"
#include "util/bitscan.h"
#include "ir3.h"
#include "pipe/p_state.h"
#include "compiler/shader_enums.h"
#include "util/bitscan.h"
#include "ir3.h"
-#include "pipe/p_shader_tokens.h"
-
static inline int
ir3_find_output(const struct ir3_shader_variant *so, gl_varying_slot slot)
{
static inline int
ir3_find_output(const struct ir3_shader_variant *so, gl_varying_slot slot)
{