[Freedreno] Freedreno on i.MX53
Martin Fuzzey
mfuzzey at parkeon.com
Tue Aug 4 06:45:05 PDT 2015
On 31/07/15 15:05, Rob Clark wrote:
> but I seem to recall a few differences between a20x and a22x, so it
> wouldn't surprise me if we need a few if (a20x) / else if (a22x) in
> the code. Since I never had any a20x hw, I was unsure which
> differences actually matter. The CP_DRAW_INDX diff could be as much
> about pm4/pfp fw version as hw version, but I guess since lack of data
> points it is reasonable to assume it is a20x vs a22x.. the register
> differences otoh are certainly a20x vs a22x.
Hum I'm using the firmware hardcoded in the kernel driver - not sure
what it is...
> I'd try putting a WFI after the gmem2mem, and then a scratch register
> write after the WFI. Could be it is hanging up on return to the
> previous IB level (or on return to ringbuffer?)
It was hanging on the final gmem2mem DRAW_INDX
It turned out to be the vertex shader for the triangle draw (I was
focalized on the registers and missed the shader difference)
The shader generated by Freedreno is:
vertex shader, start=0000, size=000c
EXEC ADDR(0x2) CNT(0x1)
(S)FETCH: VERTEX R1.xyz1 = R0.x
FMT_32_32_32_FLOAT UNSIGNED STRIDE(12) CONST(20, 0)
ALLOC POSITION SIZE(0x0)
EXEC_END ADDR(0x3) CNT(0x1)
(S)ALU: MAXv export62 = R1, R1 ; gl_Position
NOP
8d300464: c00d2b00 00000000 0000000c 00031002 00001000
c2000000 00021003 00002000
8d300484: 00000000 19481000 00392a88 0000000c 140f803e
00000000 e2010100
Whereas the Blob generated one (and the hardcoded one used by freedreno
for clear and gmem2mem) is
vertex shader, start=0000, size=000f
EXEC ADDR(0x3) CNT(0x1)
(S)FETCH: VERTEX R1.xyz1 = R0.x
FMT_32_32_32_FLOAT SIGNED STRIDE(12) CONST(20, 0)
ALLOC POSITION SIZE(0x0)
EXEC ADDR(0x4) CNT(0x1)
ALU: MAXv export62 = R1, R1 ; gl_Position
ALLOC PARAM/PIXEL SIZE(0x0)
EXEC_END ADDR(0x5) CNT(0x0)
NOP
8d470274: c0102b00 00000000 0000000f 00031003 00001000
c2000000 00001004 00001000
8d470294: c4000000 00000005 00002000 00000000 19481000
00393a88 0000000c 140f803e
8d4702b4: 00000000 e2010100
IE Freedreno is missing the ALLOC PARAM/PIXEL SIZE(0x0).
Not sure why that made it hang on the next draw...
This hack "fixes" it:
--- a/src/gallium/drivers/freedreno/a2xx/fd2_compiler.c
+++ b/src/gallium/drivers/freedreno/a2xx/fd2_compiler.c
@@ -983,8 +983,15 @@ translate_instruction(struct fd2_compile_context *ctx,
struct ir2_instruction *instr;
static struct ir2_cf *cf;
- if (opc == TGSI_OPCODE_END)
+ if (opc == TGSI_OPCODE_END) {
+ // MF
+ if (ctx->type == TGSI_PROCESSOR_VERTEX) {
+ ctx->cf = NULL;
+ ir2_cf_create_alloc(ctx->so->ir,
SQ_PARAMETER_PIXEL, 0);
+ next_exec_cf(ctx);
+ }
return;
+ }
if (inst->Dst[0].Register.File == TGSI_FILE_OUTPUT) {
unsigned num = inst->Dst[0].Register.Index;
The renders page on the wiki however does have ALLOC PARAM but I think
they were generated with hand coded assembler?
Not sure what the right fix for this is at the moment.
I also noticed a couple of differences in the way the shader constants
are setup:
FD:
set shader const 0078
8d3003b8: c0022d00 00010078 8d000003 00100000
BLOB:
set shader const 0078
8d470254: c0062d00 00010078 8d480003 00000024 b6f426d0
b6167200 00010000 00000024
Ie the blob is passing only the size of the part of the vertex buffer in
use rather than the whole buffer and includes some extra parameters.
This doesn't seem important however, the Freedreno way works..
Regards,
Martin
More information about the Freedreno
mailing list