panfrost/midgard/disasm: Correctly dump bias/LOD

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
This commit is contained in:
Alyssa Rosenzweig 2019-06-10 12:12:49 -07:00
parent 873a3ed342
commit 445a7b523f
2 changed files with 20 additions and 16 deletions

View file

@ -1058,6 +1058,12 @@ print_texture_op(unsigned op)
}
}
static bool
texture_op_takes_bias(unsigned op)
{
return op == TEXTURE_OP_NORMAL;
}
#undef DEFINE_CASE
static void
@ -1071,8 +1077,7 @@ print_texture_word(uint32_t *word, unsigned tabs)
/* Specific format in question */
print_texture_format(texture->format);
/* Instruction "modifiers" parallel the ALU instructions. First group
* are modifiers that act alone */
/* Instruction "modifiers" parallel the ALU instructions. */
if (!texture->filter)
printf(".raw");
@ -1086,11 +1091,6 @@ print_texture_word(uint32_t *word, unsigned tabs)
if (texture->last)
printf(".last");
/* Second set are modifiers which take an extra argument each */
if (texture->bias)
printf(".bias");
printf(" ");
print_texture_reg(texture->out_full, texture->out_reg_select, texture->out_upper);
@ -1139,9 +1139,16 @@ print_texture_word(uint32_t *word, unsigned tabs)
if (texture->lod_register) {
/* TODO: Decode */
printf("lod/bias/grad reg 0x%X, ", texture->bias);
} else if (texture->bias) {
printf("%f /* %d */, ", texture->bias / 256.0f, texture->bias);
printf("lod/bias/grad reg 0x%X (%X), ", texture->bias, texture->bias_int);
} else if (texture->bias || texture->bias_int) {
int bias_int = texture->bias_int;
float bias_frac = texture->bias / 256.0f;
float bias = bias_int + bias_frac;
bool is_bias = texture_op_takes_bias(texture->op);
char operand = is_bias ? '+' : '=';
printf("lod %c %f, ", operand, bias);
}
printf("\n");
@ -1154,15 +1161,13 @@ print_texture_word(uint32_t *word, unsigned tabs)
texture->unknown4 ||
texture->unknownA ||
texture->unknownB ||
texture->unknown8 ||
texture->unknown9) {
texture->unknown8) {
printf("// unknown2 = 0x%x\n", texture->unknown2);
printf("// unknown3 = 0x%x\n", texture->unknown3);
printf("// unknown4 = 0x%x\n", texture->unknown4);
printf("// unknownA = 0x%x\n", texture->unknownA);
printf("// unknownB = 0x%x\n", texture->unknownB);
printf("// unknown8 = 0x%x\n", texture->unknown8);
printf("// unknown9 = 0x%x\n", texture->unknown9);
}
if (texture->offset_unknown4 ||

View file

@ -577,9 +577,8 @@ __attribute__((__packed__))
* fragment/vertex shader respectively. Compute as int(2^8 * biasf).
*
* For texel fetch, this is the LOD as is. */
unsigned bias : 8;
unsigned unknown9 : 8;
unsigned bias : 8;
unsigned bias_int : 8;
unsigned texture_handle : 16;
unsigned sampler_handle : 16;