Search
lxdream.org :: lxdream :: r333:e29561c998f5
lxdream 0.9.1
released Jun 29
Download Now
changeset333:e29561c998f5
parent332:4c1b31e646ef
child334:59073f812bd3
authornkeynes
dateSat Jan 27 06:21:35 2007 +0000 (12 years ago)
Start working towards scaler implementation - fixes overrun issue
src/pvr2/pvr2.h
src/pvr2/pvr2mem.c
src/pvr2/pvr2mmio.h
src/pvr2/render.c
1.1 --- a/src/pvr2/pvr2.h Fri Jan 26 02:08:19 2007 +0000
1.2 +++ b/src/pvr2/pvr2.h Sat Jan 27 06:21:35 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: pvr2.h,v 1.29 2007-01-25 11:46:35 nkeynes Exp $
1.6 + * $Id: pvr2.h,v 1.30 2007-01-27 06:21:35 nkeynes Exp $
1.7 *
1.8 * PVR2 (video chip) functions and macros.
1.9 *
1.10 @@ -177,6 +177,7 @@
1.11 uint32_t size; /* Length of rendering region in bytes */
1.12 int width, height;
1.13 int colour_format;
1.14 + int scale;
1.15 } *pvr2_render_buffer_t;
1.16
1.17 /**
2.1 --- a/src/pvr2/pvr2mem.c Fri Jan 26 02:08:19 2007 +0000
2.2 +++ b/src/pvr2/pvr2mem.c Sat Jan 27 06:21:35 2007 +0000
2.3 @@ -1,5 +1,5 @@
2.4 /**
2.5 - * $Id: pvr2mem.c,v 1.7 2007-01-25 11:46:35 nkeynes Exp $
2.6 + * $Id: pvr2mem.c,v 1.8 2007-01-27 06:21:35 nkeynes Exp $
2.7 *
2.8 * PVR2 (Video) VRAM handling routines (mainly for the 64-bit region)
2.9 *
2.10 @@ -420,13 +420,14 @@
2.11 }
2.12 }
2.13
2.14 -void pvr2_vram_write_invert( sh4addr_t destaddr, char *src, uint32_t length, uint32_t line_length )
2.15 +void pvr2_vram_write_invert( sh4addr_t destaddr, char *src, uint32_t length, uint32_t line_length,
2.16 + uint32_t src_stride )
2.17 {
2.18 char *dest = video_base + (destaddr & 0x007FFFFF);
2.19 - char *p = src + length - line_length;
2.20 + char *p = src + length - src_stride;
2.21 while( p >= src ) {
2.22 memcpy( dest, p, line_length );
2.23 - p -= line_length;
2.24 + p -= src_stride;
2.25 dest += line_length;
2.26 }
2.27 }
2.28 @@ -541,7 +542,11 @@
2.29 /* Regular buffer */
2.30 char target[size];
2.31 glReadPixels( 0, 0, buffer->width, buffer->height, format, type, target );
2.32 - pvr2_vram_write_invert( buffer->render_addr, target, size, line_size );
2.33 + if( (buffer->scale & 0xFFFF) == 0x0800 ) {
2.34 + pvr2_vram_write_invert( buffer->render_addr, target, size, line_size, line_size << 1 );
2.35 + } else {
2.36 + pvr2_vram_write_invert( buffer->render_addr, target, size, line_size, line_size );
2.37 + }
2.38 }
2.39 }
2.40
3.1 --- a/src/pvr2/pvr2mmio.h Fri Jan 26 02:08:19 2007 +0000
3.2 +++ b/src/pvr2/pvr2mmio.h Sat Jan 27 06:21:35 2007 +0000
3.3 @@ -1,5 +1,5 @@
3.4 /**
3.5 - * $Id: pvr2mmio.h,v 1.8 2007-01-03 09:01:51 nkeynes Exp $
3.6 + * $Id: pvr2mmio.h,v 1.9 2007-01-27 06:21:35 nkeynes Exp $
3.7 *
3.8 * PVR2 (video chip) MMIO register definitions.
3.9 *
3.10 @@ -66,7 +66,7 @@
3.11 LONG_PORT( 0x0E8, DISP_CFG2, PORT_MRW, 0, "Video configuration 2" )
3.12 LONG_PORT( 0x0EC, DISP_HPOS, PORT_MRW, 0, "Horizontal display position" )
3.13 LONG_PORT( 0x0F0, DISP_VPOS, PORT_MRW, 0, "Vertical display position" )
3.14 - LONG_PORT( 0x0F4, SCALERCFG, PORT_MRW, 0, "Scaler configuration (?)" )
3.15 + LONG_PORT( 0x0F4, RENDER_SCALER, PORT_MRW, 0, "Scaler configuration (?)" )
3.16 LONG_PORT( 0x108, RENDER_PALETTE, PORT_MRW, 0, "Palette configuration" )
3.17 LONG_PORT( 0x10C, DISP_SYNCSTAT, PORT_R, 0, "Raster beam position" )
3.18 LONG_PORT( 0x110, PVRUNK3, PORT_MRW, 0, "PVR2 unknown register 3" )
4.1 --- a/src/pvr2/render.c Fri Jan 26 02:08:19 2007 +0000
4.2 +++ b/src/pvr2/render.c Sat Jan 27 06:21:35 2007 +0000
4.3 @@ -1,5 +1,5 @@
4.4 /**
4.5 - * $Id: render.c,v 1.20 2007-01-26 01:37:39 nkeynes Exp $
4.6 + * $Id: render.c,v 1.21 2007-01-27 06:21:35 nkeynes Exp $
4.7 *
4.8 * PVR2 Renderer support. This part is primarily
4.9 *
4.10 @@ -177,6 +177,7 @@
4.11 back_buffer.width = width;
4.12 back_buffer.height = height;
4.13 back_buffer.colour_format = colour_format;
4.14 + back_buffer.scale = MMIO_READ( PVR2, RENDER_SCALER );
4.15 back_buffer.size = width * height * colour_format_bytes[colour_format];
4.16
4.17 /* Setup the display model */
.