Changeset 724 for soft


Ignore:
Timestamp:
Nov 21, 2015, 2:25:14 PM (9 years ago)
Author:
alain
Message:

Update graphical applications.

Location:
soft/giet_vm/applications
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/applications/display/display.c

    r720 r724  
    6666    giet_fbf_alloc();
    6767
    68     // get a Chained Buffer DMA channel
    69     giet_fbf_cma_alloc();
     68    // get a Chained Buffer DMA channel for two user buffers
     69    giet_fbf_cma_alloc( 2 );
    7070
    71     // initialize the source and destination chbufs
    72     giet_fbf_cma_init_buf( buf0 , buf1 , sts0 , sts1 );
     71    // register the two user buffers
     72    giet_fbf_cma_init_buf( 0 , buf0 , sts0 );
     73    giet_fbf_cma_init_buf( 1 , buf1 , sts1 );
    7374
    74     // start Chained Buffer DMA channel
    75     giet_fbf_cma_start( NPIXELS*NLINES );
     75    // start CMA peripheral
     76    giet_fbf_cma_start();
    7677   
    7778    giet_tty_printf("\n[DISPLAY] Proc[%d,%d,%d] starts CMA at cycle %d\n",
     
    8182    while ( 1 )
    8283    {
    83         // load buf0
    84         giet_fat_read( fd, buf0, NPIXELS*NLINES );
    85 
    86         giet_tty_printf("\n[DISPLAY] Proc[%d,%d,%d] load image %d at cycle %d\n",
    87                         x, y, p, image, giet_proctime() );
    88 
    89         // display buf0
    90         giet_fbf_cma_display( 0 );
     84        //////   handling buf0
     85        giet_fbf_cma_check( 0 );                       // check buf0 empty
     86        giet_fat_read( fd, buf0, NPIXELS*NLINES );     // load buf0 from disk
     87        giet_fbf_cma_display( 0 );                     // display buf0
    9188
    9289        giet_tty_printf("\n[DISPLAY] Proc[%d,%d,%d] display image %d at cycle %d\n",
    9390                        x, y, p, image, giet_proctime() );
    94 
    9591        image++;
    9692
     
    9894        {
    9995            image = 0;
    100             giet_fat_lseek( fd , 0 , 0 );
     96            giet_fat_lseek( fd , 0 , SEEK_SET );
    10197        }
    10298
    10399        if ( INTERACTIVE ) giet_tty_getc( &byte );
    104100
    105         // load buf1
    106         giet_fat_read( fd, buf1, NPIXELS*NLINES );
    107 
    108         giet_tty_printf("\n[DISPLAY] Proc[%d,%d,%d] load image %d at cycle %d\n",
    109                         x, y, p, image, giet_proctime() );
    110 
    111         // display buf1
    112         giet_fbf_cma_display( 1 );
     101        //////   handling buf1
     102        giet_fbf_cma_check( 1 );                       // check buf1 empty
     103        giet_fat_read( fd, buf1, NPIXELS*NLINES );     // load buf1 from disk
     104        giet_fbf_cma_display( 1 );                     // display buf1
    113105
    114106        giet_tty_printf("\n[DISPLAY] Proc[%d,%d,%d] display image %d at cycle %d\n",
    115107                        x, y, p, image, giet_proctime() );
    116 
    117108        image++;
    118109
     
    120111        {
    121112            image = 0;
    122             giet_fat_lseek( fd , 0 , 0 );
     113            giet_fat_lseek( fd , 0 , SEEK_SET );
    123114        }
    124115
  • soft/giet_vm/applications/display/display.py

    r708 r724  
    2222    x = 0
    2323    y = 0
    24     p = 2
     24    p = 0
    2525
    2626    # define vsegs base & size
  • soft/giet_vm/applications/gameoflife/gameoflife.c

    r721 r724  
    260260   giet_fbf_alloc();
    261261
    262    // get a Chained Buffer DMA channel
    263    giet_fbf_cma_alloc();
    264 
    265    // initializes the source and destination buffers
    266    giet_fbf_cma_init_buf( &display[0][0][0] ,
    267                           &display[1][0][0] ,
    268                           status0 ,
    269                           status1 );
     262   // get a CMA channel for two user buffers
     263   giet_fbf_cma_alloc( 2 );
     264
     265   // register the user buffers
     266   giet_fbf_cma_init_buf( 0 , &display[0][0][0] , status0 );
     267   giet_fbf_cma_init_buf( 1 , &display[1][0][0] , status1 );
    270268
    271269   // activates CMA channel
    272    giet_fbf_cma_start( height * width );
     270   giet_fbf_cma_start();
    273271
    274272   // initializes distributed heap
  • soft/giet_vm/applications/raycast/disp.c

    r708 r724  
    1919
    2020extern unsigned char*  g_tex[5];
    21 extern unsigned char*  buf[2];
    22 extern void*           sts[2];
    23 extern unsigned int    cur_buf;
     21extern unsigned char*  buf;
     22extern void*           sts;
    2423extern unsigned int    slice_x;
    2524extern unsigned int    slice_count;
     
    3837    int ymax = (y1 < FBUF_Y_SIZE ? y1 : FBUF_Y_SIZE);
    3938
    40     for (; y < ymax; y++) {
     39    for (; y < ymax; y++)
     40    {
    4141        // Find texture coordinate
    4242        int ty = (y - y0) * TEX_SIZE / (y1 - y0);
    4343
    44         buf[cur_buf][y * FBUF_X_SIZE + x] = line[ty];
     44        buf[y * FBUF_X_SIZE + x] = line[ty];
    4545    }
    4646}
     
    5252    int ymax = (y1 < FBUF_Y_SIZE ? y1 : FBUF_Y_SIZE);
    5353
    54     for (; y < ymax; y++) {
    55         buf[cur_buf][y * FBUF_X_SIZE + x] = color;
     54    for (; y < ymax; y++)
     55    {
     56        buf[y * FBUF_X_SIZE + x] = color;
    5657    }
    5758}
  • soft/giet_vm/applications/raycast/raycast.c

    r712 r724  
    99///////////////////////
    1010
    11 unsigned char*           buf[2];             // one image per buffer
    12 void *                   sts[2];             // for fbf_cma
    13 unsigned int             cur_buf;            // current buffer
     11unsigned char*           buf;                // one image buffer
     12void *                   sts;                // buffer status
    1413volatile unsigned int    slice_x;            // slice index (shared)
    1514volatile unsigned int    slice_count;        // slice count (shared)
     
    8483    sqt_lock_init( &slice_done_lock, w , h , p );
    8584
    86     // Allocate buffers
    87     buf[0] = malloc(FBUF_X_SIZE * FBUF_Y_SIZE);
    88     buf[1] = malloc(FBUF_X_SIZE * FBUF_Y_SIZE);
    89     sts[0] = malloc(64);
    90     sts[1] = malloc(64);
     85    // Allocate buffer and status for CMA
     86    buf = malloc(FBUF_X_SIZE * FBUF_Y_SIZE);
     87    sts = malloc(64);
    9188
    92     // Initialize frame buffer and start Chained buffer DMA
     89    // Get frame buffer ownership
    9390    giet_fbf_alloc();
    94     giet_fbf_cma_alloc();
    95     giet_fbf_cma_init_buf(buf[0], buf[1], sts[0], sts[1]);
    96     giet_fbf_cma_start(FBUF_X_SIZE * FBUF_Y_SIZE);
    97     cur_buf = 0;
     91   
     92    // Get a CMA channel for one single user buffer
     93    giet_fbf_cma_alloc( 1 );
     94   
     95    // Register the user buffer and status
     96    giet_fbf_cma_init_buf( 0 , buf , sts );
     97
     98    // Start Chained buffer DMA
     99    giet_fbf_cma_start();
    98100
    99101    // Load textures
     
    122124    }
    123125
    124 
    125 
    126126    // Game main loop : display one frame
    127127    // and get one player move per iteration
    128128    while ( game.exit == 0 )
    129129    {
    130         // initialise synchronisation variables
    131         // this actually allows the render threads to make useful work
     130        // check user buffer empty
     131        giet_fbf_cma_check( 0 );
     132
     133        // re-initialise synchronisation variables
     134        // to start parallel synthesis
    132135        slice_count = 0;
    133136        slice_x     = 0;
    134137
    135         // contribute to build current buffer
     138        // contribute to synthesis
    136139        unsigned int slice;
    137140        while ( dispRenderSlice( &slice ) );
     
    140143        while (slice_count < FBUF_X_SIZE)  giet_tty_printf(" ");
    141144
    142         // Flip buffer
    143         giet_fbf_cma_display(cur_buf);
    144         cur_buf = 1 - cur_buf;
     145        // display image
     146        giet_fbf_cma_display( 0 );
    145147
    146148        // get new player position [x,y,dir]
Note: See TracChangeset for help on using the changeset viewer.