Search
lxdream.org :: lxdream :: r1294:52be323fcab4
lxdream 0.9.1
released Jun 29
Download Now
changeset1294:52be323fcab4
parent1293:36123decfb24
child1295:9067aff5522d
authornkeynes
dateWed Sep 19 08:42:18 2012 +1000 (7 years ago)
Invalidate render buffers when vram32 region is written from DMA / store
queue. Patch from Guinux, thanks!
src/pvr2/pvr2.h
src/pvr2/pvr2mem.c
1.1 --- a/src/pvr2/pvr2.h Sat Aug 25 14:09:07 2012 +1000
1.2 +++ b/src/pvr2/pvr2.h Wed Sep 19 08:42:18 2012 +1000
1.3 @@ -149,6 +149,11 @@
1.4 void pvr2_dma_write( sh4addr_t dest, unsigned char *src, uint32_t length );
1.5
1.6 /**
1.7 + * Write to the linear memory address space (aka 32-bit address space).
1.8 + */
1.9 +void pvr2_vram32_write( sh4addr_t dest, unsigned char *src, uint32_t length );
1.10 +
1.11 +/**
1.12 * Write to the interleaved memory address space (aka 64-bit address space).
1.13 */
1.14 void pvr2_vram64_write( sh4addr_t dest, unsigned char *src, uint32_t length );
2.1 --- a/src/pvr2/pvr2mem.c Sat Aug 25 14:09:07 2012 +1000
2.2 +++ b/src/pvr2/pvr2mem.c Wed Sep 19 08:42:18 2012 +1000
2.3 @@ -140,9 +140,7 @@
2.4 if( region == 0 ) {
2.5 pvr2_vram64_write( destaddr, src, 32 );
2.6 } else {
2.7 - destaddr &= PVR2_RAM_MASK;
2.8 - unsigned char *dest = pvr2_main_ram + destaddr;
2.9 - memcpy( dest, src, 32 );
2.10 + pvr2_vram32_write( destaddr, src, 32 );
2.11 }
2.12 }
2.13
2.14 @@ -152,9 +150,7 @@
2.15 if( region == 0 ) {
2.16 pvr2_vram64_write( destaddr, src, 32 );
2.17 } else {
2.18 - destaddr &= PVR2_RAM_MASK;
2.19 - unsigned char *dest = pvr2_main_ram + destaddr;
2.20 - memcpy( dest, src, 32 );
2.21 + pvr2_vram32_write( destaddr, src, 32 );
2.22 }
2.23 }
2.24
2.25 @@ -203,12 +199,7 @@
2.26 if( region == 0 ) {
2.27 pvr2_vram64_write( destaddr, src, count );
2.28 } else {
2.29 - destaddr &= PVR2_RAM_MASK;
2.30 - unsigned char *dest = pvr2_main_ram + destaddr;
2.31 - if( PVR2_RAM_SIZE - destaddr < count ) {
2.32 - count = PVR2_RAM_SIZE - destaddr;
2.33 - }
2.34 - memcpy( dest, src, count );
2.35 + pvr2_vram32_write( destaddr, src, count );
2.36 }
2.37 break;
2.38 case 0x10800000:
2.39 @@ -221,16 +212,22 @@
2.40 if( region == 0 ) {
2.41 pvr2_vram64_write( destaddr, src, count );
2.42 } else {
2.43 - destaddr &= PVR2_RAM_MASK;
2.44 - unsigned char *dest = pvr2_main_ram + destaddr;
2.45 - if( PVR2_RAM_SIZE - destaddr < count ) {
2.46 - count = PVR2_RAM_SIZE - destaddr;
2.47 - }
2.48 - memcpy( dest, src, count );
2.49 + pvr2_vram32_write( destaddr, src, count );
2.50 }
2.51 }
2.52 }
2.53
2.54 +void pvr2_vram32_write( sh4addr_t destaddr, unsigned char *src, uint32_t length )
2.55 +{
2.56 + destaddr &= PVR2_RAM_MASK;
2.57 + pvr2_render_buffer_invalidate( PVR2_RAM_BASE + destaddr, TRUE );
2.58 + unsigned char *dest = pvr2_main_ram + destaddr;
2.59 + if( PVR2_RAM_SIZE - destaddr < length ) {
2.60 + length = PVR2_RAM_SIZE - destaddr;
2.61 + }
2.62 + memcpy( dest, src, length );
2.63 +}
2.64 +
2.65 void pvr2_vram64_write( sh4addr_t destaddr, unsigned char *src, uint32_t length )
2.66 {
2.67 int bank_flag = (destaddr & 0x04) >> 2;
.