freedreno/ir2: Re-indent

clang-format -fallback-style=none --style=file -i src/freedreno/ir2/*.[ch]

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10293>
This commit is contained in:
Rob Clark 2021-04-16 11:34:25 -07:00 committed by Marge Bot
parent 2dbf09c2b4
commit d26a224ca9
2 changed files with 800 additions and 780 deletions

View File

@ -21,14 +21,14 @@
* SOFTWARE.
*/
#include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "disasm.h"
#include "instr-a2xx.h"
@ -58,13 +58,20 @@ static enum debug_t debug;
*/
static const char chan_names[] = {
'x', 'y', 'z', 'w',
'x',
'y',
'z',
'w',
/* these only apply to FETCH dst's: */
'0', '1', '?', '_',
'0',
'1',
'?',
'_',
};
static void print_srcreg(uint32_t num, uint32_t type,
uint32_t swiz, uint32_t negate, uint32_t abs)
static void
print_srcreg(uint32_t num, uint32_t type, uint32_t swiz, uint32_t negate,
uint32_t abs)
{
if (negate)
printf("-");
@ -83,7 +90,8 @@ static void print_srcreg(uint32_t num, uint32_t type,
printf("|");
}
static void print_dstreg(uint32_t num, uint32_t mask, uint32_t dst_exp)
static void
print_dstreg(uint32_t num, uint32_t mask, uint32_t dst_exp)
{
printf("%s%u", dst_exp ? "export" : "R", num);
if (mask != 0xf) {
@ -96,19 +104,26 @@ static void print_dstreg(uint32_t num, uint32_t mask, uint32_t dst_exp)
}
}
static void print_export_comment(uint32_t num, gl_shader_stage type)
static void
print_export_comment(uint32_t num, gl_shader_stage type)
{
const char *name = NULL;
switch (type) {
case MESA_SHADER_VERTEX:
switch (num) {
case 62: name = "gl_Position"; break;
case 63: name = "gl_PointSize"; break;
case 62:
name = "gl_Position";
break;
case 63:
name = "gl_PointSize";
break;
}
break;
case MESA_SHADER_FRAGMENT:
switch (num) {
case 0: name = "gl_FragColor"; break;
case 0:
name = "gl_FragColor";
break;
}
break;
default:
@ -126,7 +141,7 @@ struct {
uint32_t num_srcs;
const char *name;
} vector_instructions[0x20] = {
#define INSTR(opc, num_srcs) [opc] = { num_srcs, #opc }
#define INSTR(opc, num_srcs) [opc] = {num_srcs, #opc}
INSTR(ADDv, 2),
INSTR(MULv, 2),
INSTR(MAXv, 2),
@ -211,15 +226,16 @@ struct {
#undef INSTR
};
static int disasm_alu(uint32_t *dwords, uint32_t alu_off,
int level, int sync, gl_shader_stage type)
static int
disasm_alu(uint32_t *dwords, uint32_t alu_off, int level, int sync,
gl_shader_stage type)
{
instr_alu_t *alu = (instr_alu_t *)dwords;
printf("%s", levels[level]);
if (debug & PRINT_RAW) {
printf("%02x: %08x %08x %08x\t", alu_off,
dwords[0], dwords[1], dwords[2]);
printf("%02x: %08x %08x %08x\t", alu_off, dwords[0], dwords[1],
dwords[2]);
}
printf(" %sALU:\t", sync ? "(S)" : " ");
@ -286,7 +302,6 @@ static int disasm_alu(uint32_t *dwords, uint32_t alu_off,
return 0;
}
/*
* FETCH instructions:
*/
@ -294,7 +309,7 @@ static int disasm_alu(uint32_t *dwords, uint32_t alu_off,
struct {
const char *name;
} fetch_types[0xff] = {
#define TYPE(id) [id] = { #id }
#define TYPE(id) [id] = {#id}
TYPE(FMT_1_REVERSE),
TYPE(FMT_32_FLOAT),
TYPE(FMT_32_32_FLOAT),
@ -312,7 +327,8 @@ struct {
#undef TYPE
};
static void print_fetch_dst(uint32_t dst_reg, uint32_t dst_swiz)
static void
print_fetch_dst(uint32_t dst_reg, uint32_t dst_swiz)
{
int i;
printf("\tR%u.", dst_reg);
@ -322,7 +338,8 @@ static void print_fetch_dst(uint32_t dst_reg, uint32_t dst_swiz)
}
}
static void print_fetch_vtx(instr_fetch_t *fetch)
static void
print_fetch_vtx(instr_fetch_t *fetch)
{
instr_fetch_vtx_t *vtx = &fetch->vtx;
@ -358,7 +375,8 @@ static void print_fetch_vtx(instr_fetch_t *fetch)
}
}
static void print_fetch_tex(instr_fetch_t *fetch)
static void
print_fetch_tex(instr_fetch_t *fetch)
{
static const char *filter[] = {
[TEX_FILTER_POINT] = "POINT",
@ -439,7 +457,7 @@ struct {
const char *name;
void (*fxn)(instr_fetch_t *cf);
} fetch_instructions[] = {
#define INSTR(opc, name, fxn) [opc] = { name, fxn }
#define INSTR(opc, name, fxn) [opc] = {name, fxn}
INSTR(VTX_FETCH, "VERTEX", print_fetch_vtx),
INSTR(TEX_FETCH, "SAMPLE", print_fetch_tex),
INSTR(TEX_GET_BORDER_COLOR_FRAC, "?", print_fetch_tex),
@ -453,14 +471,15 @@ struct {
#undef INSTR
};
static int disasm_fetch(uint32_t *dwords, uint32_t alu_off, int level, int sync)
static int
disasm_fetch(uint32_t *dwords, uint32_t alu_off, int level, int sync)
{
instr_fetch_t *fetch = (instr_fetch_t *)dwords;
printf("%s", levels[level]);
if (debug & PRINT_RAW) {
printf("%02x: %08x %08x %08x\t", alu_off,
dwords[0], dwords[1], dwords[2]);
printf("%02x: %08x %08x %08x\t", alu_off, dwords[0], dwords[1],
dwords[2]);
}
printf(" %sFETCH:\t", sync ? "(S)" : " ");
@ -475,33 +494,32 @@ static int disasm_fetch(uint32_t *dwords, uint32_t alu_off, int level, int sync)
* CF instructions:
*/
static int cf_exec(instr_cf_t *cf)
static int
cf_exec(instr_cf_t *cf)
{
return (cf->opc == EXEC) ||
(cf->opc == EXEC_END) ||
(cf->opc == COND_EXEC) ||
(cf->opc == COND_EXEC_END) ||
(cf->opc == COND_PRED_EXEC) ||
(cf->opc == COND_PRED_EXEC_END) ||
return (cf->opc == EXEC) || (cf->opc == EXEC_END) ||
(cf->opc == COND_EXEC) || (cf->opc == COND_EXEC_END) ||
(cf->opc == COND_PRED_EXEC) || (cf->opc == COND_PRED_EXEC_END) ||
(cf->opc == COND_EXEC_PRED_CLEAN) ||
(cf->opc == COND_EXEC_PRED_CLEAN_END);
}
static int cf_cond_exec(instr_cf_t *cf)
static int
cf_cond_exec(instr_cf_t *cf)
{
return (cf->opc == COND_EXEC) ||
(cf->opc == COND_EXEC_END) ||
(cf->opc == COND_PRED_EXEC) ||
(cf->opc == COND_PRED_EXEC_END) ||
return (cf->opc == COND_EXEC) || (cf->opc == COND_EXEC_END) ||
(cf->opc == COND_PRED_EXEC) || (cf->opc == COND_PRED_EXEC_END) ||
(cf->opc == COND_EXEC_PRED_CLEAN) ||
(cf->opc == COND_EXEC_PRED_CLEAN_END);
}
static void print_cf_nop(instr_cf_t *cf)
static void
print_cf_nop(instr_cf_t *cf)
{
}
static void print_cf_exec(instr_cf_t *cf)
static void
print_cf_exec(instr_cf_t *cf)
{
printf(" ADDR(0x%x) CNT(0x%x)", cf->exec.address, cf->exec.count);
if (cf->exec.yeild)
@ -516,14 +534,16 @@ static void print_cf_exec(instr_cf_t *cf)
printf(" COND(%d)", cf->exec.condition);
}
static void print_cf_loop(instr_cf_t *cf)
static void
print_cf_loop(instr_cf_t *cf)
{
printf(" ADDR(0x%x) LOOP_ID(%d)", cf->loop.address, cf->loop.loop_id);
if (cf->loop.address_mode == ABSOLUTE_ADDR)
printf(" ABSOLUTE_ADDR");
}
static void print_cf_jmp_call(instr_cf_t *cf)
static void
print_cf_jmp_call(instr_cf_t *cf)
{
printf(" ADDR(0x%x) DIR(%d)", cf->jmp_call.address, cf->jmp_call.direction);
if (cf->jmp_call.force_call)
@ -536,7 +556,8 @@ static void print_cf_jmp_call(instr_cf_t *cf)
printf(" ABSOLUTE_ADDR");
}
static void print_cf_alloc(instr_cf_t *cf)
static void
print_cf_alloc(instr_cf_t *cf)
{
static const char *bufname[] = {
[SQ_NO_ALLOC] = "NO ALLOC",
@ -555,7 +576,7 @@ struct {
const char *name;
void (*fxn)(instr_cf_t *cf);
} cf_instructions[] = {
#define INSTR(opc, fxn) [opc] = { #opc, fxn }
#define INSTR(opc, fxn) [opc] = {#opc, fxn}
INSTR(NOP, print_cf_nop),
INSTR(EXEC, print_cf_exec),
INSTR(EXEC_END, print_cf_exec),
@ -575,14 +596,14 @@ struct {
#undef INSTR
};
static void print_cf(instr_cf_t *cf, int level)
static void
print_cf(instr_cf_t *cf, int level)
{
printf("%s", levels[level]);
if (debug & PRINT_RAW) {
uint16_t words[3];
memcpy(&words, cf, sizeof(words));
printf(" %04x %04x %04x \t",
words[0], words[1], words[2]);
printf(" %04x %04x %04x \t", words[0], words[1], words[2]);
}
printf("%s", cf_instructions[cf->opc].name);
cf_instructions[cf->opc].fxn(cf);
@ -596,12 +617,13 @@ static void print_cf(instr_cf_t *cf, int level)
* 2) ALU and FETCH instructions
*/
int disasm_a2xx(uint32_t *dwords, int sizedwords, int level, gl_shader_stage type)
int
disasm_a2xx(uint32_t *dwords, int sizedwords, int level, gl_shader_stage type)
{
instr_cf_t *cfs = (instr_cf_t *)dwords;
int idx, max_idx;
for (idx = 0; ; idx++) {
for (idx = 0;; idx++) {
instr_cf_t *cf = &cfs[idx];
if (cf_exec(cf)) {
max_idx = 2 * cf->exec.address;
@ -620,9 +642,11 @@ int disasm_a2xx(uint32_t *dwords, int sizedwords, int level, gl_shader_stage typ
for (i = 0; i < cf->exec.count; i++) {
uint32_t alu_off = (cf->exec.address + i);
if (sequence & 0x1) {
disasm_fetch(dwords + alu_off * 3, alu_off, level, sequence & 0x2);
disasm_fetch(dwords + alu_off * 3, alu_off, level,
sequence & 0x2);
} else {
disasm_alu(dwords + alu_off * 3, alu_off, level, sequence & 0x2, type);
disasm_alu(dwords + alu_off * 3, alu_off, level, sequence & 0x2,
type);
}
sequence >>= 2;
}
@ -632,7 +656,8 @@ int disasm_a2xx(uint32_t *dwords, int sizedwords, int level, gl_shader_stage typ
return 0;
}
void disasm_a2xx_set_debug(enum debug_t d)
void
disasm_a2xx_set_debug(enum debug_t d)
{
debug = d;
}

View File

@ -31,7 +31,6 @@
#include "adreno_pm4.xml.h"
#include "a2xx.xml.h"
/*
* ALU instructions:
*/
@ -174,8 +173,6 @@ typedef struct PACKED {
uint8_t src1_sel : 1;
} instr_alu_t;
/*
* CF instructions:
*/
@ -266,8 +263,6 @@ typedef union PACKED {
};
} instr_cf_t;
/*
* FETCH instructions:
*/