summaryrefslogtreecommitdiffstats
path: root/src/intel
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2016-08-23 16:35:59 -0700
committerKenneth Graunke <[email protected]>2016-08-23 21:19:58 -0700
commite7530bfcd6acdc8f8984820445c4b41602952298 (patch)
treee0c13f03283ff854863cffe75ff27cb16b274a38 /src/intel
parent56ba9656bb38ce0d1448545a6d9d3ebcc39f18bf (diff)
aubinator: Style fixes.
Signed-off-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/intel')
-rw-r--r--src/intel/tools/aubinator.c62
-rw-r--r--src/intel/tools/decoder.c10
-rw-r--r--src/intel/tools/disasm.c5
-rw-r--r--src/intel/tools/gen_disasm.h2
4 files changed, 45 insertions, 34 deletions
diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c
index 11e1b9dc72f..811f7077a15 100644
--- a/src/intel/tools/aubinator.c
+++ b/src/intel/tools/aubinator.c
@@ -88,7 +88,8 @@ valid_offset(uint32_t offset)
}
static void
-print_dword_val(struct gen_field_iterator *iter, uint64_t offset, int *dword_num)
+print_dword_val(struct gen_field_iterator *iter, uint64_t offset,
+ int *dword_num)
{
struct gen_field *f;
union {
@@ -100,16 +101,17 @@ print_dword_val(struct gen_field_iterator *iter, uint64_t offset, int *dword_num
v.dw = iter->p[f->start / 32];
if (*dword_num != (f->start / 32)) {
- printf("0x%08lx: 0x%08x : Dword %d\n",(offset + 4 * (f->start / 32)), v.dw, f->start / 32);
+ printf("0x%08lx: 0x%08x : Dword %d\n",
+ offset + 4 * (f->start / 32), v.dw, f->start / 32);
*dword_num = (f->start / 32);
}
}
-static char*
+static char *
print_iterator_values(struct gen_field_iterator *iter, int *idx)
{
char *token = NULL;
- if (strstr(iter->value,"struct") == NULL) {
+ if (strstr(iter->value, "struct") == NULL) {
printf(" %s: %s\n", iter->name, iter->value);
} else {
token = strtok(iter->value, " ");
@@ -125,7 +127,8 @@ print_iterator_values(struct gen_field_iterator *iter, int *idx)
}
static void
-decode_structure(struct gen_spec *spec, struct gen_group *strct, const uint32_t *p)
+decode_structure(struct gen_spec *spec, struct gen_group *strct,
+ const uint32_t *p)
{
struct gen_field_iterator iter;
char *token = NULL;
@@ -153,10 +156,10 @@ decode_structure(struct gen_spec *spec, struct gen_group *strct, const uint32_t
static void
handle_struct_decode(struct gen_spec *spec, char *struct_name, uint32_t *p)
{
- if (struct_name == NULL)
- return;
- struct gen_group *struct_val = gen_spec_find_struct(spec, struct_name);
- decode_structure(spec, struct_val, p);
+ if (struct_name == NULL)
+ return;
+ struct gen_group *struct_val = gen_spec_find_struct(spec, struct_name);
+ decode_structure(spec, struct_val, p);
}
static void
@@ -567,7 +570,8 @@ handle_3dstate_viewport_state_pointers_cc(struct gen_spec *spec, uint32_t *p)
}
static void
-handle_3dstate_viewport_state_pointers_sf_clip(struct gen_spec *spec, uint32_t *p)
+handle_3dstate_viewport_state_pointers_sf_clip(struct gen_spec *spec,
+ uint32_t *p)
{
uint64_t start;
struct gen_group *sf_clip_viewport;
@@ -731,7 +735,7 @@ parse_commands(struct gen_spec *spec, uint32_t *cmds, int size, int engine)
if (option_full_decode) {
struct gen_field_iterator iter;
- char* token = NULL;
+ char *token = NULL;
int idx = 0, dword_num = 0;
gen_field_iterator_init(&iter, inst, p);
while (gen_field_iterator_next(&iter)) {
@@ -740,7 +744,8 @@ parse_commands(struct gen_spec *spec, uint32_t *cmds, int size, int engine)
if (dword_num > 0)
token = print_iterator_values(&iter, &idx);
if (token != NULL) {
- printf("0x%08lx: 0x%08x : Dword %d\n",(offset+4*idx), p[idx], idx);
+ printf("0x%08lx: 0x%08x : Dword %d\n",
+ offset + 4 * idx, p[idx], idx);
handle_struct_decode(spec,token, &p[idx]);
token = NULL;
}
@@ -868,7 +873,7 @@ aub_file_open(const char *filename)
#define SUBOPCODE_BLOCK 0x41
#define SUBOPCODE_BMP 0x1e
-/* Newer version AUB opcode*/
+/* Newer version AUB opcode */
#define OPCODE_NEW_AUB 0x2e
#define SUBOPCODE_VERSION 0x00
#define SUBOPCODE_REG_WRITE 0x03
@@ -1085,48 +1090,49 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
}
- if (strstr(gen_val,"ivb") != NULL) {
+ if (strstr(gen_val, "ivb") != NULL) {
/* Intel(R) Ivybridge Mobile GT2 */
pci_id = 0x0166;
gen_major = 7;
gen_minor = 0;
- } else if (strstr(gen_val,"hsw") != NULL) {
- /* Intel(R) Haswell Mobile GT2 */
+ } else if (strstr(gen_val, "hsw") != NULL) {
+ /* Intel(R) Haswell Mobile GT2 */
pci_id = 0x0416;
gen_major = 7;
gen_minor = 5;
- } else if (strstr(gen_val,"byt") != NULL) {
- /* Intel(R) Bay Trail */
+ } else if (strstr(gen_val, "byt") != NULL) {
+ /* Intel(R) Bay Trail */
pci_id = 0x0155;
gen_major = 7;
gen_minor = 5;
- } else if (strstr(gen_val,"bdw") != NULL) {
+ } else if (strstr(gen_val, "bdw") != NULL) {
/* Intel(R) HD Graphics 5500 (Broadwell GT2) */
pci_id = 0x1616;
gen_major = 8;
gen_minor = 0;
- } else if (strstr(gen_val,"chv") != NULL) {
+ } else if (strstr(gen_val, "chv") != NULL) {
/* Intel(R) HD Graphics (Cherryview) */
pci_id = 0x22B3;
gen_major = 8;
gen_minor = 0;
- } else if (strstr(gen_val,"skl") != NULL) {
+ } else if (strstr(gen_val, "skl") != NULL) {
/* Intel(R) HD Graphics 530 (Skylake GT2) */
pci_id = 0x1912;
gen_major = 9;
gen_minor = 0;
- } else if (strstr(gen_val,"kbl") != NULL) {
+ } else if (strstr(gen_val, "kbl") != NULL) {
/* Intel(R) Kabylake GT2 */
pci_id = 0x591D;
gen_major = 9;
gen_minor = 0;
- } else if (strstr(gen_val,"bxt") != NULL) {
+ } else if (strstr(gen_val, "bxt") != NULL) {
/* Intel(R) HD Graphics (Broxton) */
pci_id = 0x0A84;
gen_major = 9;
gen_minor = 0;
} else {
- error(EXIT_FAILURE, 0, "can't parse gen: %s, expected ivb, byt, hsw, bdw, chv, skl, kbl or bxt\n", gen_val);
+ error(EXIT_FAILURE, 0, "can't parse gen: %s, expected ivb, byt, hsw, "
+ "bdw, chv, skl, kbl or bxt\n", gen_val);
}
/* Do this before we redirect stdout to pager. */
@@ -1136,10 +1142,12 @@ int main(int argc, char *argv[])
if (isatty(1) && pager)
setup_pager();
- if (gen_minor > 0)
- snprintf(gen_file, sizeof(gen_file), "../genxml/gen%d%d.xml", gen_major, gen_minor);
- else
+ if (gen_minor > 0) {
+ snprintf(gen_file, sizeof(gen_file), "../genxml/gen%d%d.xml",
+ gen_major, gen_minor);
+ } else {
snprintf(gen_file, sizeof(gen_file), "../genxml/gen%d.xml", gen_major);
+ }
spec = gen_spec_load(gen_file);
disasm = gen_disasm_create(pci_id);
diff --git a/src/intel/tools/decoder.c b/src/intel/tools/decoder.c
index f57be979038..f080437d894 100644
--- a/src/intel/tools/decoder.c
+++ b/src/intel/tools/decoder.c
@@ -153,7 +153,8 @@ create_group(struct parser_context *ctx, const char *name, const char **atts)
}
static void
-get_group_offset_count(struct parser_context *ctx, const char *name, const char **atts, uint32_t *offset, uint32_t *count)
+get_group_offset_count(struct parser_context *ctx, const char *name,
+ const char **atts, uint32_t *offset, uint32_t *count)
{
char *p;
int i;
@@ -240,7 +241,7 @@ create_field(struct parser_context *ctx, const char **atts)
field->start = ctx->group->group_offset+strtoul(atts[i + 1], &p, 0);
else if (strcmp(atts[i], "end") == 0) {
field->end = ctx->group->group_offset+strtoul(atts[i + 1], &p, 0);
- if(ctx->group->group_offset)
+ if (ctx->group->group_offset)
ctx->group->group_offset = field->end+1;
} else if (strcmp(atts[i], "type") == 0)
field->type = string_to_type(ctx, atts[i + 1]);
@@ -291,11 +292,12 @@ start_element(void *data, const char *element_name, const char **atts)
strcmp(element_name, "register") == 0) {
ctx->group = create_group(ctx, name, atts);
} else if (strcmp(element_name, "group") == 0) {
- get_group_offset_count(ctx, name, atts,&ctx->group->group_offset,&ctx->group->group_count);
+ get_group_offset_count(ctx, name, atts, &ctx->group->group_offset,
+ &ctx->group->group_count);
} else if (strcmp(element_name, "field") == 0) {
do {
ctx->fields[ctx->nfields++] = create_field(ctx, atts);
- if(ctx->group->group_count)
+ if (ctx->group->group_count)
ctx->group->group_count--;
} while (ctx->group->group_count > 0);
} else if (strcmp(element_name, "enum") == 0) {
diff --git a/src/intel/tools/disasm.c b/src/intel/tools/disasm.c
index cbee2fc2859..a1cb19197cf 100644
--- a/src/intel/tools/disasm.c
+++ b/src/intel/tools/disasm.c
@@ -36,7 +36,8 @@ struct gen_disasm {
};
void
-gen_disasm_disassemble(struct gen_disasm *disasm, void *assembly, int start, int end, FILE *out)
+gen_disasm_disassemble(struct gen_disasm *disasm, void *assembly, int start,
+ int end, FILE *out)
{
struct brw_device_info *devinfo = &disasm->devinfo;
bool dump_hex = false;
@@ -74,7 +75,7 @@ gen_disasm_disassemble(struct gen_disasm *disasm, void *assembly, int start, int
/* Simplistic, but efficient way to terminate disasm */
if (brw_inst_opcode(devinfo, insn) == BRW_OPCODE_SEND ||
- brw_inst_opcode(devinfo, insn) == BRW_OPCODE_SENDC)
+ brw_inst_opcode(devinfo, insn) == BRW_OPCODE_SENDC)
if (brw_inst_eot(devinfo, insn))
break;
if (brw_inst_opcode(devinfo, insn) == 0)
diff --git a/src/intel/tools/gen_disasm.h b/src/intel/tools/gen_disasm.h
index 2820a9ff2ed..af6654f3c33 100644
--- a/src/intel/tools/gen_disasm.h
+++ b/src/intel/tools/gen_disasm.h
@@ -28,7 +28,7 @@ struct gen_disasm;
struct gen_disasm *gen_disasm_create(int pciid);
void gen_disasm_disassemble(struct gen_disasm *disasm,
- void *assembly, int start, int end, FILE *out);
+ void *assembly, int start, int end, FILE *out);
void gen_disasm_destroy(struct gen_disasm *disasm);