Commit 29a7c268 authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig 💜

Fix build with my patches

parent b48e5478
......@@ -129,6 +129,11 @@ static char* load_store_opcode_names[256] = {
static bool is_instruction_int = false;
static void ogt_asm_print_tabs(int tabs)
{
/* TODO STUB FIXME */
}
static void print_alu_opcode(lima_t6xx_alu_op_e op)
{
bool int_op = false;
......@@ -530,6 +535,7 @@ static float float_bitcast(uint32_t integer)
return v.f;
}
#if 0
static void print_fb_op(int op) {
switch(op) {
DEFINE_CASE(FB_JUMP, "jump");
......@@ -558,6 +564,7 @@ static void print_fb_field(uint16_t* words, uint16_t reg_word, unsigned tabs)
printf("\n");
}
#endif
static void print_alu_word(uint32_t* words, unsigned num_quad_words,
unsigned tabs)
......@@ -647,7 +654,7 @@ static void print_alu_word(uint32_t* words, unsigned num_quad_words,
if ((control_word >> 26) & 1)
{
print_fb_field(word_ptr, *beginning_ptr, tabs);
//print_fb_field(word_ptr, *beginning_ptr, tabs);
beginning_ptr += 1;
word_ptr += 1;
num_words += 1;
......@@ -688,12 +695,14 @@ static void print_alu_word(uint32_t* words, unsigned num_quad_words,
}
} else {
if (is_embedded_constant_half) {
#if 0
__fp16* hconsts = (__fp16*) consts;
printf("hconstants %g, %g, %g, %g\n",
(float) (hconsts[0]),
(float) (hconsts[1]),
(float) (hconsts[2]),
(float) (hconsts[3]));
#endif
} else {
uint32_t* fconsts = (uint32_t*) consts;
printf("fconstants %g, %g, %g, %g\n",
......@@ -927,14 +936,11 @@ static void print_texture_word(uint32_t* word, unsigned tabs)
printf("// (!) unknown7 = %d\n", texture->unknown7);
}
bool lima_t6xx_disassemble(void* code, unsigned size, ogt_asm_type_e type,
lima_t6xx_version_e version, unsigned tabs)
void DisassembleMidgard(uint8_t* code, uint32_t size)
{
(void) version;
(void) type;
uint32_t* words = code;
uint32_t* words = (uint32_t *) code;
unsigned num_words = size / 4;
int tabs = 0;
bool prefetch_flag = false;
......@@ -956,7 +962,7 @@ bool lima_t6xx_disassemble(void* code, unsigned size, ogt_asm_type_e type,
print_alu_word(&words[i], num_quad_words, tabs);
if (prefetch_flag)
return true;
return;
/* Reset word static analysis state */
is_embedded_constant_half = false;
......@@ -984,9 +990,9 @@ bool lima_t6xx_disassemble(void* code, unsigned size, ogt_asm_type_e type,
prefetch_flag = true;
if (lima_t6xx_word_type[words[i] & 0xF] != lima_t6xx_word_type_alu)
return true;
return;
}
}
return true;
return;
}
/* Author(s):
* Connor Abbott
* Alyssa Rosenzweig
*
* Copyright (c) 2013 Connor Abbott (connor@abbott.cx)
* Copyright (c) 2018 Alyssa Rosenzweig (alyssa@rosenzweig.io)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
......@@ -244,5 +246,90 @@ __attribute__((__packed__))
uint64_t word2 : 60;
} lima_t6xx_load_store_t;
/* Texture pipeline results are in r28-r29 */
#define REG_TEX_BASE 28
/* Texture opcodes... maybe? */
#define TEXTURE_OP_NORMAL 0x11
#define TEXTURE_OP_TEXEL_FETCH 0x14
/* Texture format types, found in format */
#define TEXTURE_2D 0x02
#define TEXTURE_3D 0x03
typedef struct
__attribute__((__packed__))
{
unsigned type : 4;
unsigned next_type : 4;
unsigned op : 6;
unsigned shadow : 1;
unsigned unknown3 : 1;
/* A little obscure, but last is set for the last texture operation in
* a shader. cont appears to just be last's opposite (?). Yeah, I know,
* kind of funky.. BiOpen thinks it could do with memory hinting, or
* tile locking? */
unsigned cont : 1;
unsigned last : 1;
unsigned format : 5;
unsigned has_offset : 1;
/* Like in Bifrost */
unsigned filter : 1;
unsigned in_reg_select : 1;
unsigned in_reg_upper : 1;
unsigned unknown1 : 1;
unsigned in_reg_full : 1;
unsigned in_reg_swizzle_right : 2;
unsigned in_reg_swizzle_left : 2;
unsigned unknown8 : 4;
unsigned out_full : 1;
/* Always 1 afaict... */
unsigned unknown7 : 2;
unsigned out_reg_select : 1;
unsigned out_upper : 1;
unsigned mask : 4;
unsigned unknown2 : 2;
unsigned swizzle : 8;
unsigned unknown4 : 8;
unsigned unknownA : 4;
unsigned offset_unknown1 : 1;
unsigned offset_reg_select : 1;
unsigned offset_reg_upper : 1;
unsigned offset_unknown4 : 1;
unsigned offset_unknown5 : 1;
unsigned offset_unknown6 : 1;
unsigned offset_unknown7 : 1;
unsigned offset_unknown8 : 1;
unsigned offset_unknown9 : 1;
unsigned unknownB : 3;
/* Texture bias or LOD, depending on whether it is executed in a
* 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 texture_handle : 16;
unsigned sampler_handle : 16;
} lima_t6xx_texture_word_t;
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment