From: Alyssa Rosenzweig Date: Mon, 10 Jun 2019 19:12:49 +0000 (-0700) Subject: panfrost/midgard/disasm: Correctly dump bias/LOD X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=445a7b523fb6f87ef263274a0e5b2a49299aece1;p=mesa.git panfrost/midgard/disasm: Correctly dump bias/LOD Signed-off-by: Alyssa Rosenzweig --- diff --git a/src/gallium/drivers/panfrost/midgard/disassemble.c b/src/gallium/drivers/panfrost/midgard/disassemble.c index 7543df3fcf5..d1bc6ad0e3a 100644 --- a/src/gallium/drivers/panfrost/midgard/disassemble.c +++ b/src/gallium/drivers/panfrost/midgard/disassemble.c @@ -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 || diff --git a/src/gallium/drivers/panfrost/midgard/midgard.h b/src/gallium/drivers/panfrost/midgard/midgard.h index 354d611e9df..9957ac5e415 100644 --- a/src/gallium/drivers/panfrost/midgard/midgard.h +++ b/src/gallium/drivers/panfrost/midgard/midgard.h @@ -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;