Search
lxdream.org :: lxdream/test/testyuv.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename test/testyuv.c
changeset 288:a42f998226fb
prev283:b1fbeaaff6bb
next561:533f6b478071
author nkeynes
date Mon Jan 15 10:41:30 2007 +0000 (13 years ago)
permissions -rw-r--r--
last change Fix various stupid rendering bugs
file annotate diff log raw
1.1 --- a/test/testyuv.c Mon Jan 15 08:30:50 2007 +0000
1.2 +++ b/test/testyuv.c Mon Jan 15 10:41:30 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
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.7 *
1.8 * Renderer test cases
1.9 *
1.10 @@ -27,11 +27,51 @@
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.19
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.26 +
1.27 +#define OBJCFG 0xA05F807C
1.28 +#define ISPCFG 0xA05F8098
1.29 +
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.33 +
1.34 +
1.35 +
1.36 +struct render_config default_render_config = { OBJ_START, TILEMAP_ADDR, RENDER_ADDR, 640, 480,
1.37 + 0x00000009, 0.0001f, 1.0f };
1.38 +
1.39 +
1.40 +struct backplane {
1.41 + uint32_t mode1, mode2, mode3;
1.42 + float x1, y1, z1;
1.43 + uint32_t col1;
1.44 + float x2, y2, z2;
1.45 + uint32_t col2;
1.46 + float x3, y3, z3;
1.47 + uint32_t col3;
1.48 +};
1.49 +
1.50 +
1.51 +#define START_BLEND 0
1.52 +#define BG_COLOUR 0xFF808080
1.53 +
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.58 +
1.59 struct yuv_poly {
1.60 uint32_t poly[8];
1.61 struct {
1.62 @@ -41,13 +81,16 @@
1.63 uint32_t pad;
1.64 } vertex[4];
1.65 uint32_t end[8];
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.77
1.78 +
1.79 +
1.80 +
1.81 int test_yuv( test_data_t test_case )
1.82 {
1.83 int i;
1.84 @@ -77,12 +120,53 @@
1.85 uint32_t timeus = timer_gettime_us();
1.86 uint32_t status2 = long_read( YUV_STATUS );
1.87
1.88 - /* Render the thing */
1.89 + struct ta_config *config = &default_ta_config;
1.90 +
1.91 + /* Send TA data */
1.92 + asic_clear();
1.93 + pvr_init();
1.94 + ta_init(config);
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.98 + return -1;
1.99 + }
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.105 return -1;
1.106 }
1.107
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.113 +
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.123 + return -1;
1.124 + }
1.125 +
1.126 + asic_clear();
1.127 + asic_wait( EVENT_RETRACE );
1.128 + display_render( &default_render_config );
1.129 + asic_clear();
1.130 + asic_wait(EVENT_RETRACE);
1.131 + asic_clear();
1.132 + asic_wait(EVENT_RETRACE);
1.133 + asic_clear();
1.134 + asic_wait(EVENT_RETRACE);
1.135 + asic_clear();
1.136 + asic_wait(EVENT_RETRACE);
1.137 return 0;
1.138 }
1.139
.