Previous Thread
Next Thread
Print Thread
Page 2 of 4 1 2 3 4
Re: SDLMAME 0.120u1 is up [Re: etabeta78] #35012 10/25/07 10:22 PM
Joined: Mar 2001
Posts: 16,590
R
R. Belmont Online Content OP
Very Senior Member
OP Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,590
That's what I meant, yes. I'll check model3 in particular in a bit.

Re: SDLMAME 0.120u1 is up [Re: R. Belmont] #35016 10/26/07 12:06 AM
Joined: Feb 2004
Posts: 2,176
Vas Crabb Online Content
Very Senior Member
Online Content
Very Senior Member
Joined: Feb 2004
Posts: 2,176
Here's a patch to:
  • Fix a stupid copy/paste error in my PPC64 exchange64 function (doesn't affect anyone AFAIK, but I still have egg on my face)
  • Pad out the lock and event structures to 64 bytes to reduce contention (I do realise this probably doesn't make a difference unless we decide to allocate arrays of them at some point)
  • Clean up some compile warnings in sdlsync.c on Linux (pthread_t is an integer on Linux, as opposed to an opaque pointer on OS X)

Code:
diff -ur sdlmame0120u1/src/osd/sdl/osinline.h sdlmame0120u1/src/osd/sdl/osinline.h
--- sdlmame0120u1/src/osd/sdl/osinline.h	2007-10-17 20:20:08.000000000 +1000
+++ sdlmame0120u1/src/osd/sdl/osinline.h	2007-10-26 09:26:16.000000000 +1000
@@ -352,11 +352,11 @@
 ATTR_UNUSED
 INLINE INT64 _osd_exchange64(INT64 volatile *ptr, INT64 exchange)
 {
-	register INT32 ret;
+	register INT64 ret;
 	__asm__ __volatile__ (
-		"1: lwarx  %[ret], 0, %[ptr]      \n"
-		"   stwcx. %[exchange], 0, %[ptr] \n"
-		"   bne-   1b                     \n"
+		"1: ldarx  %[ret], 0, %[ptr]      \n"
+		"   stdcx. %[exchange], 0, %[ptr] \n"
+		"   bne--  1b                     \n"
 		: [ret]      "=&r" (ret)
 		: [ptr]      "r"   (ptr)
 		, [exchange] "r"   (exchange)
diff -ur sdlmame0120u1/src/osd/sdl/sdlsync.c sdlmame0120u1/src/osd/sdl/sdlsync.c
--- sdlmame0120u1/src/osd/sdl/sdlsync.c	2007-10-21 11:51:40.000000000 +1000
+++ sdlmame0120u1/src/osd/sdl/sdlsync.c	2007-10-26 09:50:37.000000000 +1000
@@ -47,6 +47,11 @@
 struct _osd_lock {
  	volatile pthread_t	holder;
 	INT32				count;
+#ifdef PTR64
+	INT8				padding[52];	// Fill a 64-byte cache line
+#else
+	INT8				padding[56];	// A bit more padding
+#endif
 };
  
 struct _osd_event {
@@ -54,10 +59,15 @@
 	pthread_cond_t 		cond;
 	volatile INT32		autoreset;
 	volatile INT32		signalled;
+#ifdef PTR64
+	INT8				padding[40];	// Fill a 64-byte cache line
+#else
+	INT8				padding[48];	// A bit more padding
+#endif
 };
 
 struct _osd_thread {
-	pthread_t		thread;
+	pthread_t			thread;
 };
 
 static osd_lock			*atomic_lck = NULL;
@@ -93,7 +103,7 @@
 
 	lock = (osd_lock *)calloc(1, sizeof(osd_lock));
 
-	lock->holder = NULL;
+	lock->holder = 0;
 	lock->count = 0;
 
 	return lock;
@@ -108,7 +118,7 @@
 	pthread_t current, prev;
 
 	current = pthread_self();
-	prev = osd_compare_exchange_pthread_t(&lock->holder, NULL, current);
+	prev = osd_compare_exchange_pthread_t(&lock->holder, 0, current);
 	if (prev != NULL && prev != current)
 	{
 		do {
@@ -120,9 +130,9 @@
 				"   mov    %[holder], %[tmp] ;"
 				"   test   %[tmp], %[tmp]    ;"
 				"   loopne 1b                ;"
-				: [spin]   "+c" (spin)
+				: [spin]   "+c"  (spin)
 				, [tmp]    "=&r" (tmp)
-				: [holder] "m"  (lock->holder)
+				: [holder] "m"   (lock->holder)
 				: "%cc"
 			);
 #elif defined(__ppc__) || defined(__PPC__)
@@ -164,7 +174,7 @@
 				nanosleep(&sleep, &remaining); // sleep for 100us
 			}
 #endif
-		} while (osd_compare_exchange_pthread_t(&lock->holder, NULL, current) != NULL);
+		} while (osd_compare_exchange_pthread_t(&lock->holder, 0, current) != NULL);
 	}
 	lock->count++;
 }
@@ -178,7 +188,7 @@
 	pthread_t current, prev;
 
 	current = pthread_self();
-	prev = osd_compare_exchange_pthread_t(&lock->holder, NULL, current);
+	prev = osd_compare_exchange_pthread_t(&lock->holder, 0, current);
 	if (prev == NULL || prev == current)
 	{
 		lock->count++;
@@ -200,10 +210,10 @@
 	{
 		if (--lock->count == 0)
 #if defined(__ppc__) || defined(__PPC__) || defined(__ppc64__) || defined(__PPC64__)
-		lock->holder = NULL;
+		lock->holder = 0;
 		__asm__ __volatile__( " eieio " : : );
 #else
-		osd_exchange_pthread_t(&lock->holder, NULL);
+		osd_exchange_pthread_t(&lock->holder, 0);
 #endif
 		return;
 	}

Re: SDLMAME 0.120u1 is up [Re: Vas Crabb] #35017 10/26/07 12:31 AM
Joined: Mar 2001
Posts: 16,590
R
R. Belmont Online Content OP
Very Senior Member
OP Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,590
Thanks! Better but not perfect on the warnings, but I can clean that up myself.

src/osd/sdl/sdlsync.c: In function ‘osd_lock_acquire’:
src/osd/sdl/sdlsync.c:122: warning: comparison between pointer and integer
src/osd/sdl/sdlsync.c:177: warning: comparison between pointer and integer
src/osd/sdl/sdlsync.c: In function ‘osd_lock_try’:
src/osd/sdl/sdlsync.c:192: warning: comparison between pointer and integer

Re: SDLMAME 0.120u1 is up [Re: R. Belmont] #35018 10/26/07 12:39 AM
Joined: Feb 2004
Posts: 2,176
Vas Crabb Online Content
Very Senior Member
Online Content
Very Senior Member
Joined: Feb 2004
Posts: 2,176
Sorry, missed those three in my sweep. Just change NULL to 0 and it should work.

Re: SDLMAME 0.120u1 is up [Re: Vas Crabb] #35021 10/26/07 02:44 AM
Joined: Jun 2007
Posts: 107
B
Brass Offline
Senior Member
Offline
Senior Member
B
Joined: Jun 2007
Posts: 107
multithreading locks up X - I'm running opengl now. I guess it's broken on anything but core 2 duo? Or it could be the new fglrx driver I installed. Either way, this sucks.

Compiling again with SYMBOLS for the debug info.

Last edited by Brass; 10/26/07 02:45 AM.
Re: SDLMAME 0.120u1 is up [Re: Brass] #35022 10/26/07 03:00 AM
Joined: Mar 2001
Posts: 16,590
R
R. Belmont Online Content OP
Very Senior Member
OP Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,590
-mt works for me, so it's probably your video driver.

Re: SDLMAME 0.120u1 is up [Re: R. Belmont] #35023 10/26/07 03:36 AM
Joined: Jun 2007
Posts: 107
B
Brass Offline
Senior Member
Offline
Senior Member
B
Joined: Jun 2007
Posts: 107
I almost forgot that I was running this video driver with v.120a for a short time and X locking up never happened then. It gave Segmentation fault sometimes, but never this.

When it locks up, this scrolls endlessly.

Code:
Error 22 while waiting for pthread_cond_timedwait


Other than that, the segmentation faults give nothing in gdb, even with SYMBOLS = 1 compiled in:

Code:
(gdb) run -mt truxton2
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/x/sdlmame0120u1/mamep4 -mt truxton2
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread -1208236352 (LWP 851)]
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[New Thread -1208239216 (LWP 852)]
[New Thread -1216631920 (LWP 853)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1208236352 (LWP 851)]
0x08a68e78 in ?? ()
(gdb) bt
#0  0x08a68e78 in ?? ()
#1  0x0a8ba6a0 in ?? ()
#2  0x000002e5 in ?? ()
#3  0x0a8ba538 in ?? ()
#4  0x00000000 in ?? ()


And what I mean is that usually it seg faults, when it doesn't, X freezes in fullscreen and the first line scrolls in a log.

Last edited by Brass; 10/26/07 03:38 AM.
Re: SDLMAME 0.120u1 is up [Re: Brass] #35025 10/26/07 03:43 AM
Joined: Jun 2001
Posts: 58
C
carrotroot Offline
Senior Member
Offline
Senior Member
C
Joined: Jun 2001
Posts: 58
I got the same error with 120u1 when trying to run Gauntlet Legends

Error 22 while waiting for pthread_cond_timedwait

I'm running Ubuntu 7.10 on a P4 3.2Ghz HT with 7900GS graphics card

The game runs fine on my C2D mac mini


-carrotroot
Occupation: Being eaten by rabbits
Location: In your garden.
Re: SDLMAME 0.120u1 is up [Re: carrotroot] #35026 10/26/07 03:48 AM
Joined: Mar 2001
Posts: 16,590
R
R. Belmont Online Content OP
Very Senior Member
OP Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,590
I'm starting to suspect Ubuntu 7.1 has a defective glibc, because -mt is rock steady on my Fedora box.

Re: SDLMAME 0.120u1 is up [Re: R. Belmont] #35027 10/26/07 03:52 AM
Joined: Jun 2007
Posts: 107
B
Brass Offline
Senior Member
Offline
Senior Member
B
Joined: Jun 2007
Posts: 107
I'm running Fedora 6.

Page 2 of 4 1 2 3 4

Moderated by  R. Belmont 

Who's Online Now
3 registered members (Vas Crabb, Monotremata, 1 invisible), 45 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
ShoutChat Box
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics8,818
Posts116,083
Members4,915
Most Online890
Jan 17th, 2020
Powered by UBB.threads™ PHP Forum Software 7.7.3