Search
lxdream.org :: lxdream/src/pvr2/pvr2.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/pvr2/pvr2.c
changeset 65:9f124c245fc6
prev56:3224dceaf2a3
next85:71e239d20c5d
author nkeynes
date Tue Jan 03 12:21:45 2006 +0000 (14 years ago)
permissions -rw-r--r--
last change Implement blanking (maybe, untested)
Quick hack to generate appropriate events on ta list completion
file annotate diff log raw
1.1 --- a/src/pvr2/pvr2.c Sun Jan 01 08:09:42 2006 +0000
1.2 +++ b/src/pvr2/pvr2.c Tue Jan 03 12:21:45 2006 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: pvr2.c,v 1.11 2006-01-01 08:09:42 nkeynes Exp $
1.6 + * $Id: pvr2.c,v 1.12 2006-01-03 12:21:45 nkeynes Exp $
1.7 *
1.8 * PVR2 (Video) MMIO and supporting functions.
1.9 *
1.10 @@ -93,8 +93,14 @@
1.11 bChanged = 0;
1.12 }
1.13 if( bEnabled ) {
1.14 - /* Assume bit depths match for now... */
1.15 - memcpy( video_data, frame_start, vid_size );
1.16 + if( MMIO_READ( PVR2, VIDCFG2 ) & 0x08 ) {
1.17 + /* Blanked */
1.18 + uint32_t colour = MMIO_READ( PVR2, BORDERCOL );
1.19 + video_fill( colour );
1.20 + } else {
1.21 + /* Assume bit depths match for now... */
1.22 + memcpy( video_data, frame_start, vid_size );
1.23 + }
1.24 } else {
1.25 memset( video_data, 0, vid_size );
1.26 }
1.27 @@ -116,13 +122,16 @@
1.28 MMIO_REGID(PVR2,reg), MMIO_REGDESC(PVR2,reg) );
1.29
1.30 switch(reg) {
1.31 - case DISPSIZE: bChanged = 1;
1.32 - case DISPMODE: bChanged = 1;
1.33 - case DISPADDR1: bChanged = 1;
1.34 - case DISPADDR2: bChanged = 1;
1.35 - case VIDCFG: bChanged = 1;
1.36 - break;
1.37 -
1.38 + case DISPSIZE: bChanged = 1;
1.39 + case DISPMODE: bChanged = 1;
1.40 + case DISPADDR1: bChanged = 1;
1.41 + case DISPADDR2: bChanged = 1;
1.42 + case VIDCFG: bChanged = 1;
1.43 + break;
1.44 + case RENDSTART:
1.45 + if( val == 0xFFFFFFFF )
1.46 + pvr2_render_scene();
1.47 + break;
1.48 }
1.49 MMIO_WRITE( PVR2, reg, val );
1.50 }
1.51 @@ -143,6 +152,26 @@
1.52 }
1.53
1.54
1.55 +void pvr2_render_scene( void )
1.56 +{
1.57 + /* Actual rendering goes here :) */
1.58 + asic_event( EVENT_PVR_RENDER_DONE );
1.59 + DEBUG( "Rendered frame %d", video_frame_count );
1.60 +}
1.61 +
1.62 +/** Tile Accelerator */
1.63 +
1.64 +struct tacmd {
1.65 + uint32_t command;
1.66 + uint32_t param1;
1.67 + uint32_t param2;
1.68 + uint32_t texture;
1.69 + float alpha;
1.70 + float red;
1.71 + float green;
1.72 + float blue;
1.73 +};
1.74 +
1.75 int32_t mmio_region_PVR2TA_read( uint32_t reg )
1.76 {
1.77 return 0xFFFFFFFF;
1.78 @@ -152,10 +181,40 @@
1.79
1.80 void mmio_region_PVR2TA_write( uint32_t reg, uint32_t val )
1.81 {
1.82 -
1.83 + DEBUG( "Direct write to TA %08X", val );
1.84 }
1.85
1.86 void pvr2ta_write( char *buf, uint32_t length )
1.87 {
1.88 -
1.89 + int i;
1.90 + struct tacmd *cmd_list = (struct tacmd *)buf;
1.91 + int count = length >> 5;
1.92 + unsigned int lasttype = 0;
1.93 + for( i=0; i<count; i++ ){
1.94 + unsigned int type = (cmd_list[i].command >> 24) & 0xFF;
1.95 + DEBUG( "PVR2 cmd: %08X %08X %08X", cmd_list[i].command, cmd_list[i].param1, cmd_list[i].param2 );
1.96 + if( type == 0 ) {
1.97 + /* End of list */
1.98 + switch( lasttype ) {
1.99 + case 0x80: /* Opaque polys */
1.100 + asic_event( EVENT_PVR_OPAQUE_DONE );
1.101 + break;
1.102 + case 0x81: /* Opaque poly modifier */
1.103 + asic_event( EVENT_PVR_OPAQUEMOD_DONE );
1.104 + break;
1.105 + case 0x82: /* Transparent polys */
1.106 + asic_event( EVENT_PVR_TRANS_DONE );
1.107 + break;
1.108 + case 0x83: /* Transparent poly modifier */
1.109 + asic_event( EVENT_PVR_TRANSMOD_DONE );
1.110 + break;
1.111 + case 0x84: /* Punchthrough */
1.112 + asic_event( EVENT_PVR_PUNCHOUT_DONE );
1.113 + break;
1.114 + }
1.115 + } else {
1.116 + lasttype = type;
1.117 + }
1.118 + }
1.119 }
1.120 +
.