Search
lxdream.org :: lxdream/test/pvr.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename test/pvr.c
changeset 190:f7653df5e832
prev185:6755a04c447f
next213:da6b1904f67b
author nkeynes
date Sun Aug 06 06:13:51 2006 +0000 (17 years ago)
permissions -rw-r--r--
last change First pass at implementing the tile clip. Reasonably accurate wrt basic
understanding of how its supposed to work, not so accurate wrt actual
hardware behaviour
file annotate diff log raw
1.1 --- a/test/pvr.c Tue Jul 11 01:35:27 2006 +0000
1.2 +++ b/test/pvr.c Sun Aug 06 06:13:51 2006 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: pvr.c,v 1.1 2006-07-11 01:35:23 nkeynes Exp $
1.6 + * $Id: pvr.c,v 1.2 2006-08-02 04:13:15 nkeynes Exp $
1.7 *
1.8 * PVR support code
1.9 *
1.10 @@ -33,30 +33,6 @@
1.11 #define TA_PLISTSTART (PVR_BASE+0x164)
1.12
1.13
1.14 -
1.15 -void ta_init( unsigned int hres, unsigned int vres,
1.16 - unsigned int polybuf, unsigned int polybuflen,
1.17 - unsigned int tilebuf, unsigned int tilebuflen )
1.18 -{
1.19 - unsigned int hsegs = ((hres+31) / 32)-1;
1.20 - unsigned int vsegs = ((vres+31) / 32)-1;
1.21 - unsigned int size = (vsegs<<16)|hsegs;
1.22 -
1.23 - fprintf(stderr, "Setting tilemap: %08X\n", size);
1.24 -
1.25 - long_write( PVR_RESET, 1 );
1.26 - long_write( PVR_RESET, 0 );
1.27 -
1.28 - long_write( TA_SIZE, size );
1.29 - long_write( TA_OBJSTART, polybuf & 0x00FFFFFF );
1.30 - long_write( TA_OBJEND, (polybuf + polybuflen) & 0x00FFFFFF );
1.31 - long_write( TA_TILESTART, (tilebuf + tilebuflen) & 0x00FFFFFF );
1.32 - long_write( TA_TILEEND, tilebuf & 0x00FFFFFF );
1.33 - long_write( TA_PLISTSTART, (tilebuf + tilebuflen) & 0x00FFFFFF );
1.34 - long_write( TA_TILECFG, 0x00100002 );
1.35 - long_write( TA_INIT, 0x80000000 );
1.36 -}
1.37 -
1.38 void ta_dump_regs( FILE *f )
1.39 {
1.40 fprintf( stderr, "TA Object start[128]: %08X posn[138]: %08X end[130]: %08X\n",
1.41 @@ -67,11 +43,33 @@
1.42 fprintf( stderr, "TA Tilesize: %08X config: %08X\n", long_read(TA_SIZE), long_read(TA_TILECFG) );
1.43 }
1.44
1.45 +
1.46 +void ta_init( struct ta_config *config )
1.47 +{
1.48 + long_write( PVR_RESET, 1 );
1.49 + long_write( PVR_RESET, 0 );
1.50 +
1.51 + long_write( TA_SIZE, config->grid_size );
1.52 + long_write( TA_OBJSTART, config->obj_start & 0x00FFFFFF );
1.53 + long_write( TA_OBJEND, config->obj_end & 0x00FFFFFF );
1.54 + long_write( TA_TILESTART, config->tile_start & 0x00FFFFFF );
1.55 + long_write( TA_TILEEND, config->tile_end & 0x00FFFFFF );
1.56 + long_write( TA_PLISTSTART, config->plist_start & 0x00FFFFFF );
1.57 + long_write( TA_TILECFG, config->ta_cfg );
1.58 + long_write( TA_INIT, 0x80000000 );
1.59 +}
1.60 +
1.61 int pvr_get_objbuf_size( )
1.62 {
1.63 return long_read( TA_OBJPOSN ) - long_read( TA_OBJSTART );
1.64 }
1.65
1.66 +int pvr_get_plist_posn( )
1.67 +{
1.68 + unsigned int addr = long_read( TA_TILEPOSN ) << 2;
1.69 + return addr;
1.70 +}
1.71 +
1.72 void pvr_dump_objbuf( FILE *f )
1.73 {
1.74 unsigned int start = long_read( TA_OBJSTART );
.