summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/a3xx
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2013-06-21 15:05:12 -0400
committerRob Clark <[email protected]>2013-06-21 15:37:05 -0400
commitefdc6caaf50b7b707b965f8f74939e0f00576bdf (patch)
tree501571e86d7a570fffcdac4d6ba426d46ec4ad34 /src/gallium/drivers/freedreno/a3xx
parentd4aaa4439a0ecd665a2967e9d36d88e0aa080d6d (diff)
freedreno/a3xx/compiler: ensure min # of cycles after bary instr
The results of a bary.f do not appear to be immediatley available, but there is no explicit sync bit. Instead the compiler must just ensure that there are a minimum number of instructions following the bary before use of the result of the bary. We aren't clever enough for that so just throw in some nop's. Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/a3xx')
-rw-r--r--src/gallium/drivers/freedreno/a3xx/fd3_compiler.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_compiler.c b/src/gallium/drivers/freedreno/a3xx/fd3_compiler.c
index cf3925a84b2..eabe21cb7e9 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_compiler.c
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_compiler.c
@@ -1072,12 +1072,13 @@ static const struct instr_translater translaters[TGSI_OPCODE_LAST] = {
INSTR(END, instr_cat0, .opc = OPC_END),
};
-static void
+static int
decl_in(struct fd3_compile_context *ctx, struct tgsi_full_declaration *decl)
{
struct fd3_shader_stateobj *so = ctx->so;
unsigned base = ctx->base_reg[TGSI_FILE_INPUT];
unsigned i, flags = 0;
+ int nop = 0;
if (ctx->so->half_precision)
flags |= IR3_REG_HALF;
@@ -1115,8 +1116,12 @@ decl_in(struct fd3_compile_context *ctx, struct tgsi_full_declaration *decl)
/* input base (always r0.x): */
ir3_reg_create(instr, regid(0,0), 0);
+
+ nop = 6;
}
}
+
+ return nop;
}
static void
@@ -1174,6 +1179,7 @@ static void
compile_instructions(struct fd3_compile_context *ctx)
{
struct ir3_shader *ir = ctx->ir;
+ int nop = 0;
while (!tgsi_parse_end_of_tokens(&ctx->parser)) {
tgsi_parse_token(&ctx->parser);
@@ -1185,7 +1191,7 @@ compile_instructions(struct fd3_compile_context *ctx)
if (decl->Declaration.File == TGSI_FILE_OUTPUT) {
decl_out(ctx, decl);
} else if (decl->Declaration.File == TGSI_FILE_INPUT) {
- decl_in(ctx, decl);
+ nop = decl_in(ctx, decl);
} else if (decl->Declaration.File == TGSI_FILE_SAMPLER) {
decl_samp(ctx, decl);
}
@@ -1208,6 +1214,11 @@ compile_instructions(struct fd3_compile_context *ctx)
unsigned opc = inst->Instruction.Opcode;
const struct instr_translater *t = &translaters[opc];
+ if (nop) {
+ ir3_instr_create(ctx->ir, 0, OPC_NOP)->repeat = nop - 1;
+ nop = 0;
+ }
+
if (t->fxn) {
t->fxn(t, ctx, inst);
ctx->num_internal_temps = 0;