Search
lxdream.org :: lxdream/src/pvr2/pvr2.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/pvr2/pvr2.c
changeset 161:408b9210395f
prev159:406161fea392
next189:615b70cfd729
author nkeynes
date Sun Jun 18 11:57:05 2006 +0000 (14 years ago)
permissions -rw-r--r--
last change Implement render buffer invalidation
file annotate diff log raw
1.1 --- a/src/pvr2/pvr2.c Thu Jun 15 10:33:08 2006 +0000
1.2 +++ b/src/pvr2/pvr2.c Sun Jun 18 11:57:05 2006 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: pvr2.c,v 1.26 2006-06-15 10:33:08 nkeynes Exp $
1.6 + * $Id: pvr2.c,v 1.27 2006-06-18 11:57:05 nkeynes Exp $
1.7 *
1.8 * PVR2 (Video) Core module implementation and MMIO registers.
1.9 *
1.10 @@ -36,6 +36,8 @@
1.11
1.12 void pvr2_display_frame( void );
1.13
1.14 +int colour_format_bytes[] = { 2, 2, 2, 1, 3, 4, 1, 1 };
1.15 +
1.16 struct dreamcast_module pvr2_module = { "PVR2", pvr2_init, pvr2_reset, NULL,
1.17 pvr2_run_slice, NULL,
1.18 pvr2_save_state, pvr2_load_state };
1.19 @@ -155,50 +157,51 @@
1.20 int vid_ppl = ((dispsize & DISPSIZE_PPL)) + 1;
1.21 gboolean bEnabled = (dispmode & DISPMODE_DE) && (vidcfg & DISPCFG_VO ) ? TRUE : FALSE;
1.22 gboolean interlaced = (vidcfg & DISPCFG_I ? TRUE : FALSE);
1.23 - if( bEnabled ) {
1.24 - video_buffer_t buffer = &video_buffer[video_buffer_idx];
1.25 - video_buffer_idx = !video_buffer_idx;
1.26 - video_buffer_t last = &video_buffer[video_buffer_idx];
1.27 - buffer->rowstride = (vid_ppl + vid_stride) << 2;
1.28 - buffer->data = video_base + MMIO_READ( PVR2, DISPADDR1 );
1.29 - buffer->vres = vid_lpf;
1.30 - if( interlaced ) buffer->vres <<= 1;
1.31 - switch( (dispmode & DISPMODE_COL) >> 2 ) {
1.32 - case 0:
1.33 - buffer->colour_format = COLFMT_ARGB1555;
1.34 - buffer->hres = vid_ppl << 1;
1.35 - break;
1.36 - case 1:
1.37 - buffer->colour_format = COLFMT_RGB565;
1.38 - buffer->hres = vid_ppl << 1;
1.39 - break;
1.40 - case 2:
1.41 - buffer->colour_format = COLFMT_RGB888;
1.42 - buffer->hres = (vid_ppl << 2) / 3;
1.43 - break;
1.44 - case 3:
1.45 - buffer->colour_format = COLFMT_ARGB8888;
1.46 - buffer->hres = vid_ppl;
1.47 - break;
1.48 + video_buffer_t buffer = &video_buffer[video_buffer_idx];
1.49 + video_buffer_idx = !video_buffer_idx;
1.50 + video_buffer_t last = &video_buffer[video_buffer_idx];
1.51 + buffer->rowstride = (vid_ppl + vid_stride) << 2;
1.52 + buffer->data = video_base + MMIO_READ( PVR2, DISPADDR1 );
1.53 + buffer->vres = vid_lpf;
1.54 + if( interlaced ) buffer->vres <<= 1;
1.55 + switch( (dispmode & DISPMODE_COL) >> 2 ) {
1.56 + case 0:
1.57 + buffer->colour_format = COLFMT_ARGB1555;
1.58 + buffer->hres = vid_ppl << 1;
1.59 + break;
1.60 + case 1:
1.61 + buffer->colour_format = COLFMT_RGB565;
1.62 + buffer->hres = vid_ppl << 1;
1.63 + break;
1.64 + case 2:
1.65 + buffer->colour_format = COLFMT_RGB888;
1.66 + buffer->hres = (vid_ppl << 2) / 3;
1.67 + break;
1.68 + case 3:
1.69 + buffer->colour_format = COLFMT_ARGB8888;
1.70 + buffer->hres = vid_ppl;
1.71 + break;
1.72 + }
1.73 +
1.74 + if( buffer->hres <=8 )
1.75 + buffer->hres = 640;
1.76 + if( buffer->vres <=8 )
1.77 + buffer->vres = 480;
1.78 + if( display_driver != NULL ) {
1.79 + if( buffer->hres != last->hres ||
1.80 + buffer->vres != last->vres ||
1.81 + buffer->colour_format != last->colour_format) {
1.82 + display_driver->set_display_format( buffer->hres, buffer->vres,
1.83 + buffer->colour_format );
1.84 }
1.85 -
1.86 - if( display_driver != NULL ) {
1.87 - if( buffer->hres != last->hres ||
1.88 - buffer->vres != last->vres ||
1.89 - buffer->colour_format != last->colour_format) {
1.90 - display_driver->set_display_format( buffer->hres, buffer->vres,
1.91 - buffer->colour_format );
1.92 - }
1.93 - if( MMIO_READ( PVR2, DISPCFG2 ) & 0x08 ) { /* Blanked */
1.94 - uint32_t colour = MMIO_READ( PVR2, DISPBORDER );
1.95 - display_driver->display_blank_frame( colour );
1.96 - } else if( !pvr2_render_display_frame( PVR2_RAM_BASE + display_addr ) ) {
1.97 - display_driver->display_frame( buffer );
1.98 - }
1.99 + if( !bEnabled ) {
1.100 + display_driver->display_blank_frame( 0 );
1.101 + } else if( MMIO_READ( PVR2, DISPCFG2 ) & 0x08 ) { /* Blanked */
1.102 + uint32_t colour = MMIO_READ( PVR2, DISPBORDER );
1.103 + display_driver->display_blank_frame( colour );
1.104 + } else if( !pvr2_render_display_frame( PVR2_RAM_BASE + display_addr ) ) {
1.105 + display_driver->display_frame( buffer );
1.106 }
1.107 - } else {
1.108 - video_buffer_idx = 0;
1.109 - video_buffer[0].hres = video_buffer[0].vres = 0;
1.110 }
1.111 pvr2_state.frame_count++;
1.112 }
.