DRM_CAS bug with x86_64

Bernardo Innocenti bernie at develer.com
Mon Aug 8 14:21:57 PDT 2005


Hello,

this patch fixes two x86_64 problems in Xorg.  These changes
should probably be propagated upstream to Mesa and DRM
(both lists are in Cc).

GAS choked on the DRM_CAS invocation in ffb_lock.h because
__ret was declared as "int" and so it gets passed in %edx
instead of %dl or %dh as required by the setnz instruction.
I just wrapped the declaration with DRM_CAS_RESULT() as done
elsewhere.

I also noticed that the various copies of xf86drm.h are slightly
out of sync.  One copy used __AMD64__, which isn't a valid GCC
predefine.  So the slow version of DRM_CAS was being used on x86_64.


Index: ./extras/drm/libdrm/xf86drm.h
===================================================================
RCS file: /cvs/xorg/xc/extras/drm/libdrm/xf86drm.h,v
retrieving revision 1.1.1.2
diff -u -p -r1.1.1.2 xf86drm.h
--- ./extras/drm/libdrm/xf86drm.h	15 Jun 2005 18:31:52 -0000	1.1.1.2
+++ ./extras/drm/libdrm/xf86drm.h	8 Aug 2005 21:06:14 -0000
@@ -287,7 +287,7 @@ typedef struct _drmSetVersion {
 #define DRM_LOCK_CONT  0x40000000U /**< Hardware lock is contended */
 
 #if defined(__GNUC__) && (__GNUC__ >= 2)
-# if defined(__i386) || defined(__AMD64__)
+# if defined(__i386) || defined(__amd64__)
 				/* Reflect changes here to drmP.h */
 #define DRM_CAS(lock,old,new,__ret)                                    \
 	do {                                                           \
Index: extras/Mesa/src/mesa/drivers/dri/ffb/ffb_lock.h
===================================================================
RCS file: /cvs/xorg/xc/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_lock.h,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 ffb_lock.h
--- extras/Mesa/src/mesa/drivers/dri/ffb/ffb_lock.h	16 Jun 2004 09:17:59 -0000	1.1.1.1
+++ extras/Mesa/src/mesa/drivers/dri/ffb/ffb_lock.h	8 Aug 2005 21:06:14 -0000
@@ -15,7 +15,7 @@ extern void ffbXMesaUpdateState(ffbConte
 #else
 #define LOCK_HARDWARE(fmesa)				\
   do {							\
-    int __ret=0;					\
+    DRM_CAS_RESULT(__ret);				\
     DRM_CAS(fmesa->driHwLock, fmesa->hHWContext,	\
 	    (DRM_LOCK_HELD | fmesa->hHWContext), __ret);\
     if (__ret) {					\


-- 
  // Bernardo Innocenti - Develer S.r.l., R&D dept.
\X/  http://www.develer.com/




More information about the xorg mailing list