1.1 --- a/test/testyuv.c Mon Jan 15 08:30:50 2007 +0000
1.2 +++ b/test/testyuv.c Sun Oct 07 06:27:12 2007 +0000
1.5 - * $Id: testyuv.c,v 1.1 2007-01-15 08:30:50 nkeynes Exp $
1.6 + * $Id: testyuv.c,v 1.2 2007-01-15 10:41:30 nkeynes Exp $
1.8 * Renderer test cases
1.11 #define YUV_ADDR (PVR_BASE+0x148)
1.12 #define YUV_CONFIG (PVR_BASE+0x14C)
1.13 #define YUV_STATUS (PVR_BASE+0x150)
1.14 +#define TEXSIZE (PVR_BASE+0x0E4)
1.15 #define DISPLAY_MODE (PVR_BASE+0x044)
1.16 #define DISPLAY_ADDR1 (PVR_BASE+0x050)
1.17 #define DISPLAY_ADDR2 (PVR_BASE+0x054)
1.18 #define DISPLAY_SIZE (PVR_BASE+0x05C)
1.20 +#define OBJ_START 0x00010000
1.21 +#define OBJ_LENGTH 0x00010000
1.22 +#define TILE_START 0x00060000
1.23 +#define TILE_LENGTH 0x00010000
1.24 +#define TILEMAP_ADDR 0x050B2C8
1.25 +#define RENDER_ADDR 0x00600000
1.27 +#define OBJCFG 0xA05F807C
1.28 +#define ISPCFG 0xA05F8098
1.30 +struct ta_config default_ta_config = { 0x00100002, GRID_SIZE(640,480), OBJ_START,
1.31 + OBJ_START+OBJ_LENGTH, TILE_START+TILE_LENGTH,
1.32 + TILE_START, TILE_START+TILE_LENGTH };
1.36 +struct render_config default_render_config = { OBJ_START, TILEMAP_ADDR, RENDER_ADDR, 640, 480,
1.37 + 0x00000009, 0.0001f, 1.0f };
1.41 + uint32_t mode1, mode2, mode3;
1.51 +#define START_BLEND 0
1.52 +#define BG_COLOUR 0xFF808080
1.54 +struct backplane default_backplane = { 0x90800000, 0x20800440, 0,
1.55 + 0.0, 0.0, 0.2, BG_COLOUR,
1.56 + 640.0, 0.0, 0.2, BG_COLOUR,
1.57 + 0.0, 480.0, 0.2, BG_COLOUR };
1.66 -} test_yuv_poly = { { 0x8084000A, 0xE0000000, 0x2083242D, 0, 0, 0, 0, 0 },
1.67 - { { 0xE0000000, 0.0, 0.0, 0.2, 0.0, 0.0, 0xFFFFFFFF, 0 },
1.68 - { 0xE0000000, 640.0, 0.0, 0.2, 0.625, 0.0, 0xFFFFFFFF, 0 },
1.69 - { 0xE0000000, 0.0, 480.0, 0.2, 0.0, 0.9375, 0xFFFFFFFF, 0 },
1.70 - { 0xF0000000, 640.0, 480.0, 0.2, 0.625, 0.9375, 0xFFFFFFFF, 0 } },
1.71 +} test_yuv_poly = { { 0x808C010A, 0xE0000000, 0x2091A4F6, 0x1E000000, 0, 0, 0, 0 },
1.72 + { { 0xE0000000, 0.0, 0.0, 2.0, 0.0, 0.0, 0xFFFFFFFF, 0 },
1.73 + { 0xE0000000, 640.0, 0.0, 2.0, 0.625, 0.0, 0xFFFFFFFF, 0 },
1.74 + { 0xE0000000, 0.0, 480.0, 2.0, 0.0, 0.9375, 0xFFFFFFFF, 0 },
1.75 + { 0xF0000000, 640.0, 480.0, 2.0, 0.625, 0.9375, 0xFFFFFFFF, 0 } },
1.76 { 0,0,0,0,0,0,0,0 } };
1.81 int test_yuv( test_data_t test_case )
1.84 @@ -77,12 +120,53 @@
1.85 uint32_t timeus = timer_gettime_us();
1.86 uint32_t status2 = long_read( YUV_STATUS );
1.88 - /* Render the thing */
1.89 + struct ta_config *config = &default_ta_config;
1.91 + /* Send TA data */
1.95 memcpy( p, &test_yuv_poly, sizeof(test_yuv_poly) );
1.96 - if( pvr_dma_write( 0x10000000, p, sizeof(test_yuv_poly) ) != 0 ) {
1.97 + if( pvr_dma_write( 0x10000000, p, sizeof(test_yuv_poly), 0 ) != 0 ) {
1.100 + asic_wait( EVENT_PVR_OPAQUE_DONE );
1.101 + if( asic_check( EVENT_PVR_PRIM_ALLOC_FAIL ) ||
1.102 + asic_check( EVENT_PVR_MATRIX_ALLOC_FAIL ) ||
1.103 + asic_check( EVENT_PVR_BAD_INPUT ) ) {
1.104 + asic_dump(stderr);
1.108 + /* Write backplane (if any) */
1.109 + uint32_t bgplane = pvr_get_objbuf_posn();
1.110 + memcpy( (char *)(PVR_VRAM_BASE + bgplane), &default_backplane, sizeof(default_backplane) );
1.111 + bgplane -= default_render_config.polybuf;
1.112 + render_set_backplane( (bgplane << 1) | 0x01000000 );
1.114 + /* Render the damn thing */
1.115 + long_write( OBJCFG, 0x0027DF77 );
1.116 + long_write( ISPCFG, 0x00800409 );
1.117 + long_write( TEXSIZE, 0x0000000A );
1.118 + pvr_build_tilemap2( TILEMAP_ADDR, config, 0x10000000 );
1.119 + render_start( &default_render_config );
1.120 + if( asic_wait( EVENT_PVR_RENDER_DONE ) == -1 ) {
1.121 + fprintf( stderr, "Test render failed (timeout waiting for render)\n" );
1.122 + asic_dump( stderr );
1.127 + asic_wait( EVENT_RETRACE );
1.128 + display_render( &default_render_config );
1.130 + asic_wait(EVENT_RETRACE);
1.132 + asic_wait(EVENT_RETRACE);
1.134 + asic_wait(EVENT_RETRACE);
1.136 + asic_wait(EVENT_RETRACE);