Search
lxdream.org :: lxdream :: r65:9f124c245fc6
lxdream 0.9.1
released Jun 29
Download Now
changeset65:9f124c245fc6
parent64:f8864188e83f
child66:2ec5b6eb75e5
authornkeynes
dateTue Jan 03 12:21:45 2006 +0000 (14 years ago)
Implement blanking (maybe, untested)
Quick hack to generate appropriate events on ta list completion
src/asic.h
src/pvr2/pvr2.c
src/pvr2/pvr2.h
src/video.c
src/video.h
1.1 --- a/src/asic.h Tue Jan 03 12:20:36 2006 +0000
1.2 +++ b/src/asic.h Tue Jan 03 12:21:45 2006 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: asic.h,v 1.4 2006-01-01 08:09:42 nkeynes Exp $
1.6 + * $Id: asic.h,v 1.5 2006-01-03 12:21:45 nkeynes Exp $
1.7 *
1.8 * Support for the miscellaneous ASIC functions (Primarily event multiplexing,
1.9 * and DMA). Includes MMIO definitions for the 5f6000 and 5f7000 regions,
1.10 @@ -169,10 +169,11 @@
1.11 #define EVENT_SCANLINE1 3
1.12 #define EVENT_SCANLINE2 4
1.13 #define EVENT_RETRACE 5
1.14 +#define EVENT_PVR_UNK 6
1.15 #define EVENT_PVR_OPAQUE_DONE 7
1.16 #define EVENT_PVR_OPAQUEMOD_DONE 8
1.17 #define EVENT_PVR_TRANS_DONE 9
1.18 -#define EVENT_PVR_TRANSMODE_DONE 10
1.19 +#define EVENT_PVR_TRANSMOD_DONE 10
1.20 #define EVENT_MAPLE_DMA 12
1.21 #define EVENT_MAPLE_ERR 13 /* ??? */
1.22 #define EVENT_GDROM_DMA 14
2.1 --- a/src/pvr2/pvr2.c Tue Jan 03 12:20:36 2006 +0000
2.2 +++ b/src/pvr2/pvr2.c Tue Jan 03 12:21:45 2006 +0000
2.3 @@ -1,5 +1,5 @@
2.4 /**
2.5 - * $Id: pvr2.c,v 1.11 2006-01-01 08:09:42 nkeynes Exp $
2.6 + * $Id: pvr2.c,v 1.12 2006-01-03 12:21:45 nkeynes Exp $
2.7 *
2.8 * PVR2 (Video) MMIO and supporting functions.
2.9 *
2.10 @@ -93,8 +93,14 @@
2.11 bChanged = 0;
2.12 }
2.13 if( bEnabled ) {
2.14 - /* Assume bit depths match for now... */
2.15 - memcpy( video_data, frame_start, vid_size );
2.16 + if( MMIO_READ( PVR2, VIDCFG2 ) & 0x08 ) {
2.17 + /* Blanked */
2.18 + uint32_t colour = MMIO_READ( PVR2, BORDERCOL );
2.19 + video_fill( colour );
2.20 + } else {
2.21 + /* Assume bit depths match for now... */
2.22 + memcpy( video_data, frame_start, vid_size );
2.23 + }
2.24 } else {
2.25 memset( video_data, 0, vid_size );
2.26 }
2.27 @@ -116,13 +122,16 @@
2.28 MMIO_REGID(PVR2,reg), MMIO_REGDESC(PVR2,reg) );
2.29
2.30 switch(reg) {
2.31 - case DISPSIZE: bChanged = 1;
2.32 - case DISPMODE: bChanged = 1;
2.33 - case DISPADDR1: bChanged = 1;
2.34 - case DISPADDR2: bChanged = 1;
2.35 - case VIDCFG: bChanged = 1;
2.36 - break;
2.37 -
2.38 + case DISPSIZE: bChanged = 1;
2.39 + case DISPMODE: bChanged = 1;
2.40 + case DISPADDR1: bChanged = 1;
2.41 + case DISPADDR2: bChanged = 1;
2.42 + case VIDCFG: bChanged = 1;
2.43 + break;
2.44 + case RENDSTART:
2.45 + if( val == 0xFFFFFFFF )
2.46 + pvr2_render_scene();
2.47 + break;
2.48 }
2.49 MMIO_WRITE( PVR2, reg, val );
2.50 }
2.51 @@ -143,6 +152,26 @@
2.52 }
2.53
2.54
2.55 +void pvr2_render_scene( void )
2.56 +{
2.57 + /* Actual rendering goes here :) */
2.58 + asic_event( EVENT_PVR_RENDER_DONE );
2.59 + DEBUG( "Rendered frame %d", video_frame_count );
2.60 +}
2.61 +
2.62 +/** Tile Accelerator */
2.63 +
2.64 +struct tacmd {
2.65 + uint32_t command;
2.66 + uint32_t param1;
2.67 + uint32_t param2;
2.68 + uint32_t texture;
2.69 + float alpha;
2.70 + float red;
2.71 + float green;
2.72 + float blue;
2.73 +};
2.74 +
2.75 int32_t mmio_region_PVR2TA_read( uint32_t reg )
2.76 {
2.77 return 0xFFFFFFFF;
2.78 @@ -152,10 +181,40 @@
2.79
2.80 void mmio_region_PVR2TA_write( uint32_t reg, uint32_t val )
2.81 {
2.82 -
2.83 + DEBUG( "Direct write to TA %08X", val );
2.84 }
2.85
2.86 void pvr2ta_write( char *buf, uint32_t length )
2.87 {
2.88 -
2.89 + int i;
2.90 + struct tacmd *cmd_list = (struct tacmd *)buf;
2.91 + int count = length >> 5;
2.92 + unsigned int lasttype = 0;
2.93 + for( i=0; i<count; i++ ){
2.94 + unsigned int type = (cmd_list[i].command >> 24) & 0xFF;
2.95 + DEBUG( "PVR2 cmd: %08X %08X %08X", cmd_list[i].command, cmd_list[i].param1, cmd_list[i].param2 );
2.96 + if( type == 0 ) {
2.97 + /* End of list */
2.98 + switch( lasttype ) {
2.99 + case 0x80: /* Opaque polys */
2.100 + asic_event( EVENT_PVR_OPAQUE_DONE );
2.101 + break;
2.102 + case 0x81: /* Opaque poly modifier */
2.103 + asic_event( EVENT_PVR_OPAQUEMOD_DONE );
2.104 + break;
2.105 + case 0x82: /* Transparent polys */
2.106 + asic_event( EVENT_PVR_TRANS_DONE );
2.107 + break;
2.108 + case 0x83: /* Transparent poly modifier */
2.109 + asic_event( EVENT_PVR_TRANSMOD_DONE );
2.110 + break;
2.111 + case 0x84: /* Punchthrough */
2.112 + asic_event( EVENT_PVR_PUNCHOUT_DONE );
2.113 + break;
2.114 + }
2.115 + } else {
2.116 + lasttype = type;
2.117 + }
2.118 + }
2.119 }
2.120 +
3.1 --- a/src/pvr2/pvr2.h Tue Jan 03 12:20:36 2006 +0000
3.2 +++ b/src/pvr2/pvr2.h Tue Jan 03 12:21:45 2006 +0000
3.3 @@ -1,5 +1,5 @@
3.4 /**
3.5 - * $Id: pvr2.h,v 1.4 2006-01-01 08:09:42 nkeynes Exp $
3.6 + * $Id: pvr2.h,v 1.5 2006-01-03 12:21:45 nkeynes Exp $
3.7 *
3.8 * PVR2 (video chip) MMIO registers and functions.
3.9 *
3.10 @@ -22,10 +22,10 @@
3.11 LONG_PORT( 0x000, PVRID, PORT_MR, 0x17FD11DB, "PVR2 Core ID" )
3.12 LONG_PORT( 0x004, PVRVER, PORT_MR, 0x00000011, "PVR2 Core Version" )
3.13 LONG_PORT( 0x008, PVRRST, PORT_MR, 0, "PVR2 Reset" )
3.14 - LONG_PORT( 0x014, RENDST, PORT_W, 0, "Start render" )
3.15 + LONG_PORT( 0x014, RENDSTART, PORT_W, 0, "Start render" )
3.16 LONG_PORT( 0x020, OBJBASE, PORT_MRW, 0, "Object buffer base offset" )
3.17 LONG_PORT( 0x02C, TILEBASE, PORT_MRW, 0, "Tile buffer base offset" )
3.18 - LONG_PORT( 0x040, PVRBCOL, PORT_MRW, 0, "Border Colour (RGB)" )
3.19 + LONG_PORT( 0x040, BORDERCOL, PORT_MRW, 0, "Border Colour (RGB)" )
3.20 LONG_PORT( 0x044, DISPMODE, PORT_MRW, 0, "Display Mode" )
3.21 LONG_PORT( 0x048, RENDMODE, PORT_MRW, 0, "Rendering Mode" )
3.22 LONG_PORT( 0x04C, RENDSIZE, PORT_MRW, 0, "Rendering width (bytes/2)" )
4.1 --- a/src/video.c Tue Jan 03 12:20:36 2006 +0000
4.2 +++ b/src/video.c Tue Jan 03 12:21:45 2006 +0000
4.3 @@ -1,5 +1,5 @@
4.4 /**
4.5 - * $Id: video.c,v 1.2 2005-12-25 08:24:07 nkeynes Exp $
4.6 + * $Id: video.c,v 1.3 2006-01-03 12:21:45 nkeynes Exp $
4.7 *
4.8 * The PC side of the video support (responsible for actually displaying /
4.9 * rendering frames)
4.10 @@ -18,11 +18,15 @@
4.11 */
4.12
4.13 #include <gnome.h>
4.14 +#include <stdint.h>
4.15
4.16 GdkImage *img;
4.17 GtkWindow *video_win;
4.18 GtkWidget *video_area;
4.19 char *video_data;
4.20 +uint32_t video_width = 640;
4.21 +uint32_t video_height = 480;
4.22 +uint32_t video_frame_count = 0;
4.23
4.24 void video_open( void )
4.25 {
4.26 @@ -41,8 +45,23 @@
4.27 gtk_widget_show( GTK_WIDGET(video_win) );
4.28 }
4.29
4.30 +/**
4.31 + * Fill the entire frame with the specified colour (00RRGGBB)
4.32 + */
4.33 +void video_fill( uint32_t colour )
4.34 +{
4.35 + char *p = video_data;
4.36 + int i;
4.37 + for( i=0; i<video_width*video_height; i++ ) {
4.38 + *p++ = (colour>>16) & 0xFF;
4.39 + *p++ = (colour>>8) & 0xFF;
4.40 + *p++ = (colour) & 0xFF;
4.41 + }
4.42 +}
4.43 +
4.44 void video_update_frame( void )
4.45 {
4.46 + video_frame_count++;
4.47 gtk_widget_queue_draw( video_area );
4.48 }
4.49
5.1 --- a/src/video.h Tue Jan 03 12:20:36 2006 +0000
5.2 +++ b/src/video.h Tue Jan 03 12:21:45 2006 +0000
5.3 @@ -1,5 +1,5 @@
5.4 /**
5.5 - * $Id: video.h,v 1.2 2005-12-25 08:24:07 nkeynes Exp $
5.6 + * $Id: video.h,v 1.3 2006-01-03 12:21:45 nkeynes Exp $
5.7 *
5.8 * The PC side of the video support (responsible for actually displaying /
5.9 * rendering frames)
5.10 @@ -31,6 +31,7 @@
5.11 void video_update_size( int, int, int );
5.12
5.13 extern char *video_data;
5.14 +extern uint32_t video_frame_count;
5.15
5.16 #ifdef __cplusplus
5.17 }
.