Search
lxdream.org :: lxdream/src/pvr2/pvr2mem.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/pvr2/pvr2mem.c
changeset 736:a02d1475ccfd
prev669:ab344e42bca9
next796:a2dc83592467
author nkeynes
date Mon Jul 14 07:44:42 2008 +0000 (12 years ago)
permissions -rw-r--r--
last change Re-indent everything consistently
Fix include guards for consistency as well
file annotate diff log raw
1.1 --- a/src/pvr2/pvr2mem.c Mon May 12 10:00:13 2008 +0000
1.2 +++ b/src/pvr2/pvr2mem.c Mon Jul 14 07:44:42 2008 +0000
1.3 @@ -31,31 +31,31 @@
1.4 switch( destaddr & 0x13800000 ) {
1.5 case 0x10000000:
1.6 case 0x12000000:
1.7 - pvr2_ta_write( src, count );
1.8 - break;
1.9 + pvr2_ta_write( src, count );
1.10 + break;
1.11 case 0x11000000:
1.12 case 0x11800000:
1.13 - region = MMIO_READ( ASIC, PVRDMARGN1 );
1.14 - if( region == 0 ) {
1.15 - pvr2_vram64_write( destaddr, src, count );
1.16 - } else {
1.17 - unsigned char *dest = mem_get_region(destaddr);
1.18 - memcpy( dest, src, count );
1.19 - }
1.20 - break;
1.21 + region = MMIO_READ( ASIC, PVRDMARGN1 );
1.22 + if( region == 0 ) {
1.23 + pvr2_vram64_write( destaddr, src, count );
1.24 + } else {
1.25 + unsigned char *dest = mem_get_region(destaddr);
1.26 + memcpy( dest, src, count );
1.27 + }
1.28 + break;
1.29 case 0x10800000:
1.30 case 0x12800000:
1.31 - pvr2_yuv_write( src, count );
1.32 - break;
1.33 + pvr2_yuv_write( src, count );
1.34 + break;
1.35 case 0x13000000:
1.36 case 0x13800000:
1.37 - region = MMIO_READ( ASIC, PVRDMARGN2 );
1.38 - if( region == 0 ) {
1.39 - pvr2_vram64_write( destaddr, src, count );
1.40 - } else {
1.41 - unsigned char *dest = mem_get_region(destaddr);
1.42 - memcpy( dest, src, count );
1.43 - }
1.44 + region = MMIO_READ( ASIC, PVRDMARGN2 );
1.45 + if( region == 0 ) {
1.46 + pvr2_vram64_write( destaddr, src, count );
1.47 + } else {
1.48 + unsigned char *dest = mem_get_region(destaddr);
1.49 + memcpy( dest, src, count );
1.50 + }
1.51 }
1.52 }
1.53
1.54 @@ -68,41 +68,41 @@
1.55
1.56 destaddr = destaddr & 0x7FFFFF;
1.57 if( destaddr + length > 0x800000 ) {
1.58 - length = 0x800000 - destaddr;
1.59 + length = 0x800000 - destaddr;
1.60 }
1.61
1.62 for( i=destaddr & 0xFFFFF000; i < destaddr + length; i+= PAGE_SIZE ) {
1.63 - texcache_invalidate_page( i );
1.64 + texcache_invalidate_page( i );
1.65 }
1.66
1.67 banks[0] = ((uint32_t *)(video_base + ((destaddr & 0x007FFFF8) >>1)));
1.68 banks[1] = banks[0] + 0x100000;
1.69 if( bank_flag )
1.70 - banks[0]++;
1.71 -
1.72 + banks[0]++;
1.73 +
1.74 /* Handle non-aligned start of source */
1.75 if( destaddr & 0x03 ) {
1.76 - unsigned char *dest = ((unsigned char *)banks[bank_flag]) + (destaddr & 0x03);
1.77 - for( i= destaddr & 0x03; i < 4 && length > 0; i++, length-- ) {
1.78 - *dest++ = *src++;
1.79 - }
1.80 - bank_flag = !bank_flag;
1.81 + unsigned char *dest = ((unsigned char *)banks[bank_flag]) + (destaddr & 0x03);
1.82 + for( i= destaddr & 0x03; i < 4 && length > 0; i++, length-- ) {
1.83 + *dest++ = *src++;
1.84 + }
1.85 + bank_flag = !bank_flag;
1.86 }
1.87
1.88 dwsrc = (uint32_t *)src;
1.89 while( length >= 4 ) {
1.90 - *banks[bank_flag]++ = *dwsrc++;
1.91 - bank_flag = !bank_flag;
1.92 - length -= 4;
1.93 + *banks[bank_flag]++ = *dwsrc++;
1.94 + bank_flag = !bank_flag;
1.95 + length -= 4;
1.96 }
1.97 -
1.98 +
1.99 /* Handle non-aligned end of source */
1.100 if( length ) {
1.101 - src = (unsigned char *)dwsrc;
1.102 - unsigned char *dest = (unsigned char *)banks[bank_flag];
1.103 - while( length-- > 0 ) {
1.104 - *dest++ = *src++;
1.105 - }
1.106 + src = (unsigned char *)dwsrc;
1.107 + unsigned char *dest = (unsigned char *)banks[bank_flag];
1.108 + while( length-- > 0 ) {
1.109 + *dest++ = *src++;
1.110 + }
1.111 }
1.112 }
1.113
1.114 @@ -112,7 +112,7 @@
1.115 * must be multiples of 4.
1.116 */
1.117 void pvr2_vram64_write_stride( sh4addr_t destaddr, unsigned char *src, uint32_t line_bytes,
1.118 - uint32_t line_stride_bytes, uint32_t line_count )
1.119 + uint32_t line_stride_bytes, uint32_t line_count )
1.120 {
1.121 int bank_flag = (destaddr & 0x04) >> 2;
1.122 uint32_t *banks[2];
1.123 @@ -128,26 +128,26 @@
1.124 line_bytes >>= 2;
1.125
1.126 for( i=destaddr & 0xFFFFF000; i < destaddr + line_stride_bytes*line_count; i+= PAGE_SIZE ) {
1.127 - texcache_invalidate_page( i );
1.128 + texcache_invalidate_page( i );
1.129 }
1.130
1.131 banks[0] = (uint32_t *)(video_base + (destaddr >>1));
1.132 banks[1] = banks[0] + 0x100000;
1.133 if( bank_flag )
1.134 - banks[0]++;
1.135 -
1.136 + banks[0]++;
1.137 +
1.138 dwsrc = (uint32_t *)src;
1.139 for( i=0; i<line_count; i++ ) {
1.140 - for( j=0; j<line_bytes; j++ ) {
1.141 - *banks[bank_flag]++ = *dwsrc++;
1.142 - bank_flag = !bank_flag;
1.143 - }
1.144 - banks[0] += line_gap;
1.145 - banks[1] += line_gap;
1.146 - if( line_gap_flag ) {
1.147 - banks[bank_flag]++;
1.148 - bank_flag = !bank_flag;
1.149 - }
1.150 + for( j=0; j<line_bytes; j++ ) {
1.151 + *banks[bank_flag]++ = *dwsrc++;
1.152 + bank_flag = !bank_flag;
1.153 + }
1.154 + banks[0] += line_gap;
1.155 + banks[1] += line_gap;
1.156 + if( line_gap_flag ) {
1.157 + banks[bank_flag]++;
1.158 + bank_flag = !bank_flag;
1.159 + }
1.160 }
1.161 }
1.162
1.163 @@ -158,7 +158,7 @@
1.164 * This method is used to extract a "stride" texture from vram.
1.165 */
1.166 void pvr2_vram64_read_stride( unsigned char *dest, uint32_t dest_line_bytes, sh4addr_t srcaddr,
1.167 - uint32_t src_line_bytes, uint32_t line_count )
1.168 + uint32_t src_line_bytes, uint32_t line_count )
1.169 {
1.170 int bank_flag = (srcaddr & 0x04) >> 2;
1.171 uint32_t *banks[2];
1.172 @@ -171,35 +171,35 @@
1.173
1.174 srcaddr = srcaddr & 0x7FFFF8;
1.175 if( src_line_bytes <= dest_line_bytes ) {
1.176 - dest_line_gap = (dest_line_bytes - src_line_bytes) >> 2;
1.177 - src_line_gap = 0;
1.178 - src_line_gap_flag = 0;
1.179 - line_bytes = src_line_bytes >> 2;
1.180 + dest_line_gap = (dest_line_bytes - src_line_bytes) >> 2;
1.181 + src_line_gap = 0;
1.182 + src_line_gap_flag = 0;
1.183 + line_bytes = src_line_bytes >> 2;
1.184 } else {
1.185 - i = (src_line_bytes - dest_line_bytes);
1.186 - src_line_gap_flag = i & 0x04;
1.187 - src_line_gap = i >> 3;
1.188 - line_bytes = dest_line_bytes >> 2;
1.189 + i = (src_line_bytes - dest_line_bytes);
1.190 + src_line_gap_flag = i & 0x04;
1.191 + src_line_gap = i >> 3;
1.192 + line_bytes = dest_line_bytes >> 2;
1.193 }
1.194 -
1.195 +
1.196 banks[0] = (uint32_t *)(video_base + (srcaddr>>1));
1.197 banks[1] = banks[0] + 0x100000;
1.198 if( bank_flag )
1.199 - banks[0]++;
1.200 -
1.201 + banks[0]++;
1.202 +
1.203 dwdest = (uint32_t *)dest;
1.204 for( i=0; i<line_count; i++ ) {
1.205 - for( j=0; j<line_bytes; j++ ) {
1.206 - *dwdest++ = *banks[bank_flag]++;
1.207 - bank_flag = !bank_flag;
1.208 - }
1.209 - dwdest += dest_line_gap;
1.210 - banks[0] += src_line_gap;
1.211 - banks[1] += src_line_gap;
1.212 - if( src_line_gap_flag ) {
1.213 - banks[bank_flag]++;
1.214 - bank_flag = !bank_flag;
1.215 - }
1.216 + for( j=0; j<line_bytes; j++ ) {
1.217 + *dwdest++ = *banks[bank_flag]++;
1.218 + bank_flag = !bank_flag;
1.219 + }
1.220 + dwdest += dest_line_gap;
1.221 + banks[0] += src_line_gap;
1.222 + banks[1] += src_line_gap;
1.223 + if( src_line_gap_flag ) {
1.224 + banks[bank_flag]++;
1.225 + bank_flag = !bank_flag;
1.226 + }
1.227 }
1.228 }
1.229
1.230 @@ -215,26 +215,26 @@
1.231 */
1.232
1.233 static void pvr2_vram64_detwiddle_4( uint8_t *dest, uint8_t *banks[2], int offset,
1.234 - int x1, int y1, int width, int stride )
1.235 + int x1, int y1, int width, int stride )
1.236 {
1.237 if( width == 2 ) {
1.238 - x1 = x1 >> 1;
1.239 - uint8_t t1 = *banks[offset<4?0:1]++;
1.240 - uint8_t t2 = *banks[offset<3?0:1]++;
1.241 - dest[y1*stride + x1] = (t1 & 0x0F) | (t2<<4);
1.242 - dest[(y1+1)*stride + x1] = (t1>>4) | (t2&0xF0);
1.243 + x1 = x1 >> 1;
1.244 + uint8_t t1 = *banks[offset<4?0:1]++;
1.245 + uint8_t t2 = *banks[offset<3?0:1]++;
1.246 + dest[y1*stride + x1] = (t1 & 0x0F) | (t2<<4);
1.247 + dest[(y1+1)*stride + x1] = (t1>>4) | (t2&0xF0);
1.248 } else if( width == 4 ) {
1.249 - pvr2_vram64_detwiddle_4( dest, banks, offset, x1, y1, 2, stride );
1.250 - pvr2_vram64_detwiddle_4( dest, banks, offset+2, x1, y1+2, 2, stride );
1.251 - pvr2_vram64_detwiddle_4( dest, banks, offset+4, x1+2, y1, 2, stride );
1.252 - pvr2_vram64_detwiddle_4( dest, banks, offset+6, x1+2, y1+2, 2, stride );
1.253 -
1.254 + pvr2_vram64_detwiddle_4( dest, banks, offset, x1, y1, 2, stride );
1.255 + pvr2_vram64_detwiddle_4( dest, banks, offset+2, x1, y1+2, 2, stride );
1.256 + pvr2_vram64_detwiddle_4( dest, banks, offset+4, x1+2, y1, 2, stride );
1.257 + pvr2_vram64_detwiddle_4( dest, banks, offset+6, x1+2, y1+2, 2, stride );
1.258 +
1.259 } else {
1.260 - int subdivide = width >> 1;
1.261 - pvr2_vram64_detwiddle_4( dest, banks, offset, x1, y1, subdivide, stride );
1.262 - pvr2_vram64_detwiddle_4( dest, banks, offset, x1, y1+subdivide, subdivide, stride );
1.263 - pvr2_vram64_detwiddle_4( dest, banks, offset, x1+subdivide, y1, subdivide, stride );
1.264 - pvr2_vram64_detwiddle_4( dest, banks, offset, x1+subdivide, y1+subdivide, subdivide, stride );
1.265 + int subdivide = width >> 1;
1.266 + pvr2_vram64_detwiddle_4( dest, banks, offset, x1, y1, subdivide, stride );
1.267 + pvr2_vram64_detwiddle_4( dest, banks, offset, x1, y1+subdivide, subdivide, stride );
1.268 + pvr2_vram64_detwiddle_4( dest, banks, offset, x1+subdivide, y1, subdivide, stride );
1.269 + pvr2_vram64_detwiddle_4( dest, banks, offset, x1+subdivide, y1+subdivide, subdivide, stride );
1.270 }
1.271 }
1.272
1.273 @@ -249,22 +249,22 @@
1.274 */
1.275
1.276 static void pvr2_vram64_detwiddle_8( uint8_t *dest, uint8_t *banks[2], int offset,
1.277 - int x1, int y1, int width, int stride )
1.278 + int x1, int y1, int width, int stride )
1.279 {
1.280 if( width == 2 ) {
1.281 - dest[y1*stride + x1] = *banks[0]++;
1.282 - dest[(y1+1)*stride + x1] = *banks[offset<3?0:1]++;
1.283 - dest[y1*stride + x1 + 1] = *banks[offset<2?0:1]++;
1.284 - dest[(y1+1)*stride + x1 + 1] = *banks[offset==0?0:1]++;
1.285 - uint8_t *tmp = banks[0]; /* swap banks */
1.286 - banks[0] = banks[1];
1.287 - banks[1] = tmp;
1.288 + dest[y1*stride + x1] = *banks[0]++;
1.289 + dest[(y1+1)*stride + x1] = *banks[offset<3?0:1]++;
1.290 + dest[y1*stride + x1 + 1] = *banks[offset<2?0:1]++;
1.291 + dest[(y1+1)*stride + x1 + 1] = *banks[offset==0?0:1]++;
1.292 + uint8_t *tmp = banks[0]; /* swap banks */
1.293 + banks[0] = banks[1];
1.294 + banks[1] = tmp;
1.295 } else {
1.296 - int subdivide = width >> 1;
1.297 - pvr2_vram64_detwiddle_8( dest, banks, offset, x1, y1, subdivide, stride );
1.298 - pvr2_vram64_detwiddle_8( dest, banks, offset, x1, y1+subdivide, subdivide, stride );
1.299 - pvr2_vram64_detwiddle_8( dest, banks, offset, x1+subdivide, y1, subdivide, stride );
1.300 - pvr2_vram64_detwiddle_8( dest, banks, offset, x1+subdivide, y1+subdivide, subdivide, stride );
1.301 + int subdivide = width >> 1;
1.302 + pvr2_vram64_detwiddle_8( dest, banks, offset, x1, y1, subdivide, stride );
1.303 + pvr2_vram64_detwiddle_8( dest, banks, offset, x1, y1+subdivide, subdivide, stride );
1.304 + pvr2_vram64_detwiddle_8( dest, banks, offset, x1+subdivide, y1, subdivide, stride );
1.305 + pvr2_vram64_detwiddle_8( dest, banks, offset, x1+subdivide, y1+subdivide, subdivide, stride );
1.306 }
1.307 }
1.308
1.309 @@ -279,19 +279,19 @@
1.310 */
1.311
1.312 static void pvr2_vram64_detwiddle_16( uint16_t *dest, uint16_t *banks[2], int offset,
1.313 - int x1, int y1, int width, int stride )
1.314 + int x1, int y1, int width, int stride )
1.315 {
1.316 if( width == 2 ) {
1.317 - dest[y1*stride + x1] = *banks[0]++;
1.318 - dest[(y1+1)*stride + x1] = *banks[offset]++;
1.319 - dest[y1*stride + x1 + 1] = *banks[1]++;
1.320 - dest[(y1+1)*stride + x1 + 1] = *banks[offset^1]++;
1.321 + dest[y1*stride + x1] = *banks[0]++;
1.322 + dest[(y1+1)*stride + x1] = *banks[offset]++;
1.323 + dest[y1*stride + x1 + 1] = *banks[1]++;
1.324 + dest[(y1+1)*stride + x1 + 1] = *banks[offset^1]++;
1.325 } else {
1.326 - int subdivide = width >> 1;
1.327 - pvr2_vram64_detwiddle_16( dest, banks, offset, x1, y1, subdivide, stride );
1.328 - pvr2_vram64_detwiddle_16( dest, banks, offset, x1, y1+subdivide, subdivide, stride );
1.329 - pvr2_vram64_detwiddle_16( dest, banks, offset, x1+subdivide, y1, subdivide, stride );
1.330 - pvr2_vram64_detwiddle_16( dest, banks, offset, x1+subdivide, y1+subdivide, subdivide, stride );
1.331 + int subdivide = width >> 1;
1.332 + pvr2_vram64_detwiddle_16( dest, banks, offset, x1, y1, subdivide, stride );
1.333 + pvr2_vram64_detwiddle_16( dest, banks, offset, x1, y1+subdivide, subdivide, stride );
1.334 + pvr2_vram64_detwiddle_16( dest, banks, offset, x1+subdivide, y1, subdivide, stride );
1.335 + pvr2_vram64_detwiddle_16( dest, banks, offset, x1+subdivide, y1+subdivide, subdivide, stride );
1.336 }
1.337 }
1.338
1.339 @@ -316,25 +316,25 @@
1.340 banks[0] = (uint8_t *)(video_base + (srcaddr>>1));
1.341 banks[1] = banks[0] + 0x400000;
1.342 if( offset_flag & 0x04 ) { // If source is not 64-bit aligned, swap the banks
1.343 - uint8_t *tmp = banks[0];
1.344 - banks[0] = banks[1];
1.345 - banks[1] = tmp + 4;
1.346 - offset_flag &= 0x03;
1.347 + uint8_t *tmp = banks[0];
1.348 + banks[0] = banks[1];
1.349 + banks[1] = tmp + 4;
1.350 + offset_flag &= 0x03;
1.351 }
1.352 banks[0] += offset_flag;
1.353
1.354 if( width > height ) {
1.355 - for( i=0; i<width; i+=height ) {
1.356 - pvr2_vram64_detwiddle_4( wdest, banks, offset_flag, i, 0, height, stride );
1.357 - }
1.358 + for( i=0; i<width; i+=height ) {
1.359 + pvr2_vram64_detwiddle_4( wdest, banks, offset_flag, i, 0, height, stride );
1.360 + }
1.361 } else if( height > width ) {
1.362 - for( i=0; i<height; i+=width ) {
1.363 - pvr2_vram64_detwiddle_4( wdest, banks, offset_flag, 0, i, width, stride );
1.364 - }
1.365 + for( i=0; i<height; i+=width ) {
1.366 + pvr2_vram64_detwiddle_4( wdest, banks, offset_flag, 0, i, width, stride );
1.367 + }
1.368 } else if( width == 1 ) {
1.369 - *wdest = *banks[0];
1.370 + *wdest = *banks[0];
1.371 } else {
1.372 - pvr2_vram64_detwiddle_4( wdest, banks, offset_flag, 0, 0, width, stride );
1.373 + pvr2_vram64_detwiddle_4( wdest, banks, offset_flag, 0, 0, width, stride );
1.374 }
1.375 }
1.376
1.377 @@ -358,25 +358,25 @@
1.378 banks[0] = (uint8_t *)(video_base + (srcaddr>>1));
1.379 banks[1] = banks[0] + 0x400000;
1.380 if( offset_flag & 0x04 ) { // If source is not 64-bit aligned, swap the banks
1.381 - uint8_t *tmp = banks[0];
1.382 - banks[0] = banks[1];
1.383 - banks[1] = tmp + 4;
1.384 - offset_flag &= 0x03;
1.385 + uint8_t *tmp = banks[0];
1.386 + banks[0] = banks[1];
1.387 + banks[1] = tmp + 4;
1.388 + offset_flag &= 0x03;
1.389 }
1.390 banks[0] += offset_flag;
1.391
1.392 if( width > height ) {
1.393 - for( i=0; i<width; i+=height ) {
1.394 - pvr2_vram64_detwiddle_8( wdest, banks, offset_flag, i, 0, height, width );
1.395 - }
1.396 + for( i=0; i<width; i+=height ) {
1.397 + pvr2_vram64_detwiddle_8( wdest, banks, offset_flag, i, 0, height, width );
1.398 + }
1.399 } else if( height > width ) {
1.400 - for( i=0; i<height; i+=width ) {
1.401 - pvr2_vram64_detwiddle_8( wdest, banks, offset_flag, 0, i, width, width );
1.402 - }
1.403 + for( i=0; i<height; i+=width ) {
1.404 + pvr2_vram64_detwiddle_8( wdest, banks, offset_flag, 0, i, width, width );
1.405 + }
1.406 } else if( width == 1 ) {
1.407 - *wdest = *banks[0];
1.408 + *wdest = *banks[0];
1.409 } else {
1.410 - pvr2_vram64_detwiddle_8( wdest, banks, offset_flag, 0, 0, width, width );
1.411 + pvr2_vram64_detwiddle_8( wdest, banks, offset_flag, 0, 0, width, width );
1.412 }
1.413 }
1.414
1.415 @@ -399,38 +399,38 @@
1.416 banks[0] = (uint16_t *)(video_base + (srcaddr>>1));
1.417 banks[1] = banks[0] + 0x200000;
1.418 if( offset_flag & 0x02 ) { // If source is not 64-bit aligned, swap the banks
1.419 - uint16_t *tmp = banks[0];
1.420 - banks[0] = banks[1];
1.421 - banks[1] = tmp + 2;
1.422 - offset_flag &= 0x01;
1.423 + uint16_t *tmp = banks[0];
1.424 + banks[0] = banks[1];
1.425 + banks[1] = tmp + 2;
1.426 + offset_flag &= 0x01;
1.427 }
1.428 banks[0] += offset_flag;
1.429 -
1.430 +
1.431
1.432 if( width > height ) {
1.433 - for( i=0; i<width; i+=height ) {
1.434 - pvr2_vram64_detwiddle_16( wdest, banks, offset_flag, i, 0, height, width );
1.435 - }
1.436 + for( i=0; i<width; i+=height ) {
1.437 + pvr2_vram64_detwiddle_16( wdest, banks, offset_flag, i, 0, height, width );
1.438 + }
1.439 } else if( height > width ) {
1.440 - for( i=0; i<height; i+=width ) {
1.441 - pvr2_vram64_detwiddle_16( wdest, banks, offset_flag, 0, i, width, width );
1.442 - }
1.443 + for( i=0; i<height; i+=width ) {
1.444 + pvr2_vram64_detwiddle_16( wdest, banks, offset_flag, 0, i, width, width );
1.445 + }
1.446 } else if( width == 1 ) {
1.447 - *wdest = *banks[0];
1.448 + *wdest = *banks[0];
1.449 } else {
1.450 - pvr2_vram64_detwiddle_16( wdest, banks, offset_flag, 0, 0, width, width );
1.451 + pvr2_vram64_detwiddle_16( wdest, banks, offset_flag, 0, 0, width, width );
1.452 }
1.453 }
1.454
1.455 void pvr2_vram_write_invert( sh4addr_t destaddr, unsigned char *src, uint32_t length, uint32_t line_length,
1.456 - uint32_t src_stride )
1.457 + uint32_t src_stride )
1.458 {
1.459 unsigned char *dest = video_base + (destaddr & 0x007FFFFF);
1.460 unsigned char *p = src + length - src_stride;
1.461 while( p >= src ) {
1.462 - memcpy( dest, p, line_length );
1.463 - p -= src_stride;
1.464 - dest += line_length;
1.465 + memcpy( dest, p, line_length );
1.466 + p -= src_stride;
1.467 + dest += line_length;
1.468 }
1.469 }
1.470
1.471 @@ -443,36 +443,36 @@
1.472
1.473 srcaddr = srcaddr & 0x7FFFFF;
1.474 if( srcaddr + length > 0x800000 )
1.475 - length = 0x800000 - srcaddr;
1.476 + length = 0x800000 - srcaddr;
1.477
1.478 banks[0] = ((uint32_t *)(video_base + ((srcaddr&0x007FFFF8)>>1)));
1.479 banks[1] = banks[0] + 0x100000;
1.480 if( bank_flag )
1.481 - banks[0]++;
1.482 -
1.483 + banks[0]++;
1.484 +
1.485 /* Handle non-aligned start of source */
1.486 if( srcaddr & 0x03 ) {
1.487 - char *src = ((char *)banks[bank_flag]) + (srcaddr & 0x03);
1.488 - for( i= srcaddr & 0x03; i < 4 && length > 0; i++, length-- ) {
1.489 - *dest++ = *src++;
1.490 - }
1.491 - bank_flag = !bank_flag;
1.492 + char *src = ((char *)banks[bank_flag]) + (srcaddr & 0x03);
1.493 + for( i= srcaddr & 0x03; i < 4 && length > 0; i++, length-- ) {
1.494 + *dest++ = *src++;
1.495 + }
1.496 + bank_flag = !bank_flag;
1.497 }
1.498
1.499 dwdest = (uint32_t *)dest;
1.500 while( length >= 4 ) {
1.501 - *dwdest++ = *banks[bank_flag]++;
1.502 - bank_flag = !bank_flag;
1.503 - length -= 4;
1.504 + *dwdest++ = *banks[bank_flag]++;
1.505 + bank_flag = !bank_flag;
1.506 + length -= 4;
1.507 }
1.508 -
1.509 +
1.510 /* Handle non-aligned end of source */
1.511 if( length ) {
1.512 - dest = (unsigned char *)dwdest;
1.513 - unsigned char *src = (unsigned char *)banks[bank_flag];
1.514 - while( length-- > 0 ) {
1.515 - *dest++ = *src++;
1.516 - }
1.517 + dest = (unsigned char *)dwdest;
1.518 + unsigned char *src = (unsigned char *)banks[bank_flag];
1.519 + while( length-- > 0 ) {
1.520 + *dest++ = *src++;
1.521 + }
1.522 }
1.523 }
1.524
1.525 @@ -483,19 +483,19 @@
1.526 unsigned int i, j;
1.527
1.528 if( f == NULL ) {
1.529 - ERROR( "Unable to write to dump file '%s' (%s)", filename, strerror(errno) );
1.530 - return;
1.531 + ERROR( "Unable to write to dump file '%s' (%s)", filename, strerror(errno) );
1.532 + return;
1.533 }
1.534 pvr2_vram64_read( (unsigned char *)tmp, addr, length );
1.535 fprintf( f, "%08X\n", addr );
1.536 for( i =0; i<length>>2; i+=8 ) {
1.537 - for( j=i; j<i+8; j++ ) {
1.538 - if( j < length )
1.539 - fprintf( f, " %08X", tmp[j] );
1.540 - else
1.541 - fprintf( f, " " );
1.542 - }
1.543 - fprintf( f, "\n" );
1.544 + for( j=i; j<i+8; j++ ) {
1.545 + if( j < length )
1.546 + fprintf( f, " %08X", tmp[j] );
1.547 + else
1.548 + fprintf( f, " " );
1.549 + }
1.550 + fprintf( f, "\n" );
1.551 }
1.552 fclose(f);
1.553 }
1.554 @@ -521,15 +521,15 @@
1.555 void pvr2_render_buffer_copy_to_sh4( render_buffer_t buffer )
1.556 {
1.557 if( (buffer->address & 0xFF000000) == 0x04000000 ) {
1.558 - /* Interlaced buffer. Go the double copy... :( */
1.559 - unsigned char target[buffer->size];
1.560 - display_driver->read_render_buffer( target, buffer, buffer->rowstride, buffer->colour_format );
1.561 - pvr2_vram64_write( buffer->address, target, buffer->size );
1.562 + /* Interlaced buffer. Go the double copy... :( */
1.563 + unsigned char target[buffer->size];
1.564 + display_driver->read_render_buffer( target, buffer, buffer->rowstride, buffer->colour_format );
1.565 + pvr2_vram64_write( buffer->address, target, buffer->size );
1.566 } else {
1.567 - /* Regular buffer */
1.568 + /* Regular buffer */
1.569 unsigned char target[buffer->size];
1.570 - int line_size = buffer->width * colour_formats[buffer->colour_format].bpp;
1.571 - display_driver->read_render_buffer( target, buffer, buffer->rowstride, buffer->colour_format );
1.572 + int line_size = buffer->width * colour_formats[buffer->colour_format].bpp;
1.573 + display_driver->read_render_buffer( target, buffer, buffer->rowstride, buffer->colour_format );
1.574 if( (buffer->scale & 0xFFFF) == 0x0800 ) {
1.575 pvr2_vram_write_invert( buffer->address, target, buffer->size, line_size, line_size << 1 );
1.576 } else {
.