Changeset 679


Ignore:
Timestamp:
Jul 29, 2015, 5:52:18 PM (9 years ago)
Author:
guerin
Message:

raycast: dynamically allocate framebuffer

With a 512x512 fb, the generated .elf file was too large for the FAT32
driver to load. Now that we can allocate aligned memory blocks, the .elf
size is greatly reduced.

Location:
soft/giet_vm/applications/raycast
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/applications/raycast/disp.c

    r677 r679  
    1414// Globals
    1515
    16 static unsigned char buf0[FBUF_X_SIZE * FBUF_Y_SIZE] __attribute__((aligned(64)));
    17 static unsigned char buf1[FBUF_X_SIZE * FBUF_Y_SIZE] __attribute__((aligned(64)));
    18 static unsigned int  sts0[16]  __attribute__((aligned(64)));
    19 static unsigned int  sts1[16]  __attribute__((aligned(64)));
    20 static unsigned int  cur_buf;
     16static unsigned char* buf[2];
     17static void *         sts[2];
     18static unsigned int   cur_buf;
    2119
    2220// Textures indexed by block number
     
    3432static void dispDrawColumnTex(int x, int y0, int y1, unsigned char *tex, int tx)
    3533{
    36     unsigned char* buf = (cur_buf == 0 ? buf0 : buf1);
    3734    int y;
    3835
     
    4643        int ty = (y - y0) * TEX_SIZE / (y1 - y0);
    4744
    48         buf[y * FBUF_X_SIZE + x] = tex[ty * TEX_SIZE + tx];
     45        buf[cur_buf][y * FBUF_X_SIZE + x] = tex[ty * TEX_SIZE + tx];
    4946    }
    5047}
     
    5249static void dispDrawColumnSolid(int x, int y0, int y1, unsigned char color)
    5350{
    54     unsigned char* buf = (cur_buf == 0 ? buf0 : buf1);
    5551    int y;
    5652
     
    6258            y = 0;
    6359
    64         buf[y * FBUF_X_SIZE + x] = color;
     60        buf[cur_buf][y * FBUF_X_SIZE + x] = color;
    6561    }
    6662}
     
    195191void dispInit()
    196192{
     193    // allocate framebuffer
     194    buf[0] = almalloc(64, FBUF_X_SIZE * FBUF_Y_SIZE);
     195    buf[1] = almalloc(64, FBUF_X_SIZE * FBUF_Y_SIZE);
     196    sts[0] = almalloc(64, 64);
     197    sts[1] = almalloc(64, 64);
     198
    197199    // initialize framebuffer
    198200    giet_fbf_cma_alloc();
    199     giet_fbf_cma_init_buf(buf0, buf1, sts0, sts1);
     201    giet_fbf_cma_init_buf(buf[0], buf[1], sts[0], sts[1]);
    200202    giet_fbf_cma_start(FBUF_X_SIZE * FBUF_Y_SIZE);
    201203
  • soft/giet_vm/applications/raycast/raycast.py

    r676 r679  
    3030
    3131    heap_base  = 0x60000000
    32     heap_size  = 0x00008000     # 32 Kbytes
     32    heap_size  = 0x00400000     # 4 Mbytes
    3333
    3434    # create vspace
     
    5252                     local = False, big = True )
    5353
    54     # heap vseg (unused)           
     54    # heap vseg
    5555    mapping.addVseg( vspace, 'raycast_heap', heap_base, heap_size,
    5656                     'C_WU', vtype = 'BUFFER', x = 0 , y = 0 , pseg = 'RAM',
Note: See TracChangeset for help on using the changeset viewer.