Search
lxdream.org :: lxdream/src/pvr2/pvr2.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/pvr2/pvr2.c
changeset 100:995e42e96cc9
prev98:7b59bca968e9
next103:9b9cfc5855e0
author nkeynes
date Wed Feb 15 13:11:50 2006 +0000 (14 years ago)
permissions -rw-r--r--
last change Split pvr2.c out to separate files for TA and renderer, minor renames
change pvrdma to use mem_copy_to_sh4
file annotate diff log raw
1.1 --- a/src/pvr2/pvr2.c Wed Feb 15 12:40:20 2006 +0000
1.2 +++ b/src/pvr2/pvr2.c Wed Feb 15 13:11:50 2006 +0000
1.3 @@ -1,7 +1,7 @@
1.4 /**
1.5 - * $Id: pvr2.c,v 1.15 2006-02-15 12:40:20 nkeynes Exp $
1.6 + * $Id: pvr2.c,v 1.16 2006-02-15 13:11:46 nkeynes Exp $
1.7 *
1.8 - * PVR2 (Video) MMIO and supporting functions.
1.9 + * PVR2 (Video) Core MMIO registers.
1.10 *
1.11 * Copyright (c) 2005 Nathan Keynes.
1.12 *
1.13 @@ -107,7 +107,7 @@
1.14 buffer->colour_format );
1.15 }
1.16 if( MMIO_READ( PVR2, VIDCFG2 ) & 0x08 ) { /* Blanked */
1.17 - uint32_t colour = MMIO_READ( PVR2, BORDERCOL );
1.18 + uint32_t colour = MMIO_READ( PVR2, DISPBORDER );
1.19 video_driver->display_blank_frame( colour );
1.20 } else {
1.21 video_driver->display_frame( buffer );
1.22 @@ -135,6 +135,10 @@
1.23 MMIO_REGID(PVR2,reg), MMIO_REGDESC(PVR2,reg) );
1.24
1.25 switch(reg) {
1.26 + case TAINIT:
1.27 + if( val & 0x80000000 )
1.28 + pvr2_ta_init();
1.29 + break;
1.30 case RENDSTART:
1.31 if( val == 0xFFFFFFFF )
1.32 pvr2_render_scene();
1.33 @@ -161,84 +165,17 @@
1.34 }
1.35
1.36
1.37 -void pvr2_render_scene( void )
1.38 -{
1.39 - /* Actual rendering goes here :) */
1.40 - asic_event( EVENT_PVR_RENDER_DONE );
1.41 - DEBUG( "Rendered frame %d", pvr2_frame_counter );
1.42 -}
1.43
1.44 -/** Tile Accelerator */
1.45 -
1.46 -struct tacmd {
1.47 - uint32_t command;
1.48 - uint32_t param1;
1.49 - uint32_t param2;
1.50 - uint32_t texture;
1.51 - float alpha;
1.52 - float red;
1.53 - float green;
1.54 - float blue;
1.55 -};
1.56 -
1.57 -struct vertex_type1 {
1.58 - uint32_t command;
1.59 - float x, y, z;
1.60 - uint32_t blank, blank2;
1.61 - uint32_t col;
1.62 - float f;
1.63 -};
1.64
1.65 int32_t mmio_region_PVR2TA_read( uint32_t reg )
1.66 {
1.67 return 0xFFFFFFFF;
1.68 }
1.69
1.70 -char pvr2ta_remainder[8];
1.71 -
1.72 void mmio_region_PVR2TA_write( uint32_t reg, uint32_t val )
1.73 {
1.74 - DEBUG( "Direct write to TA %08X", val );
1.75 + pvr2_ta_write( &val, sizeof(uint32_t) );
1.76 }
1.77
1.78 -unsigned int pvr2_last_poly_type = 0;
1.79
1.80 -void pvr2ta_write( char *buf, uint32_t length )
1.81 -{
1.82 - int i;
1.83 - struct tacmd *cmd_list = (struct tacmd *)buf;
1.84 - int count = length >> 5;
1.85 - for( i=0; i<count; i++ ){
1.86 - unsigned int type = (cmd_list[i].command >> 24) & 0xFF;
1.87 - if( type == 0xE0 || type == 0xF0 ) {
1.88 - struct vertex_type1 *vert = (struct vertex_type1 *)&cmd_list[i];
1.89 - DEBUG( "PVR2 vrt: %f %f %f %08X %08X %08X %f", vert->x, vert->y, vert->z, vert->blank, vert->blank2, vert->col, vert->f );
1.90 - } else {
1.91 - DEBUG( "PVR2 cmd: %08X %08X %08X %08X %08X %08X %08X %08X", cmd_list[i].command, cmd_list[i].param1, cmd_list[i].param2, cmd_list[i].texture, cmd_list[i].alpha, cmd_list[i].red, cmd_list[i].green, cmd_list[i].blue );
1.92 - }
1.93 - if( type == 0 ) {
1.94 - /* End of list */
1.95 - switch( pvr2_last_poly_type ) {
1.96 - case 0x80: /* Opaque polys */
1.97 - asic_event( EVENT_PVR_OPAQUE_DONE );
1.98 - break;
1.99 - case 0x81: /* Opaque poly modifier */
1.100 - asic_event( EVENT_PVR_OPAQUEMOD_DONE );
1.101 - break;
1.102 - case 0x82: /* Transparent polys */
1.103 - asic_event( EVENT_PVR_TRANS_DONE );
1.104 - break;
1.105 - case 0x83: /* Transparent poly modifier */
1.106 - asic_event( EVENT_PVR_TRANSMOD_DONE );
1.107 - break;
1.108 - case 0x84: /* Punchthrough */
1.109 - asic_event( EVENT_PVR_PUNCHOUT_DONE );
1.110 - break;
1.111 - }
1.112 - pvr2_last_poly_type = 0;
1.113 - } else if( type >= 0x80 && type <= 0x84 ) {
1.114 - pvr2_last_poly_type = type;
1.115 - }
1.116 - }
1.117 -}
1.118
.