i965: Track ARB program state along with GLSL state for shader_time.
This will let us do much better printouts for non-GLSL programs. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
@@ -1123,7 +1123,8 @@ struct brw_context
|
||||
|
||||
struct {
|
||||
drm_intel_bo *bo;
|
||||
struct gl_shader_program **programs;
|
||||
struct gl_shader_program **shader_programs;
|
||||
struct gl_program **programs;
|
||||
enum shader_time_shader_type *types;
|
||||
uint64_t *cumulative;
|
||||
int num_entries;
|
||||
@@ -1187,6 +1188,10 @@ int brw_get_scratch_size(int size);
|
||||
void brw_get_scratch_bo(struct intel_context *intel,
|
||||
drm_intel_bo **scratch_bo, int size);
|
||||
void brw_init_shader_time(struct brw_context *brw);
|
||||
int brw_get_shader_time_index(struct brw_context *brw,
|
||||
struct gl_shader_program *shader_prog,
|
||||
struct gl_program *prog,
|
||||
enum shader_time_shader_type type);
|
||||
void brw_collect_and_report_shader_time(struct brw_context *brw);
|
||||
void brw_destroy_shader_time(struct brw_context *brw);
|
||||
|
||||
|
@@ -605,18 +605,8 @@ void
|
||||
fs_visitor::emit_shader_time_write(enum shader_time_shader_type type,
|
||||
fs_reg value)
|
||||
{
|
||||
/* Choose an index in the buffer and set up tracking information for our
|
||||
* printouts.
|
||||
*/
|
||||
int shader_time_index = brw->shader_time.num_entries++;
|
||||
assert(shader_time_index <= brw->shader_time.max_entries);
|
||||
brw->shader_time.types[shader_time_index] = type;
|
||||
if (prog) {
|
||||
_mesa_reference_shader_program(ctx,
|
||||
&brw->shader_time.programs[shader_time_index],
|
||||
prog);
|
||||
}
|
||||
|
||||
int shader_time_index = brw_get_shader_time_index(brw, prog, &fp->Base,
|
||||
type);
|
||||
int base_mrf = 6;
|
||||
|
||||
fs_reg offset_mrf = fs_reg(MRF, base_mrf);
|
||||
|
@@ -424,7 +424,7 @@ public:
|
||||
void dump_instructions();
|
||||
void dump_instruction(fs_inst *inst);
|
||||
|
||||
const struct gl_fragment_program *fp;
|
||||
struct gl_fragment_program *fp;
|
||||
struct brw_wm_compile *c;
|
||||
unsigned int sanity_param_count;
|
||||
|
||||
|
@@ -230,7 +230,9 @@ brw_init_shader_time(struct brw_context *brw)
|
||||
brw->shader_time.bo = drm_intel_bo_alloc(intel->bufmgr, "shader time",
|
||||
max_entries * SHADER_TIME_STRIDE,
|
||||
4096);
|
||||
brw->shader_time.programs = rzalloc_array(brw, struct gl_shader_program *,
|
||||
brw->shader_time.shader_programs = rzalloc_array(brw, struct gl_shader_program *,
|
||||
max_entries);
|
||||
brw->shader_time.programs = rzalloc_array(brw, struct gl_program *,
|
||||
max_entries);
|
||||
brw->shader_time.types = rzalloc_array(brw, enum shader_time_shader_type,
|
||||
max_entries);
|
||||
@@ -369,8 +371,8 @@ brw_report_shader_time(struct brw_context *brw)
|
||||
continue;
|
||||
|
||||
int shader_num = -1;
|
||||
if (brw->shader_time.programs[i]) {
|
||||
shader_num = brw->shader_time.programs[i]->Name;
|
||||
if (brw->shader_time.shader_programs[i]) {
|
||||
shader_num = brw->shader_time.shader_programs[i]->Name;
|
||||
}
|
||||
|
||||
switch (brw->shader_time.types[i]) {
|
||||
@@ -431,6 +433,36 @@ brw_collect_and_report_shader_time(struct brw_context *brw)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Chooses an index in the shader_time buffer and sets up tracking information
|
||||
* for our printouts.
|
||||
*
|
||||
* Note that this holds on to references to the underlying programs, which may
|
||||
* change their lifetimes compared to normal operation.
|
||||
*/
|
||||
int
|
||||
brw_get_shader_time_index(struct brw_context *brw,
|
||||
struct gl_shader_program *shader_prog,
|
||||
struct gl_program *prog,
|
||||
enum shader_time_shader_type type)
|
||||
{
|
||||
struct gl_context *ctx = &brw->intel.ctx;
|
||||
|
||||
int shader_time_index = brw->shader_time.num_entries++;
|
||||
assert(shader_time_index < brw->shader_time.max_entries);
|
||||
brw->shader_time.types[shader_time_index] = type;
|
||||
|
||||
_mesa_reference_shader_program(ctx,
|
||||
&brw->shader_time.shader_programs[shader_time_index],
|
||||
shader_prog);
|
||||
|
||||
_mesa_reference_program(ctx,
|
||||
&brw->shader_time.programs[shader_time_index],
|
||||
prog);
|
||||
|
||||
return shader_time_index;
|
||||
}
|
||||
|
||||
void
|
||||
brw_destroy_shader_time(struct brw_context *brw)
|
||||
{
|
||||
|
@@ -1225,17 +1225,8 @@ void
|
||||
vec4_visitor::emit_shader_time_write(enum shader_time_shader_type type,
|
||||
src_reg value)
|
||||
{
|
||||
/* Choose an index in the buffer and set up tracking information for our
|
||||
* printouts.
|
||||
*/
|
||||
int shader_time_index = brw->shader_time.num_entries++;
|
||||
assert(shader_time_index <= brw->shader_time.max_entries);
|
||||
brw->shader_time.types[shader_time_index] = type;
|
||||
if (prog) {
|
||||
_mesa_reference_shader_program(ctx,
|
||||
&brw->shader_time.programs[shader_time_index],
|
||||
prog);
|
||||
}
|
||||
int shader_time_index = brw_get_shader_time_index(brw, prog, &vp->Base,
|
||||
type);
|
||||
|
||||
int base_mrf = 6;
|
||||
|
||||
|
@@ -224,7 +224,7 @@ public:
|
||||
return dst_reg(retype(brw_null_reg(), BRW_REGISTER_TYPE_D));
|
||||
}
|
||||
|
||||
const struct gl_vertex_program *vp;
|
||||
struct gl_vertex_program *vp;
|
||||
struct brw_vs_compile *c;
|
||||
struct brw_vs_prog_data *prog_data;
|
||||
unsigned int sanity_param_count;
|
||||
|
Reference in New Issue
Block a user