Software support for the new TMU
authorlekernel <sebastien.bourdeauducq@lekernel.net>
Sat, 13 Feb 2010 20:13:42 +0000 (21:13 +0100)
committerlekernel <sebastien.bourdeauducq@lekernel.net>
Sat, 13 Feb 2010 20:13:42 +0000 (21:13 +0100)
software/bios/Makefile
software/demo/Makefile
software/demo/eval.c
software/demo/renderer.c
software/demo/rpipe.c
software/demo/shell.c
software/include.mak
software/include/hal/tmu.h
software/include/hw/tmu.h
software/libbase/Makefile
software/libhal/tmu.c

index f373e25..04634ce 100644 (file)
@@ -50,5 +50,5 @@ main.o: ../../software/include/hw/vga.h ../../software/include/hw/fmlbrg.h
 main.o: ../../software/include/hw/sysctl.h ../../software/include/hw/gpio.h
 main.o: ../../software/include/hw/uart.h boot.h splash.h
 splash.o: ../../software/include/stdio.h ../../software/include/stdlib.h
 main.o: ../../software/include/hw/sysctl.h ../../software/include/hw/gpio.h
 main.o: ../../software/include/hw/uart.h boot.h splash.h
 splash.o: ../../software/include/stdio.h ../../software/include/stdlib.h
-splash.o: ../../software/include/system.h ../../software/include/hw/vga.h
-splash.o: ../../software/include/hw/common.h splash.h
+splash.o: ../../software/include/hw/vga.h ../../software/include/hw/common.h
+splash.o: splash.h
index ea09071..b1a2654 100644 (file)
@@ -61,8 +61,8 @@ cpustats.o: ../../software/include/irq.h ../../software/include/hal/time.h
 cpustats.o: cpustats.h
 eval.o: ../../software/include/stdio.h ../../software/include/stdlib.h
 eval.o: ../../software/include/string.h ../../software/include/hw/pfpu.h
 cpustats.o: cpustats.h
 eval.o: ../../software/include/stdio.h ../../software/include/stdlib.h
 eval.o: ../../software/include/string.h ../../software/include/hw/pfpu.h
-eval.o: ../../software/include/hw/common.h ../../software/include/hal/pfpu.h
-eval.o: ast.h compiler.h scheduler.h eval.h ../../software/include/hw/tmu.h
+eval.o: ../../software/include/hw/common.h ../../software/include/hw/tmu.h
+eval.o: ../../software/include/hal/pfpu.h ast.h compiler.h scheduler.h eval.h
 isr.o: ../../software/include/hw/interrupts.h ../../software/include/irq.h
 isr.o: ../../software/include/uart.h ../../software/include/hal/time.h
 isr.o: ../../software/include/hal/slowout.h ../../software/include/hal/snd.h
 isr.o: ../../software/include/hw/interrupts.h ../../software/include/irq.h
 isr.o: ../../software/include/uart.h ../../software/include/hal/time.h
 isr.o: ../../software/include/hal/slowout.h ../../software/include/hal/snd.h
index bbb1f0b..a81caea 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Milkymist VJ SoC (Software)
 /*
  * Milkymist VJ SoC (Software)
- * Copyright (C) 2007, 2008, 2009 Sebastien Bourdeauducq
+ * Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -18,6 +18,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <hw/pfpu.h>
 #include <stdio.h>
 #include <string.h>
 #include <hw/pfpu.h>
+#include <hw/tmu.h>
 
 #include <hal/pfpu.h>
 
 
 #include <hal/pfpu.h>
 
@@ -205,11 +206,11 @@ static int generate_perframe(struct eval_state *sc, struct preset *ast)
        return 1;
 }
 
        return 1;
 }
 
-static unsigned int dummy;
+static unsigned int dummy[2];
 
 void eval_pfv_fill_td(struct eval_state *sc, struct pfpu_td *td, pfpu_callback callback, void *user)
 {
 
 void eval_pfv_fill_td(struct eval_state *sc, struct pfpu_td *td, pfpu_callback callback, void *user)
 {
-       td->output = &dummy;
+       td->output = &dummy[0];
        td->hmeshlast = 0;
        td->vmeshlast = 0;
        td->program = sc->perframe_prog;
        td->hmeshlast = 0;
        td->vmeshlast = 0;
        td->program = sc->perframe_prog;
@@ -264,6 +265,7 @@ static int generate_pervertex(struct eval_state *sc, struct preset *ast)
        sc->pervertex_regs[5] = (float)sc->hres;
        sc->pervertex_regs[6] = (float)sc->vres;
        sc->pervertex_regs[13] = PFPU_TRIG_CONV;
        sc->pervertex_regs[5] = (float)sc->hres;
        sc->pervertex_regs[6] = (float)sc->vres;
        sc->pervertex_regs[13] = PFPU_TRIG_CONV;
+       sc->pervertex_regs[14] = (1 << TMU_FIXEDPOINT_SHIFT);
 
        vlen = 0;
        
 
        vlen = 0;
        
@@ -311,12 +313,16 @@ static int generate_pervertex(struct eval_state *sc, struct preset *ast)
        ADD_ISN(PFPU_OPCODE_FADD,       FR( 30), BR( 10), FR( 20)); /* FR20: X */
        ADD_ISN(PFPU_OPCODE_FADD,       FR( 31), BR( 11), FR( 21)); /* FR21: Y */
 
        ADD_ISN(PFPU_OPCODE_FADD,       FR( 30), BR( 10), FR( 20)); /* FR20: X */
        ADD_ISN(PFPU_OPCODE_FADD,       FR( 31), BR( 11), FR( 21)); /* FR21: Y */
 
+       /* Multiply to support the TMU fixed point format */
+       ADD_ISN(PFPU_OPCODE_FMUL,       FR( 20), BR( 14), FR( 25)); /* FR25: X*FP */
+       ADD_ISN(PFPU_OPCODE_FMUL,       FR( 21), BR( 14), FR( 26)); /* FR26: Y*FP */
+
        /* Convert to screen coordinates and generate vertex */
        /* Convert to screen coordinates and generate vertex */
-       ADD_ISN(PFPU_OPCODE_FMUL,       FR( 20), BR(  5), FR( 22)); /* FR22: X screen float */
-       ADD_ISN(PFPU_OPCODE_FMUL,       FR( 21), BR(  6), FR( 23)); /* FR23: Y screen float */
+       ADD_ISN(PFPU_OPCODE_FMUL,       FR( 25), BR(  5), FR( 22)); /* FR22: X screen float */
+       ADD_ISN(PFPU_OPCODE_FMUL,       FR( 26), BR(  6), FR( 23)); /* FR23: Y screen float */
        ADD_ISN(PFPU_OPCODE_F2I,        FR( 22), BR(  0), FR( 24)); /* FR26: X screen integer */
        ADD_ISN(PFPU_OPCODE_F2I,        FR( 23), BR(  0), FR( 25)); /* FR27: Y screen integer */
        ADD_ISN(PFPU_OPCODE_F2I,        FR( 22), BR(  0), FR( 24)); /* FR26: X screen integer */
        ADD_ISN(PFPU_OPCODE_F2I,        FR( 23), BR(  0), FR( 25)); /* FR27: Y screen integer */
-       ADD_ISN(PFPU_OPCODE_VECT,       FR( 25), FR( 24), BR(127)); /* make vector */
+       ADD_ISN(PFPU_OPCODE_VECT,       FR( 25), FR( 24), BR(127)); /* put out vector */
 
 #undef BR
 #undef FR
 
 #undef BR
 #undef FR
@@ -327,6 +333,7 @@ static int generate_pervertex(struct eval_state *sc, struct preset *ast)
        for(i=0;i<EVAL_PVV_COUNT;i++)
                scheduler.dont_touch[sc->pvv_allocation[i]] = 1;
        scheduler.dont_touch[13] = 1; /* PFPU_TRIG_CONV */
        for(i=0;i<EVAL_PVV_COUNT;i++)
                scheduler.dont_touch[sc->pvv_allocation[i]] = 1;
        scheduler.dont_touch[13] = 1; /* PFPU_TRIG_CONV */
+       scheduler.dont_touch[14] = 1; /* 1 << TMU_FIXEDPOINT_SHIFT */
 
        scheduler_schedule(&scheduler, vprog, vlen);
 
 
        scheduler_schedule(&scheduler, vprog, vlen);
 
index cea6845..14450c2 100644 (file)
@@ -34,7 +34,7 @@ unsigned int renderer_texsize;
 void renderer_init()
 {
        renderer_hmeshlast = 32;
 void renderer_init()
 {
        renderer_hmeshlast = 32;
-       renderer_vmeshlast = 24;
+       renderer_vmeshlast = 32;
        renderer_texsize = 512;
        printf("RDR: renderer ready (mesh:%dx%d, texsize:%d)\n", renderer_hmeshlast, renderer_vmeshlast, renderer_texsize);
 }
        renderer_texsize = 512;
        printf("RDR: renderer ready (mesh:%dx%d, texsize:%d)\n", renderer_hmeshlast, renderer_vmeshlast, renderer_texsize);
 }
index 204e850..3774e0d 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Milkymist VJ SoC (Software)
 /*
  * Milkymist VJ SoC (Software)
- * Copyright (C) 2007, 2008, 2009 Sebastien Bourdeauducq
+ * Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -49,28 +49,23 @@ static unsigned int fps;
 static unsigned int spam_counter;
 int spam_enabled;
 
 static unsigned int spam_counter;
 int spam_enabled;
 
-static unsigned short texbufferA[640*480];
-static unsigned short texbufferB[640*480];
+static unsigned short texbufferA[512*512];
+static unsigned short texbufferB[512*512];
 static unsigned short *tex_frontbuffer;
 static unsigned short *tex_backbuffer;
 
 static unsigned short *tex_frontbuffer;
 static unsigned short *tex_backbuffer;
 
-static struct tmu_vertex dst_vertices[TMU_MESH_MAXSIZE][TMU_MESH_MAXSIZE];
+static struct tmu_vertex scale_tex_vertices[TMU_MESH_MAXSIZE][TMU_MESH_MAXSIZE];
 
 #define SPAM_W         75
 #define SPAM_H         75
 #define SPAM_X         545
 #define SPAM_Y         30
 #define SPAM_CHROMAKEY 0x001f
 
 #define SPAM_W         75
 #define SPAM_H         75
 #define SPAM_X         545
 #define SPAM_Y         30
 #define SPAM_CHROMAKEY 0x001f
-#define SPAM_HMESHLAST 5
-#define SPAM_VMESHLAST 5
 
 
-static struct tmu_vertex spam_src_vertices[TMU_MESH_MAXSIZE][TMU_MESH_MAXSIZE];
-static struct tmu_vertex spam_dst_vertices[TMU_MESH_MAXSIZE][TMU_MESH_MAXSIZE];
+static struct tmu_vertex spam_vertices[TMU_MESH_MAXSIZE][TMU_MESH_MAXSIZE];
 
 void rpipe_init()
 {
 
 void rpipe_init()
 {
-       unsigned int x, y;
-       
        produce = 0;
        consume = 0;
        level = 0;
        produce = 0;
        consume = 0;
        level = 0;
@@ -84,19 +79,23 @@ void rpipe_init()
        run_wave_bottom_half = 0;
        run_swap_bottom_half = 0;
 
        run_wave_bottom_half = 0;
        run_swap_bottom_half = 0;
 
-       for(y=0;y<=renderer_vmeshlast;y++)
-               for(x=0;x<=renderer_hmeshlast;x++) {
-                       dst_vertices[y][x].x = x*vga_hres/renderer_hmeshlast;
-                       dst_vertices[y][x].y = y*vga_vres/renderer_vmeshlast;
-               }
-
-       for(y=0;y<=SPAM_VMESHLAST;y++)
-               for(x=0;x<=SPAM_VMESHLAST;x++) {
-                       spam_src_vertices[y][x].x = x*SPAM_W/SPAM_HMESHLAST;
-                       spam_src_vertices[y][x].y = y*SPAM_H/SPAM_VMESHLAST;
-                       spam_dst_vertices[y][x].x = x*SPAM_W/SPAM_HMESHLAST + SPAM_X;
-                       spam_dst_vertices[y][x].y = y*SPAM_H/SPAM_VMESHLAST + SPAM_Y;
-       }
+       scale_tex_vertices[0][0].x = 0;
+       scale_tex_vertices[0][0].y = 0;
+       scale_tex_vertices[0][1].x = renderer_texsize << TMU_FIXEDPOINT_SHIFT;
+       scale_tex_vertices[0][1].y = 0;
+       scale_tex_vertices[1][0].x = 0;
+       scale_tex_vertices[1][0].y = renderer_texsize << TMU_FIXEDPOINT_SHIFT;
+       scale_tex_vertices[1][1].x = renderer_texsize << TMU_FIXEDPOINT_SHIFT;
+       scale_tex_vertices[1][1].y = renderer_texsize << TMU_FIXEDPOINT_SHIFT;
+
+       spam_vertices[0][0].x = 0;
+       spam_vertices[0][0].y = 0;
+       spam_vertices[0][1].x = SPAM_W << TMU_FIXEDPOINT_SHIFT;
+       spam_vertices[0][1].y = 0;
+       spam_vertices[1][0].x = 0;
+       spam_vertices[1][0].y = SPAM_H << TMU_FIXEDPOINT_SHIFT;
+       spam_vertices[1][1].x = SPAM_W << TMU_FIXEDPOINT_SHIFT;
+       spam_vertices[1][1].y = SPAM_H << TMU_FIXEDPOINT_SHIFT;
 
        tex_frontbuffer = texbufferA;
        tex_backbuffer = texbufferB;
 
        tex_frontbuffer = texbufferA;
        tex_backbuffer = texbufferB;
@@ -117,19 +116,23 @@ static void rpipe_start(struct rpipe_frame *frame)
 {
        tmu_task1.flags = 0;
        tmu_task1.hmeshlast = renderer_hmeshlast;
 {
        tmu_task1.flags = 0;
        tmu_task1.hmeshlast = renderer_hmeshlast;
-       tmu_task1.vmeshlast = renderer_vmeshlast;
+       tmu_task1.vmeshlast = renderer_hmeshlast;
        tmu_task1.brightness = frame->brightness;
        tmu_task1.chromakey = 0;
        tmu_task1.brightness = frame->brightness;
        tmu_task1.chromakey = 0;
-       tmu_task1.srcmesh = &frame->vertices[0][0];
-       tmu_task1.srcfbuf = tex_frontbuffer;
-       tmu_task1.srchres = vga_hres;
-       tmu_task1.srcvres = vga_vres;
-       tmu_task1.dstmesh = &dst_vertices[0][0];
+       tmu_task1.vertices = &frame->vertices[0][0];
+       tmu_task1.texfbuf = tex_frontbuffer;
+       tmu_task1.texhres = renderer_texsize;
+       tmu_task1.texvres = renderer_texsize;
+       tmu_task1.texhmask = TMU_MASK_FULL;
+       tmu_task1.texvmask = TMU_MASK_FULL;
        tmu_task1.dstfbuf = tex_backbuffer;
        tmu_task1.dstfbuf = tex_backbuffer;
-       tmu_task1.dsthres = vga_hres;
-       tmu_task1.dstvres = vga_vres;
+       tmu_task1.dsthres = renderer_texsize;
+       tmu_task1.dstvres = renderer_texsize;
+       tmu_task1.dsthoffset = 0;
+       tmu_task1.dstvoffset = 0;
+       tmu_task1.dstsquarew = renderer_texsize/renderer_hmeshlast;
+       tmu_task1.dstsquareh = renderer_texsize/renderer_vmeshlast;
 
 
-       tmu_task1.profile = 0;
        tmu_task1.callback = rpipe_tmu_warpdone;
        tmu_task1.user = frame;
        tmu_submit_task(&tmu_task1);
        tmu_task1.callback = rpipe_tmu_warpdone;
        tmu_task1.user = frame;
        tmu_submit_task(&tmu_task1);
@@ -285,41 +288,50 @@ static void rpipe_wave_bottom_half()
        flush_bridge_cache();
 
        tmu_task2.flags = 0;
        flush_bridge_cache();
 
        tmu_task2.flags = 0;
-       tmu_task2.hmeshlast = renderer_hmeshlast;
-       tmu_task2.vmeshlast = renderer_vmeshlast;
+       tmu_task2.hmeshlast = 1;
+       tmu_task2.vmeshlast = 1;
        tmu_task2.brightness = TMU_BRIGHTNESS_MAX;
        tmu_task2.chromakey = 0;
        tmu_task2.brightness = TMU_BRIGHTNESS_MAX;
        tmu_task2.chromakey = 0;
-       tmu_task2.srcmesh = &dst_vertices[0][0];
-       tmu_task2.srcfbuf = tex_backbuffer;
-       tmu_task2.srchres = vga_hres;
-       tmu_task2.srcvres = vga_vres;
-       tmu_task2.dstmesh = &dst_vertices[0][0];
+       tmu_task2.vertices = &scale_tex_vertices[0][0];
+       tmu_task2.texfbuf = tex_backbuffer;
+       tmu_task2.texhres = renderer_texsize;
+       tmu_task2.texvres = renderer_texsize;
+       tmu_task2.texhmask = TMU_MASK_FULL;
+       tmu_task2.texvmask = TMU_MASK_FULL;
        tmu_task2.dstfbuf = vga_backbuffer;
        tmu_task2.dsthres = vga_hres;
        tmu_task2.dstvres = vga_vres;
        tmu_task2.dstfbuf = vga_backbuffer;
        tmu_task2.dsthres = vga_hres;
        tmu_task2.dstvres = vga_vres;
-       tmu_task2.profile = 0;
+       tmu_task2.dsthoffset = 0;
+       tmu_task2.dstvoffset = 0;
+       tmu_task2.dstsquarew = vga_hres;
+       tmu_task2.dstsquareh = vga_vres;
        if(spam_enabled)
                tmu_task2.callback = NULL;
        else
                tmu_task2.callback = rpipe_tmu_copydone;
        tmu_task2.user = NULL;
        if(spam_enabled)
                tmu_task2.callback = NULL;
        else
                tmu_task2.callback = rpipe_tmu_copydone;
        tmu_task2.user = NULL;
+       
        tmu_submit_task(&tmu_task2);
 
        if(spam_enabled) {
        tmu_submit_task(&tmu_task2);
 
        if(spam_enabled) {
-               tmu_task1.flags = TMU_CTL_CHROMAKEY;
-               tmu_task1.hmeshlast = SPAM_HMESHLAST;
-               tmu_task1.vmeshlast = SPAM_VMESHLAST;
+               tmu_task1.flags = 0;
+               tmu_task1.hmeshlast = 1;
+               tmu_task1.vmeshlast = 1;
                tmu_task1.brightness = TMU_BRIGHTNESS_MAX;
                tmu_task1.chromakey = SPAM_CHROMAKEY;
                tmu_task1.brightness = TMU_BRIGHTNESS_MAX;
                tmu_task1.chromakey = SPAM_CHROMAKEY;
-               tmu_task1.srcmesh = &spam_src_vertices[0][0];
-               tmu_task1.srcfbuf = (unsigned short *)spam_raw;
-               tmu_task1.srchres = SPAM_W;
-               tmu_task1.srcvres = SPAM_H;
-               tmu_task1.dstmesh = &spam_dst_vertices[0][0];
+               tmu_task1.vertices = &spam_vertices[0][0];
+               tmu_task1.texfbuf = (unsigned short *)spam_raw;
+               tmu_task1.texhres = SPAM_W;
+               tmu_task1.texvres = SPAM_H;
+               tmu_task1.texhmask = TMU_MASK_FULL;
+               tmu_task1.texvmask = TMU_MASK_FULL;
                tmu_task1.dstfbuf = vga_backbuffer;
                tmu_task1.dsthres = vga_hres;
                tmu_task1.dstvres = vga_vres;
                tmu_task1.dstfbuf = vga_backbuffer;
                tmu_task1.dsthres = vga_hres;
                tmu_task1.dstvres = vga_vres;
-               tmu_task1.profile = 0;
+               tmu_task1.dsthoffset = SPAM_X;
+               tmu_task1.dstvoffset = SPAM_Y;
+               tmu_task1.dstsquarew = SPAM_W;
+               tmu_task1.dstsquareh = SPAM_H;
                tmu_task1.callback = rpipe_tmu_copydone;
                tmu_task1.user = NULL;
                tmu_submit_task(&tmu_task1);
                tmu_task1.callback = rpipe_tmu_copydone;
                tmu_task1.user = NULL;
                tmu_submit_task(&tmu_task1);
index 273bbec..687c1ce 100644 (file)
@@ -207,6 +207,22 @@ static void help()
        puts("reboot     - system reset");
 }
 
        puts("reboot     - system reset");
 }
 
+static void loadpic(const char *filename)
+{
+       int size;
+       
+       if(*filename == 0) {
+               printf("loadpic <filename>\n");
+               return;
+       }
+
+       if(!cffat_init()) return;
+       if(!cffat_load(filename, (void *)vga_backbuffer, vga_hres*vga_vres*2, &size)) return;
+       cffat_done();
+
+       vga_swap_buffers();
+}
+
 /*
  * Low-level PFPU test, bypassing driver.
  * This test should only be run when the driver task queue
 /*
  * Low-level PFPU test, bypassing driver.
  * This test should only be run when the driver task queue
@@ -300,32 +316,34 @@ static void tmutest()
 {
        int x, y;
        struct tmu_vertex srcmesh[TMU_MESH_MAXSIZE][TMU_MESH_MAXSIZE];
 {
        int x, y;
        struct tmu_vertex srcmesh[TMU_MESH_MAXSIZE][TMU_MESH_MAXSIZE];
-       struct tmu_vertex dstmesh[TMU_MESH_MAXSIZE][TMU_MESH_MAXSIZE];
        struct tmu_td td;
        volatile int complete;
 
        struct tmu_td td;
        volatile int complete;
 
-       for(y=0;y<=24;y++)
+       for(y=0;y<=32;y++)
                for(x=0;x<=32;x++) {
                for(x=0;x<=32;x++) {
-                       srcmesh[y][x].x = 30*x;
-                       srcmesh[y][x].y = 30*y;
-               
-                       dstmesh[y][x].x = 20*x;
-                       dstmesh[y][x].y = 20*y;
+                       srcmesh[y][x].x = (5*x) << TMU_FIXEDPOINT_SHIFT;
+                       srcmesh[y][x].y = (7*y) << TMU_FIXEDPOINT_SHIFT;
                }
 
                }
 
+       td.flags = 0;
        td.hmeshlast = 32;
        td.hmeshlast = 32;
-       td.vmeshlast = 24;
+       td.vmeshlast = 32;
        td.brightness = TMU_BRIGHTNESS_MAX;
        td.brightness = TMU_BRIGHTNESS_MAX;
-       td.srcmesh = &srcmesh[0][0];
-       td.srcfbuf = vga_frontbuffer;
-       td.srchres = vga_hres;
-       td.srcvres = vga_vres;
-       td.dstmesh = &dstmesh[0][0];
+       td.chromakey = 0;
+       td.vertices = &srcmesh[0][0];
+       td.texfbuf = vga_frontbuffer;
+       td.texhres = vga_hres;
+       td.texvres = vga_vres;
+       td.texhmask = TMU_MASK_FULL;
+       td.texvmask = TMU_MASK_FULL;
        td.dstfbuf = vga_backbuffer;
        td.dsthres = vga_hres;
        td.dstvres = vga_vres;
        td.dstfbuf = vga_backbuffer;
        td.dsthres = vga_hres;
        td.dstvres = vga_vres;
+       td.dsthoffset = 0;
+       td.dstvoffset = 0;
+       td.dstsquarew = vga_hres/32;
+       td.dstsquareh = vga_vres/32;
        
        
-       td.profile = 1;
        td.callback = tmutest_callback;
        td.user = (void *)&complete;
 
        td.callback = tmutest_callback;
        td.user = (void *)&complete;
 
@@ -413,6 +431,7 @@ static void do_command(char *c)
        else if(strcmp(command, "help") == 0) help();
 
        /* Test functions and hacks */
        else if(strcmp(command, "help") == 0) help();
 
        /* Test functions and hacks */
+       else if(strcmp(command, "loadpic") == 0) loadpic(param1);
        else if(strcmp(command, "pfputest") == 0) pfputest();
        else if(strcmp(command, "tmutest") == 0) tmutest();
        else if(strcmp(command, "echo") == 0) echo();
        else if(strcmp(command, "pfputest") == 0) pfputest();
        else if(strcmp(command, "tmutest") == 0) tmutest();
        else if(strcmp(command, "echo") == 0) echo();
index b859be3..29ac154 100644 (file)
@@ -12,5 +12,5 @@ RANLIB=lm32-elf-ranlib
 #
 INCLUDES=-I$(MMDIR)/software/include -I$(MMDIR)/tools
 ASFLAGS=$(INCLUDES)
 #
 INCLUDES=-I$(MMDIR)/software/include -I$(MMDIR)/tools
 ASFLAGS=$(INCLUDES)
-CFLAGS=-O9 -Wall -fomit-frame-pointer -mbarrel-shift-enabled -mmultiply-enabled -mdivide-enabled -msign-extend-enabled -fno-builtin -fsigned-char -fsingle-precision-constant $(INCLUDES)
+CFLAGS=-O3 -Wall -mbarrel-shift-enabled -mmultiply-enabled -mdivide-enabled -msign-extend-enabled -fno-builtin -fsigned-char -fsingle-precision-constant $(INCLUDES)
 LDFLAGS=-nostdlib -nodefaultlibs
 LDFLAGS=-nostdlib -nodefaultlibs
index 4ac1eb1..2b32c23 100644 (file)
@@ -1,16 +1,16 @@
 /*
  * Milkymist VJ SoC (Software)
 /*
  * Milkymist VJ SoC (Software)
- * Copyright (C) 2007, 2008, 2009 Sebastien Bourdeauducq
- * 
+ * Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq
+ *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation, version 3 of the License.
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation, version 3 of the License.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
@@ -30,16 +30,20 @@ struct tmu_td {
        unsigned int vmeshlast;
        unsigned int brightness;
        unsigned short chromakey;
        unsigned int vmeshlast;
        unsigned int brightness;
        unsigned short chromakey;
-       struct tmu_vertex *srcmesh;
-       unsigned short *srcfbuf;
-       unsigned int srchres;
-       unsigned int srcvres;
-       struct tmu_vertex *dstmesh;
+       struct tmu_vertex *vertices;
+       unsigned short *texfbuf;
+       unsigned int texhres;
+       unsigned int texvres;
+       unsigned int texhmask;
+       unsigned int texvmask;
        unsigned short *dstfbuf;
        unsigned int dsthres;
        unsigned int dstvres;
        unsigned short *dstfbuf;
        unsigned int dsthres;
        unsigned int dstvres;
+       int dsthoffset;
+       int dstvoffset;
+       unsigned int dstsquarew;
+       unsigned int dstsquareh;
 
 
-       int profile; /* < prints profiling info after completion */
        tmu_callback callback;
        void *user; /* < for application use */
 };
        tmu_callback callback;
        void *user; /* < for application use */
 };
index dd523fc..13c0926 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Milkymist VJ SoC (Software)
 /*
  * Milkymist VJ SoC (Software)
- * Copyright (C) 2007, 2008, 2009 Sebastien Bourdeauducq
+ * Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 
 #define TMU_BRIGHTNESS_MAX     (63)
 
 
 #define TMU_BRIGHTNESS_MAX     (63)
 
-#define CSR_TMU_SRCMESH                MMPTR(0x80006014)
-#define CSR_TMU_SRCFBUF                MMPTR(0x80006018)
-#define CSR_TMU_SRCHRES                MMPTR(0x8000601C)
-#define CSR_TMU_SRCVRES                MMPTR(0x80006020)
+#define CSR_TMU_VERTICESADR    MMPTR(0x80006014)
+#define CSR_TMU_TEXFBUF                MMPTR(0x80006018)
+#define CSR_TMU_TEXHRES                MMPTR(0x8000601C)
+#define CSR_TMU_TEXVRES                MMPTR(0x80006020)
+#define CSR_TMU_TEXHMASK       MMPTR(0x80006024)
+#define CSR_TMU_TEXVMASK       MMPTR(0x80006028)
 
 
-#define CSR_TMU_DSTMESH                MMPTR(0x80006024)
-#define CSR_TMU_DSTFBUF                MMPTR(0x80006028)
-#define CSR_TMU_DSTHRES                MMPTR(0x8000602C)
-#define CSR_TMU_DSTVRES                MMPTR(0x80006030)
+#define TMU_MASK_FULL          (0x3ffff)
+#define TMU_FIXEDPOINT_SHIFT   (6)
 
 
-/* Performance counters */
-
-#define CSR_TMUP_PIXELS                MMPTR(0x80006034)
-#define CSR_TMUP_CLOCKS                MMPTR(0x80006038)
-
-#define CSR_TMUP_STALL1                MMPTR(0x8000603C)
-#define CSR_TMUP_COMPLETE1     MMPTR(0x80006040)
-#define CSR_TMUP_STALL2                MMPTR(0x80006044)
-#define CSR_TMUP_COMPLETE2     MMPTR(0x80006048)
-
-#define CSR_TMUP_MISSES                MMPTR(0x8000604C)
+#define CSR_TMU_DSTFBUF                MMPTR(0x8000602C)
+#define CSR_TMU_DSTHRES                MMPTR(0x80006030)
+#define CSR_TMU_DSTVRES                MMPTR(0x80006034)
+#define CSR_TMU_DSTHOFFSET     MMPTR(0x80006038)
+#define CSR_TMU_DSTVOFFSET     MMPTR(0x8000603C)
+#define CSR_TMU_DSTSQUAREW     MMPTR(0x80006040)
+#define CSR_TMU_DSTSQUAREH     MMPTR(0x80006044)
 
 struct tmu_vertex {
 
 struct tmu_vertex {
-       short int y;
-       short int x;
+       int x;
+       int y;
 } __attribute__((packed));
 
 #define TMU_MESH_MAXSIZE       128
 } __attribute__((packed));
 
 #define TMU_MESH_MAXSIZE       128
index b44d041..ed56ecf 100644 (file)
@@ -47,8 +47,8 @@ libc.o: ../../software/include/string.h ../../software/include/limits.h
 malloc.o: ../../software/include/stdio.h ../../software/include/stdlib.h
 malloc.o: ../../software/include/string.h ../../software/include/console.h
 malloc.o: ../../software/include/malloc.h
 malloc.o: ../../software/include/stdio.h ../../software/include/stdlib.h
 malloc.o: ../../software/include/string.h ../../software/include/console.h
 malloc.o: ../../software/include/malloc.h
-softfloat-glue.o: softfloat.h
 softfloat.o: milieu.h softfloat.h softfloat-macros.h softfloat-specialize.h
 softfloat.o: milieu.h softfloat.h softfloat-macros.h softfloat-specialize.h
+softfloat-glue.o: softfloat.h
 system.o: ../../software/include/irq.h ../../software/include/uart.h
 system.o: ../../software/include/hw/fmlbrg.h
 system.o: ../../software/include/hw/sysctl.h
 system.o: ../../software/include/irq.h ../../software/include/uart.h
 system.o: ../../software/include/hw/fmlbrg.h
 system.o: ../../software/include/hw/sysctl.h
@@ -60,11 +60,11 @@ uart-async.o: ../../software/include/hw/interrupts.h
 uart.o: ../../software/include/uart.h ../../software/include/irq.h
 uart.o: ../../software/include/hw/uart.h ../../software/include/hw/common.h
 uart.o: ../../software/include/hw/interrupts.h
 uart.o: ../../software/include/uart.h ../../software/include/irq.h
 uart.o: ../../software/include/hw/uart.h ../../software/include/hw/common.h
 uart.o: ../../software/include/hw/interrupts.h
+vsnprintf.o: ../../software/include/stdlib.h ../../software/include/stdio.h
+vsnprintf.o: ../../software/include/stdarg.h ../../software/include/string.h
+vsnprintf.o: ../../software/include/ctype.h
 vsnprintf-nofloat.o: ../../software/include/stdlib.h
 vsnprintf-nofloat.o: ../../software/include/stdio.h
 vsnprintf-nofloat.o: ../../software/include/stdarg.h
 vsnprintf-nofloat.o: ../../software/include/string.h
 vsnprintf-nofloat.o: ../../software/include/ctype.h
 vsnprintf-nofloat.o: ../../software/include/stdlib.h
 vsnprintf-nofloat.o: ../../software/include/stdio.h
 vsnprintf-nofloat.o: ../../software/include/stdarg.h
 vsnprintf-nofloat.o: ../../software/include/string.h
 vsnprintf-nofloat.o: ../../software/include/ctype.h
-vsnprintf.o: ../../software/include/stdlib.h ../../software/include/stdio.h
-vsnprintf.o: ../../software/include/stdarg.h ../../software/include/string.h
-vsnprintf.o: ../../software/include/ctype.h
index c92034e..d68fef6 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Milkymist VJ SoC (Software)
 /*
  * Milkymist VJ SoC (Software)
- * Copyright (C) 2007, 2008, 2009 Sebastien Bourdeauducq
+ * Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -58,48 +58,29 @@ static void tmu_start(struct tmu_td *td)
        CSR_TMU_VMESHLAST = td->vmeshlast;
        CSR_TMU_BRIGHTNESS = td->brightness;
        CSR_TMU_CHROMAKEY = td->chromakey;
        CSR_TMU_VMESHLAST = td->vmeshlast;
        CSR_TMU_BRIGHTNESS = td->brightness;
        CSR_TMU_CHROMAKEY = td->chromakey;
-       CSR_TMU_SRCMESH = (unsigned int)td->srcmesh;
-       CSR_TMU_SRCFBUF = (unsigned int)td->srcfbuf;
-       CSR_TMU_SRCHRES = td->srchres;
-       CSR_TMU_SRCVRES = td->srcvres;
-       CSR_TMU_DSTMESH = (unsigned int)td->dstmesh;
+
+       CSR_TMU_VERTICESADR = (unsigned int)td->vertices;
+       CSR_TMU_TEXFBUF = (unsigned int)td->texfbuf;
+       CSR_TMU_TEXHRES = td->texhres;
+       CSR_TMU_TEXVRES = td->texvres;
+       CSR_TMU_TEXHMASK = td->texhmask;
+       CSR_TMU_TEXVMASK = td->texvmask;
+
        CSR_TMU_DSTFBUF = (unsigned int)td->dstfbuf;
        CSR_TMU_DSTHRES = td->dsthres;
        CSR_TMU_DSTVRES = td->dstvres;
        CSR_TMU_DSTFBUF = (unsigned int)td->dstfbuf;
        CSR_TMU_DSTHRES = td->dsthres;
        CSR_TMU_DSTVRES = td->dstvres;
+       CSR_TMU_DSTHOFFSET = td->dsthoffset;
+       CSR_TMU_DSTVOFFSET = td->dstvoffset;
+       CSR_TMU_DSTSQUAREW = td->dstsquarew;
+       CSR_TMU_DSTSQUAREH = td->dstsquareh;
 
        CSR_TMU_CTL = td->flags|TMU_CTL_START;
 
        CSR_TMU_CTL = td->flags|TMU_CTL_START;
-       //printf("write %d read %d\n", td->flags|TMU_CTL_START, CSR_TMU_CTL);
 }
 
 void tmu_isr()
 {
        if(queue[consume]->callback)
                queue[consume]->callback(queue[consume]);
 }
 
 void tmu_isr()
 {
        if(queue[consume]->callback)
                queue[consume]->callback(queue[consume]);
-       if(queue[consume]->profile) {
-               int pixels, clocks, misses, hits;
-
-               printf("TMU: ====================================================\n");
-               pixels = CSR_TMUP_PIXELS;
-               clocks = CSR_TMUP_CLOCKS;
-               printf("TMU: Drawn pixels:                         %d\n", pixels);
-               printf("TMU: Processing time (clock cycles):       %d\n", clocks);
-               printf("TMU: Fill rate (Mpixels/s):                %d\n", (brd_desc->clk_frequency/1000000)*pixels/clocks);
-               printf("TMU: Frames per second:                    %d\n", brd_desc->clk_frequency/clocks);
-               printf("TMU: Geometry rate (Kvertices/s):          %d\n", (brd_desc->clk_frequency/1000)*((CSR_TMU_HMESHLAST+1)*(CSR_TMU_VMESHLAST+1))/clocks);
-               printf("TMU: At point 1:\n");
-               printf("TMU:   - stalled transactions:             %d\n", CSR_TMUP_STALL1);
-               printf("TMU:   - completed transactions:           %d\n", CSR_TMUP_COMPLETE1);
-               printf("TMU: At point 2:\n");
-               printf("TMU:   - stalled transactions:             %d\n", CSR_TMUP_STALL2);
-               printf("TMU:   - completed transactions:           %d\n", CSR_TMUP_COMPLETE2);
-               printf("TMU: Texel cache:\n");
-               misses = CSR_TMUP_MISSES;
-               hits = pixels-misses;
-               printf("TMU:   - hits:                             %d\n", hits);
-               printf("TMU:   - misses:                           %d\n", misses);
-               printf("TMU:   - hit rate:                         %d%%\n", 100*hits/(hits+misses));
-               printf("TMU: ====================================================\n");
-       }
        consume = (consume + 1) & TMU_TASKQ_MASK;
        level--;
 
        consume = (consume + 1) & TMU_TASKQ_MASK;
        level--;