revision 274:4e8f1e988d80
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 274:4e8f1e988d80 |
parent | 273:48eb3304a41e |
child | 275:005945dbb813 |
author | nkeynes |
date | Thu Jan 11 12:14:57 2007 +0000 (17 years ago) |
Fix scheduling of scanlines between even and odd frames
src/pvr2/pvr2.c | view | annotate | diff | log |
1.1 --- a/src/pvr2/pvr2.c Thu Jan 11 12:14:11 2007 +00001.2 +++ b/src/pvr2/pvr2.c Thu Jan 11 12:14:57 2007 +00001.3 @@ -1,5 +1,5 @@1.4 /**1.5 - * $Id: pvr2.c,v 1.36 2007-01-11 06:50:11 nkeynes Exp $1.6 + * $Id: pvr2.c,v 1.37 2007-01-11 12:14:57 nkeynes Exp $1.7 *1.8 * PVR2 (Video) Core module implementation and MMIO registers.1.9 *1.10 @@ -37,7 +37,7 @@1.11 static int pvr2_load_state( FILE *f );1.12 static void pvr2_update_raster_posn( uint32_t nanosecs );1.13 static void pvr2_schedule_line_event( int eventid, int line );1.14 -static void pvr2_schedule_scanline_event( int eventid, int line );1.15 +static void pvr2_schedule_scanline_event( int eventid, int line, int minimum_lines );1.16 uint32_t pvr2_get_sync_status();1.18 void pvr2_display_frame( void );1.19 @@ -105,9 +105,9 @@1.20 asic_event( eventid );1.21 pvr2_update_raster_posn(sh4r.slice_cycle);1.22 if( eventid == EVENT_SCANLINE1 ) {1.23 - pvr2_schedule_scanline_event( eventid, pvr2_state.irq_vpos1 );1.24 + pvr2_schedule_scanline_event( eventid, pvr2_state.irq_vpos1, 1 );1.25 } else {1.26 - pvr2_schedule_scanline_event( eventid, pvr2_state.irq_vpos2 );1.27 + pvr2_schedule_scanline_event( eventid, pvr2_state.irq_vpos2, 1 );1.28 }1.29 }1.31 @@ -341,8 +341,8 @@1.32 pvr2_state.irq_vpos1 = (val >> 16);1.33 pvr2_state.irq_vpos2 = val & 0x03FF;1.34 pvr2_update_raster_posn(sh4r.slice_cycle);1.35 - pvr2_schedule_scanline_event( EVENT_SCANLINE1, pvr2_state.irq_vpos1 );1.36 - pvr2_schedule_scanline_event( EVENT_SCANLINE2, pvr2_state.irq_vpos2 );1.37 + pvr2_schedule_scanline_event( EVENT_SCANLINE1, pvr2_state.irq_vpos1, 0 );1.38 + pvr2_schedule_scanline_event( EVENT_SCANLINE2, pvr2_state.irq_vpos2, 0 );1.39 MMIO_WRITE( PVR2, reg, val );1.40 break;1.41 case RENDER_NEARCLIP:1.42 @@ -408,8 +408,8 @@1.43 pvr2_state.retrace_end_line = 0x2A;1.44 pvr2_state.retrace_start_line = pvr2_state.total_lines - 6;1.45 pvr2_schedule_line_event( EVENT_RETRACE, 0 );1.46 - pvr2_schedule_scanline_event( EVENT_SCANLINE1, pvr2_state.irq_vpos1 );1.47 - pvr2_schedule_scanline_event( EVENT_SCANLINE2, pvr2_state.irq_vpos2 );1.48 + pvr2_schedule_scanline_event( EVENT_SCANLINE1, pvr2_state.irq_vpos1, 0 );1.49 + pvr2_schedule_scanline_event( EVENT_SCANLINE2, pvr2_state.irq_vpos2, 0 );1.50 break;1.51 case DISP_SYNCCFG:1.52 MMIO_WRITE( PVR2, reg, val&0x000003FF );1.53 @@ -575,7 +575,7 @@1.54 * The raster position should be updated before calling this1.55 * method.1.56 */1.57 -static void pvr2_schedule_scanline_event( int eventid, int line )1.58 +static void pvr2_schedule_scanline_event( int eventid, int line, int minimum_lines )1.59 {1.60 uint32_t field = pvr2_state.odd_even_field;1.61 if( line <= pvr2_state.line_count && pvr2_state.interlaced ) {1.62 @@ -586,7 +586,23 @@1.63 if( field ) {1.64 line += 1;1.65 }1.66 - pvr2_schedule_line_event( eventid, line );1.67 +1.68 + if( line < pvr2_state.total_lines ) {1.69 + uint32_t lines;1.70 + uint32_t time;1.71 + if( line <= pvr2_state.line_count ) {1.72 + lines = (pvr2_state.total_lines - pvr2_state.line_count + line);1.73 + } else {1.74 + lines = (line - pvr2_state.line_count);1.75 + }1.76 + if( lines <= minimum_lines ) {1.77 + lines += pvr2_state.total_lines;1.78 + }1.79 + time = (lines * pvr2_state.line_time_ns) - pvr2_state.line_remainder;1.80 + event_schedule( eventid, time );1.81 + } else {1.82 + event_cancel( eventid );1.83 + }1.84 }1.86 MMIO_REGION_READ_FN( PVR2, reg )
.