summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <idr@us.ibm.com>2008-01-29 10:56:53 -0800
committerBen Skeggs <skeggsb@gmail.com>2008-02-15 13:50:26 +1100
commit5028f0fcaca0d3a521f7ec130f4bbea2600bce16 (patch)
treecaa740c187f7c4466406ff877c35f0dece8d86d1
parent98eecdb4868c181476cbe2423adaa327eee4a02e (diff)
Initial pass at instruction / declaration fetch
-rw-r--r--src/mesa/pipe/cell/spu/spu_exec.c22
-rw-r--r--src/mesa/pipe/cell/spu/spu_main.h1
2 files changed, 23 insertions, 0 deletions
diff --git a/src/mesa/pipe/cell/spu/spu_exec.c b/src/mesa/pipe/cell/spu/spu_exec.c
index 6888e97caf6..f43278198e1 100644
--- a/src/mesa/pipe/cell/spu/spu_exec.c
+++ b/src/mesa/pipe/cell/spu/spu_exec.c
@@ -50,6 +50,9 @@
* Brian Paul
*/
+#include <libmisc.h>
+#include <spu_mfcio.h>
+
#include "pipe/p_compiler.h"
#include "pipe/p_state.h"
#include "pipe/p_util.h"
@@ -57,6 +60,7 @@
#include "pipe/tgsi/util/tgsi_parse.h"
#include "pipe/tgsi/util/tgsi_util.h"
#include "spu_exec.h"
+#include "spu_main.h"
#define TILE_TOP_LEFT 0
#define TILE_TOP_RIGHT 1
@@ -2329,12 +2333,30 @@ spu_exec_machine_run( struct spu_exec_machine *mach )
/* execute declarations (interpolants) */
for (i = 0; i < mach->NumDeclarations; i++) {
+ uint8_t buffer[sizeof(struct tgsi_full_declaration) + 32] ALIGN16_ATTRIB;
+ struct tgsi_full_declaration decl;
+ unsigned long decl_addr = (unsigned long) (mach->Declarations+i);
+ unsigned size = ((sizeof(decl) + (decl_addr & 0x0f) + 0x0f) & ~0x0f);
+
+ mfc_get(buffer, decl_addr & ~0x0f, size, TAG_INSTRUCTION_FETCH, 0, 0);
+ wait_on_mask(1 << TAG_INSTRUCTION_FETCH);
+
+ memcpy(& decl, buffer + (decl_addr & 0x0f), sizeof(decl));
exec_declaration( mach, mach->Declarations+i );
}
/* execute instructions, until pc is set to -1 */
while (pc != -1) {
+ uint8_t buffer[sizeof(struct tgsi_full_instruction) + 32] ALIGN16_ATTRIB;
+ struct tgsi_full_instruction inst;
+ unsigned long inst_addr = (unsigned long) (mach->Instructions + pc);
+ unsigned size = ((sizeof(inst) + (inst_addr & 0x0f) + 0x0f) & ~0x0f);
+
assert(pc < mach->NumInstructions);
+ mfc_get(buffer, inst_addr & ~0x0f, size, TAG_INSTRUCTION_FETCH, 0, 0);
+ wait_on_mask(1 << TAG_INSTRUCTION_FETCH);
+
+ memcpy(& inst, buffer + (inst_addr & 0x0f), sizeof(inst));
exec_instruction( mach, mach->Instructions + pc, &pc );
}
diff --git a/src/mesa/pipe/cell/spu/spu_main.h b/src/mesa/pipe/cell/spu/spu_main.h
index 73f9ed29d66..8be5268f52d 100644
--- a/src/mesa/pipe/cell/spu/spu_main.h
+++ b/src/mesa/pipe/cell/spu/spu_main.h
@@ -96,6 +96,7 @@ extern boolean Debug;
#define TAG_BATCH_BUFFER 17
#define TAG_MISC 18
#define TAG_TEXTURE_TILE 19
+#define TAG_INSTRUCTION_FETCH 20