struct exec_list *cf_node_list;
const struct v3d_compiler *compiler;
+ void (*debug_output)(const char *msg,
+ void *debug_output_data);
+ void *debug_output_data;
+
/**
* Mapping from nir_register * or nir_ssa_def * to array of struct
* qreg for the values.
* space needs to be available in the spill BO per thread per QPU.
*/
uint32_t spill_size;
- /* Shader-db stats for register spilling. */
- uint32_t spills, fills;
+ /* Shader-db stats */
+ uint32_t spills, fills, loops;
/**
* Register spilling's per-thread base address, shared between each
* spill/fill's addressing calculations.
struct v3d_vs_key *key,
struct v3d_vs_prog_data *prog_data,
nir_shader *s,
+ void (*debug_output)(const char *msg,
+ void *debug_output_data),
+ void *debug_output_data,
int program_id, int variant_id,
uint32_t *final_assembly_size);
struct v3d_fs_key *key,
struct v3d_fs_prog_data *prog_data,
nir_shader *s,
+ void (*debug_output)(const char *msg,
+ void *debug_output_data),
+ void *debug_output_data,
int program_id, int variant_id,
uint32_t *final_assembly_size);
vir_compile_init(const struct v3d_compiler *compiler,
struct v3d_key *key,
nir_shader *s,
+ void (*debug_output)(const char *msg,
+ void *debug_output_data),
+ void *debug_output_data,
int program_id, int variant_id)
{
struct v3d_compile *c = rzalloc(NULL, struct v3d_compile);
c->program_id = program_id;
c->variant_id = variant_id;
c->threads = 4;
+ c->debug_output = debug_output;
+ c->debug_output_data = debug_output_data;
s = nir_shader_clone(c, s);
c->s = s;
memcpy(qpu_insts, c->qpu_insts, *final_assembly_size);
+ char *shaderdb;
+ int ret = asprintf(&shaderdb,
+ "%s shader: %d inst, %d threads, %d loops, "
+ "%d uniforms, %d:%d spills:fills",
+ vir_get_stage_name(c),
+ c->qpu_inst_count,
+ c->threads,
+ c->loops,
+ c->num_uniforms,
+ c->spills,
+ c->fills);
+ if (ret >= 0) {
+ c->debug_output(shaderdb, c->debug_output_data);
+ free(shaderdb);
+ }
+
vir_compile_destroy(c);
return qpu_insts;
struct v3d_vs_key *key,
struct v3d_vs_prog_data *prog_data,
nir_shader *s,
+ void (*debug_output)(const char *msg,
+ void *debug_output_data),
+ void *debug_output_data,
int program_id, int variant_id,
uint32_t *final_assembly_size)
{
struct v3d_compile *c = vir_compile_init(compiler, &key->base, s,
+ debug_output, debug_output_data,
program_id, variant_id);
c->vs_key = key;
struct v3d_fs_key *key,
struct v3d_fs_prog_data *prog_data,
nir_shader *s,
+ void (*debug_output)(const char *msg,
+ void *debug_output_data),
+ void *debug_output_data,
int program_id, int variant_id,
uint32_t *final_assembly_size)
{
struct v3d_compile *c = vir_compile_init(compiler, &key->base, s,
+ debug_output, debug_output_data,
program_id, variant_id);
c->fs_key = key;
return so;
}
+static void
+v3d_shader_debug_output(const char *message, void *data)
+{
+ struct v3d_context *v3d = data;
+
+ pipe_debug_message(&v3d->debug, SHADER_INFO, "%s", message);
+}
+
static struct v3d_compiled_shader *
v3d_get_compiled_shader(struct v3d_context *v3d, struct v3d_key *key)
{
qpu_insts = v3d_compile_vs(v3d->screen->compiler,
(struct v3d_vs_key *)key,
shader->prog_data.vs, s,
+ v3d_shader_debug_output,
+ v3d,
program_id, variant_id,
&shader_size);
break;
qpu_insts = v3d_compile_fs(v3d->screen->compiler,
(struct v3d_fs_key *)key,
shader->prog_data.fs, s,
+ v3d_shader_debug_output,
+ v3d,
program_id, variant_id,
&shader_size);
break;