[Scummvm-cvs-logs] SF.net SVN: scummvm:[45165] scummvm/trunk/backends/platform/psp/osys_psp. cpp

bluddy at users.sourceforge.net bluddy at users.sourceforge.net
Fri Oct 16 14:45:54 CEST 2009


Revision: 45165
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45165&view=rev
Author:   bluddy
Date:     2009-10-16 12:45:53 +0000 (Fri, 16 Oct 2009)

Log Message:
-----------
PSP palette fix for bsword1: fixed cache coherency issue

Modified Paths:
--------------
    scummvm/trunk/backends/platform/psp/osys_psp.cpp

Modified: scummvm/trunk/backends/platform/psp/osys_psp.cpp
===================================================================
--- scummvm/trunk/backends/platform/psp/osys_psp.cpp	2009-10-16 11:49:56 UTC (rev 45164)
+++ scummvm/trunk/backends/platform/psp/osys_psp.cpp	2009-10-16 12:45:53 UTC (rev 45165)
@@ -60,8 +60,6 @@
 unsigned short __attribute__((aligned(16))) mouseClut[256];
 unsigned short __attribute__((aligned(16))) cursorPalette[256];
 unsigned short __attribute__((aligned(16))) kbClut[256];
-//unsigned int __attribute__((aligned(16))) offscreen256[640*480];
-//unsigned int __attribute__((aligned(16))) overlayBuffer256[640*480*2];
 unsigned int __attribute__((aligned(16))) mouseBuf256[MOUSE_SIZE*MOUSE_SIZE];
 
 extern unsigned int  size_keyboard_symbols_compressed;
@@ -144,7 +142,7 @@
 		error("OSystem_PSP: uncompressing keyboard_symbols_shift failed");
 
 	_keyboardVisible = false;
-	_clut = (unsigned short *)(((unsigned int)clut256) | 0x40000000);
+	_clut = clut256;	// Mustn't use uncached as it'll cause cache coherency issues
 	_kbdClut = (unsigned short *)(((unsigned int)kbClut) | 0x40000000);
 	_mouseBuf = (byte *)mouseBuf256;
 	_graphicMode = STRETCHED_480X272;
@@ -154,9 +152,8 @@
 	_mouseY = PSP_SCREEN_HEIGHT >> 1;
 
 
-	//sceKernelDcacheWritebackAll();
 
-	// setup
+	// Init GU
 	sceGuInit();
 	sceGuStart(0, displayList);
 	sceGuDrawBuffer(GU_PSM_8888, (void *)0, BUF_WIDTH);
@@ -353,7 +350,6 @@
 
 
 	byte *dst = _offscreen + y * _screenWidth + x;
-	dst = (byte *)((unsigned int)dst | 0x40000000); // Make this an uncached write
 
 	if (_screenWidth == pitch && pitch == w) {
 		memcpy(dst, buf, h * w);
@@ -364,6 +360,7 @@
 			dst += _screenWidth;
 		} while (--h);
 	}
+	sceKernelDcacheWritebackAll();
 
 }
 
@@ -388,7 +385,6 @@
 
 	_lastScreenUpdate = now;
 
-
 	sceGuStart(0, displayList);
 
 	sceGuClearColor(0xFF000000);
@@ -668,7 +664,10 @@
 
 void OSystem_PSP::clearOverlay() {
 	PSPDebugTrace("clearOverlay\n");
+
 	bzero(_overlayBuffer, _overlayWidth * _overlayHeight * sizeof(OverlayColor));
+	
+	sceKernelDcacheWritebackAll();
 }
 
 void OSystem_PSP::grabOverlay(OverlayColor *buf, int pitch) {
@@ -711,7 +710,6 @@
 
 
 	OverlayColor *dst = _overlayBuffer + (y * _overlayWidth + x);
-	dst = (OverlayColor *)((unsigned int)dst | 0x40000000); // Make this an uncached write
 
 	if (_overlayWidth == pitch && pitch == w) {
 		memcpy(dst, buf, h * w * sizeof(OverlayColor));
@@ -722,6 +720,7 @@
 			dst += _overlayWidth;
 		} while (--h);
 	}
+	sceKernelDcacheWritebackAll();
 }
 
 int16 OSystem_PSP::getOverlayWidth() {
@@ -771,10 +770,11 @@
 
 	memcpy(mouseClut, _palette, 256 * sizeof(unsigned short));
 	mouseClut[_mouseKeyColour] = 0;
-	sceKernelDcacheWritebackAll();
 
 	for (unsigned int i = 0; i < h; i++)
 		memcpy(_mouseBuf + i * MOUSE_SIZE, buf + i * w, w);
+
+	sceKernelDcacheWritebackAll();		
 }
 
 #define PAD_CHECK_TIME	40


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list