mirror of
				https://github.com/tiagovignatti/intel-gpu-tools.git
				synced 2025-11-04 03:58:27 +00:00 
			
		
		
		
	tools/null_state_gen: Add more debug output
Be more verbose about the state size we generate. Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
This commit is contained in:
		
							parent
							
								
									c283ead78c
								
							
						
					
					
						commit
						b498d81f15
					
				@ -32,8 +32,6 @@
 | 
			
		||||
 | 
			
		||||
#include "intel_batchbuffer.h"
 | 
			
		||||
 | 
			
		||||
#define STATE_ALIGN 64
 | 
			
		||||
 | 
			
		||||
extern int gen6_setup_null_render_state(struct intel_batchbuffer *batch);
 | 
			
		||||
extern int gen7_setup_null_render_state(struct intel_batchbuffer *batch);
 | 
			
		||||
extern int gen8_setup_null_render_state(struct intel_batchbuffer *batch);
 | 
			
		||||
@ -47,36 +45,52 @@ static void print_usage(char *s)
 | 
			
		||||
	       s);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Creates the intel_renderstate_genX.c file for the particular
 | 
			
		||||
 * GEN product
 | 
			
		||||
 */
 | 
			
		||||
static int print_state(int gen, struct intel_batchbuffer *batch)
 | 
			
		||||
{
 | 
			
		||||
	int i;
 | 
			
		||||
	unsigned long cmds;
 | 
			
		||||
 | 
			
		||||
	fprintf(stderr, "Generating for gen%d\n", gen);
 | 
			
		||||
 | 
			
		||||
	printf("#include \"intel_renderstate.h\"\n\n");
 | 
			
		||||
 | 
			
		||||
	/* Relocation offsets.  These are byte offsets in the golden context
 | 
			
		||||
	 * batch buffer where the BB graphics address will be added to
 | 
			
		||||
	 * the indirect state offset already stored in those locations.  The
 | 
			
		||||
	 * resulting value will inform the GPU where the indirect states are.
 | 
			
		||||
	 */
 | 
			
		||||
	printf("static const u32 gen%d_null_state_relocs[] = {\n", gen);
 | 
			
		||||
	for (i = 0; i < batch->cmds->num_items; i++) {
 | 
			
		||||
		if (intel_batch_is_reloc(batch, i))
 | 
			
		||||
			printf("\t0x%08x,\n", i * 4);
 | 
			
		||||
	}
 | 
			
		||||
	printf("\t%d,\n", -1);
 | 
			
		||||
	printf("};\n\n");
 | 
			
		||||
	printf("\t-1,\n};\n\n");
 | 
			
		||||
 | 
			
		||||
	/* GPU commands to execute to set up the RCS golden state.  This
 | 
			
		||||
	 * state will become the default config.
 | 
			
		||||
	 */
 | 
			
		||||
	printf("static const u32 gen%d_null_state_batch[] = {\n", gen);
 | 
			
		||||
	for (i = 0; i < intel_batch_num_cmds(batch); i++) {
 | 
			
		||||
		const int offset = i * 4;
 | 
			
		||||
		const struct bb_item *cmd = intel_batch_cmd_get(batch, i);
 | 
			
		||||
		printf("\t0x%08x,", cmd->data);
 | 
			
		||||
 | 
			
		||||
		if (debug)
 | 
			
		||||
			printf("\t /* 0x%08x %s '%s' */", i * 4,
 | 
			
		||||
			       intel_batch_type_as_str(cmd), cmd->str);
 | 
			
		||||
			printf("\t /* 0x%08x %s '%s' */", offset,
 | 
			
		||||
				intel_batch_type_as_str(cmd), cmd->str);
 | 
			
		||||
 | 
			
		||||
		if (i * 4 == batch->cmds_end_offset)
 | 
			
		||||
		if (offset == batch->cmds_end_offset) {
 | 
			
		||||
			cmds = i + 1;
 | 
			
		||||
			printf("\t /* cmds end */");
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (intel_batch_is_reloc(batch, i))
 | 
			
		||||
			printf("\t /* reloc */");
 | 
			
		||||
 | 
			
		||||
		if (i * 4 == batch->state_start_offset)
 | 
			
		||||
		if (offset == batch->state_start_offset)
 | 
			
		||||
			printf("\t /* state start */");
 | 
			
		||||
 | 
			
		||||
		if (i == intel_batch_num_cmds(batch) - 1)
 | 
			
		||||
@ -87,9 +101,15 @@ static int print_state(int gen, struct intel_batchbuffer *batch)
 | 
			
		||||
 | 
			
		||||
	printf("};\n\nRO_RENDERSTATE(%d);\n", gen);
 | 
			
		||||
 | 
			
		||||
	fprintf(stderr, "Commands %lu (%lu bytes)\n", cmds, cmds * 4);
 | 
			
		||||
	fprintf(stderr, "State    %lu (%lu bytes)\n", batch->state->num_items, batch->state->num_items * 4);
 | 
			
		||||
	fprintf(stderr, "Total    %lu (%lu bytes)\n", batch->cmds->num_items, batch->cmds->num_items * 4);
 | 
			
		||||
	fprintf(stderr, "\n");
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Selects generator function for the given product and executes it. */
 | 
			
		||||
static int do_generate(int gen)
 | 
			
		||||
{
 | 
			
		||||
	struct intel_batchbuffer *batch;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user