[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#170690: xlibmesa3: DRI drivers may run 3dnow instructions on Pentium 4

On Mon, 2002-11-25 at 09:41, Olaf Weber wrote: 
> My laptop has a Mobile Pentium 4 processor and Radeon 7500c gfx.  I found
> that with xlibmesa3 installed and DRI enabled any program that uses OpenGL
> would die with a SIGILL in the radeon_dri.so library.
> Investigation revealed that the problem occurred in code containing 3dnow
> instructions -- setting MESA_NO_3DNOW prevented the crashes.  This in turn
> is due to the way the library obtains the capability information for cpus:
> it uses CPUID to get the capability bitvectors and passes those around
> unchanged.  This worked while the bits AMD uses to signal the availability
> of 3DNOW were not used by intel as well.  In the pentium 4 family, this
> assumption no longer holds.
> The code that does the probe is found in
> 	xc/extras/Mesa/src/X86/common_x86_asm.S
> The obvious quick fix would be to mask the problematic bits in the intel
> branch of the code before returning the bitvector.  A more complete fix
> would be to not use the CPU's capability vector directly, but instead use
> it to construct a cability vector for the library.

The attached patch is how this was fixed in DRI and XFree86 CVS.

Earthling Michel Dänzer (MrCooper)/ Debian GNU/Linux (powerpc) developer
XFree86 and DRI project member   /  CS student, Free Software enthusiast
Index: extras/Mesa/src/X86/common_x86_asm.S
RCS file: /cvsroot/dri/xc/xc/extras/Mesa/src/X86/common_x86_asm.S,v
retrieving revision 1.14
retrieving revision 1.15
diff -p -u -r1.14 -r1.15
--- extras/Mesa/src/X86/common_x86_asm.S	22 Oct 2002 23:38:09 -0000	1.14
+++ extras/Mesa/src/X86/common_x86_asm.S	9 Nov 2002 17:44:32 -0000	1.15
@@ -117,6 +117,11 @@ GLNAME( _mesa_identify_x86_cpu_features 
 	MOV_L	( CONST(0x1), EAX )
 	MOV_L	( EDX, EAX )
+	/* Mask out highest bit, which is used by AMD for 3dnow
+         * Newer Intel have this bit set, but do not support 3dnow 
+ 	 */
+        AND_L   ( CONST(0X7FFFFFFF), EAX)
 	JMP	( LLBL(cpuid_done) )

Reply to: