i915g: Add support for shader-db.

I wanted to make sure that NIR-to-TGSI wouldn't regress this driver's code
generation, so make it possible to use standard shader-db on it.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11912>
This commit is contained in:
Emma Anholt 2020-08-11 16:33:57 -07:00
parent b8e29e8936
commit 6f5f79e042
3 changed files with 22 additions and 0 deletions

View file

@ -166,6 +166,18 @@ i915_destroy(struct pipe_context *pipe)
FREE(i915);
}
static void
i915_set_debug_callback(struct pipe_context *pipe,
const struct pipe_debug_callback *cb)
{
struct i915_context *i915 = i915_context(pipe);
if (cb)
i915->debug = *cb;
else
memset(&i915->debug, 0, sizeof(i915->debug));
}
struct pipe_context *
i915_create_context(struct pipe_screen *screen, void *priv, unsigned flags)
{
@ -180,6 +192,7 @@ i915_create_context(struct pipe_screen *screen, void *priv, unsigned flags)
i915->base.priv = priv;
i915->base.stream_uploader = u_upload_create_default(&i915->base);
i915->base.const_uploader = i915->base.stream_uploader;
i915->base.set_debug_callback = i915_set_debug_callback;
i915->base.destroy = i915_destroy;

View file

@ -303,6 +303,8 @@ struct i915_context {
/** blitter/hw-clear */
struct blitter_context *blitter;
struct pipe_debug_callback debug;
};
/* A flag for each frontend state object:

View file

@ -35,6 +35,7 @@
#include "pipe/p_shader_tokens.h"
#include "tgsi/tgsi_dump.h"
#include "tgsi/tgsi_from_mesa.h"
#include "tgsi/tgsi_info.h"
#include "tgsi/tgsi_parse.h"
#include "util/log.h"
@ -1030,6 +1031,12 @@ i915_fini_compile(struct i915_context *i915, struct i915_fp_compile *p)
memcpy(ifs->program, p->declarations, decl_size * sizeof(uint32_t));
memcpy(&ifs->program[decl_size], p->program,
program_size * sizeof(uint32_t));
pipe_debug_message(
&i915->debug, SHADER_INFO,
"%s shader: %d inst, %d tex, %d tex_indirect, %d const",
_mesa_shader_stage_to_abbrev(MESA_SHADER_FRAGMENT), (int)program_size,
p->nr_tex_insn, p->nr_tex_indirect, ifs->num_constants);
}
/* Release the compilation struct: