nv50,nvc0: provide debug messages with shader compilation stats

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
This commit is contained in:
Ilia Mirkin
2015-10-30 18:41:09 -04:00
parent 4335b28840
commit 4f6cd5fad0
11 changed files with 28 additions and 9 deletions
@@ -96,6 +96,7 @@ struct nv50_ir_prog_info
uint32_t tlsSpace; /* required local memory per thread */
uint32_t *code;
uint32_t codeSize;
uint32_t instructions;
uint8_t sourceRep; /* NV50_PROGRAM_IR */
const void *source;
void *relocData;
@@ -373,6 +373,7 @@ Program::emitBinary(struct nv50_ir_prog_info *info)
if (!code)
return false;
emit->setCodeLocation(code, binSize);
info->bin.instructions = 0;
for (ArrayList::Iterator fi = allFuncs.iterator(); !fi.end(); fi.next()) {
Function *fn = reinterpret_cast<Function *>(fi.get());
@@ -382,6 +383,7 @@ Program::emitBinary(struct nv50_ir_prog_info *info)
for (int b = 0; b < fn->bbCount; ++b) {
for (Instruction *i = fn->bbArray[b]->getEntry(); i; i = i->next) {
emit->emitInstruction(i);
info->bin.instructions++;
if (i->sType == TYPE_F64 || i->dType == TYPE_F64)
info->io.fp64 = true;
}
@@ -318,7 +318,8 @@ nv50_program_create_strmout_state(const struct nv50_ir_prog_info *info,
}
bool
nv50_program_translate(struct nv50_program *prog, uint16_t chipset)
nv50_program_translate(struct nv50_program *prog, uint16_t chipset,
struct pipe_debug_callback *debug)
{
struct nv50_ir_prog_info *info;
int ret;
@@ -406,6 +407,11 @@ nv50_program_translate(struct nv50_program *prog, uint16_t chipset)
prog->so = nv50_program_create_strmout_state(info,
&prog->pipe.stream_output);
pipe_debug_message(debug, SHADER_INFO,
"type: %d, local: %d, gpr: %d, inst: %d, bytes: %d",
prog->type, info->bin.tlsSpace, prog->max_gpr,
info->bin.instructions, info->bin.codeSize);
out:
FREE(info);
return !ret;
@@ -106,7 +106,8 @@ struct nv50_program {
struct nv50_stream_output_state *so;
};
bool nv50_program_translate(struct nv50_program *, uint16_t chipset);
bool nv50_program_translate(struct nv50_program *, uint16_t chipset,
struct pipe_debug_callback *);
bool nv50_program_upload_code(struct nv50_context *, struct nv50_program *);
void nv50_program_destroy(struct nv50_context *, struct nv50_program *);
@@ -113,7 +113,7 @@ nv50_program_validate(struct nv50_context *nv50, struct nv50_program *prog)
{
if (!prog->translated) {
prog->translated = nv50_program_translate(
prog, nv50->screen->base.device->chipset);
prog, nv50->screen->base.device->chipset, &nv50->base.debug);
if (!prog->translated)
return false;
} else
@@ -727,7 +727,8 @@ nv50_sp_state_create(struct pipe_context *pipe,
prog->pipe.stream_output = cso->stream_output;
prog->translated = nv50_program_translate(
prog, nv50_context(pipe)->screen->base.device->chipset);
prog, nv50_context(pipe)->screen->base.device->chipset,
&nouveau_context(pipe)->debug);
return (void *)prog;
}
@@ -120,7 +120,7 @@ nvc0_compute_validate_program(struct nvc0_context *nvc0)
if (!prog->translated) {
prog->translated = nvc0_program_translate(
prog, nvc0->screen->base.device->chipset);
prog, nvc0->screen->base.device->chipset, &nvc0->base.debug);
if (!prog->translated)
return false;
}
@@ -224,7 +224,8 @@ void nvc0_default_kick_notify(struct nouveau_pushbuf *);
extern struct draw_stage *nvc0_draw_render_stage(struct nvc0_context *);
/* nvc0_program.c */
bool nvc0_program_translate(struct nvc0_program *, uint16_t chipset);
bool nvc0_program_translate(struct nvc0_program *, uint16_t chipset,
struct pipe_debug_callback *);
bool nvc0_program_upload_code(struct nvc0_context *, struct nvc0_program *);
void nvc0_program_destroy(struct nvc0_context *, struct nvc0_program *);
void nvc0_program_library_upload(struct nvc0_context *);
@@ -517,7 +517,8 @@ nvc0_program_dump(struct nvc0_program *prog)
#endif
bool
nvc0_program_translate(struct nvc0_program *prog, uint16_t chipset)
nvc0_program_translate(struct nvc0_program *prog, uint16_t chipset,
struct pipe_debug_callback *debug)
{
struct nv50_ir_prog_info *info;
int ret;
@@ -639,6 +640,11 @@ nvc0_program_translate(struct nvc0_program *prog, uint16_t chipset)
prog->tfb = nvc0_program_create_tfb_state(info,
&prog->pipe.stream_output);
pipe_debug_message(debug, SHADER_INFO,
"type: %d, local: %d, gpr: %d, inst: %d, bytes: %d",
prog->type, info->bin.tlsSpace, prog->num_gprs,
info->bin.instructions, info->bin.codeSize);
out:
FREE(info);
return !ret;
@@ -72,7 +72,7 @@ nvc0_program_validate(struct nvc0_context *nvc0, struct nvc0_program *prog)
if (!prog->translated) {
prog->translated = nvc0_program_translate(
prog, nvc0->screen->base.device->chipset);
prog, nvc0->screen->base.device->chipset, &nvc0->base.debug);
if (!prog->translated)
return false;
}
@@ -681,7 +681,8 @@ nvc0_sp_state_create(struct pipe_context *pipe,
prog->pipe.stream_output = cso->stream_output;
prog->translated = nvc0_program_translate(
prog, nvc0_context(pipe)->screen->base.device->chipset);
prog, nvc0_context(pipe)->screen->base.device->chipset,
&nouveau_context(pipe)->debug);
return (void *)prog;
}