1.1 --- a/src/pvr2/pvr2.c Sat Jan 27 12:03:53 2007 +0000
1.2 +++ b/src/pvr2/pvr2.c Tue Feb 06 07:57:57 2007 +0000
1.5 - * $Id: pvr2.c,v 1.42 2007-01-27 12:03:53 nkeynes Exp $
1.6 + * $Id: pvr2.c,v 1.43 2007-01-28 11:36:00 nkeynes Exp $
1.8 * PVR2 (Video) Core module implementation and MMIO registers.
1.13 uint32_t odd_even_field; /* 1 = odd, 0 = even */
1.14 + gboolean palette_changed; /* TRUE if palette has changed since last render */
1.15 gchar *save_next_render_filename;
1.19 pvr2_state.timing = ntsc_timing;
1.20 pvr2_state.dot_clock = PVR2_DOT_CLOCK;
1.21 pvr2_state.back_porch_ns = 4000;
1.22 + pvr2_state.palette_changed = FALSE;
1.23 mmio_region_PVR2_write( DISP_TOTAL, 0x0270035F );
1.24 mmio_region_PVR2_write( DISP_SYNCTIME, 0x07D6A53F );
1.25 mmio_region_PVR2_write( YUV_ADDR, 0 );
1.27 if( pvr2_state.line_count >= pvr2_state.retrace_end_line &&
1.28 (old_line_count < pvr2_state.retrace_end_line ||
1.29 old_line_count > pvr2_state.line_count) ) {
1.30 + pvr2_state.frame_count++;
1.31 pvr2_display_frame();
1.34 @@ -259,8 +262,16 @@
1.36 buffer->rowstride = vid_ppl << 2;
1.37 display_addr = MMIO_READ( PVR2, DISP_ADDR1 );
1.38 - } else { /* Just display the field as is, folks */
1.39 - if( pvr2_state.odd_even_field ) {
1.41 + /* Just display the field as is, folks. This is slightly tricky -
1.42 + * we pick the field based on which frame is about to come through,
1.43 + * which may not be the same as the odd_even_field.
1.45 + gboolean oddfield = pvr2_state.odd_even_field;
1.46 + if( pvr2_state.line_count >= pvr2_state.retrace_start_line ) {
1.47 + oddfield = !oddfield;
1.50 display_addr = MMIO_READ( PVR2, DISP_ADDR1 );
1.52 display_addr = MMIO_READ( PVR2, DISP_ADDR2 );
1.54 display_driver->display_frame( buffer );
1.57 - pvr2_state.frame_count++;
1.61 @@ -362,14 +372,23 @@
1.64 MMIO_WRITE( PVR2, reg, val );
1.66 pvr2_update_raster_posn(sh4r.slice_cycle);
1.67 - if( pvr2_state.line_count >= pvr2_state.retrace_start_line ||
1.68 - pvr2_state.line_count < pvr2_state.retrace_end_line ) {
1.69 + fprintf( stderr, "Set Field 1 addr: %08X\n", val );
1.70 + if( (pvr2_state.line_count >= pvr2_state.retrace_start_line && !pvr2_state.odd_even_field) ||
1.71 + (pvr2_state.line_count < pvr2_state.retrace_end_line && pvr2_state.odd_even_field) ) {
1.72 pvr2_display_frame();
1.77 MMIO_WRITE( PVR2, reg, val&0x00FFFFFC );
1.78 + pvr2_update_raster_posn(sh4r.slice_cycle);
1.80 + if( (pvr2_state.line_count >= pvr2_state.retrace_start_line && pvr2_state.odd_even_field) ||
1.81 + (pvr2_state.line_count < pvr2_state.retrace_end_line && !pvr2_state.odd_even_field) ) {
1.82 + pvr2_display_frame();
1.86 MMIO_WRITE( PVR2, reg, val&0x3FFFFFFF );
1.87 @@ -669,7 +688,21 @@
1.91 -MMIO_REGION_DEFFNS( PVR2PAL )
1.92 +MMIO_REGION_WRITE_FN( PVR2PAL, reg, val )
1.94 + MMIO_WRITE( PVR2PAL, reg, val );
1.95 + pvr2_state.palette_changed = TRUE;
1.98 +void pvr2_check_palette_changed()
1.100 + if( pvr2_state.palette_changed ) {
1.101 + texcache_invalidate_palette();
1.102 + pvr2_state.palette_changed = FALSE;
1.106 +MMIO_REGION_READ_DEFFN( PVR2PAL );
1.108 void pvr2_set_base_address( uint32_t base )