DRM_CAS bug with x86_64

Ian Romanick idr at us.ibm.com
Mon Aug 8 15:29:57 PDT 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Bernardo Innocenti wrote:

> 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.

This seems to have never hit us because on x86 the FFB driver no-ops its
LOCK_HARDWARE and UNLOCK_HARDWARE macros.  Can somebody please explain
why that is?  My *guess* is that FFB hardware can only actually exist on
SPARC.  If that's the case, shouldn't the conditional be changed from
'#if defined(__i386__)' to '#if !defined(sparc)' or something similar?
A comment explaining it would also be nice. ;)

> 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) {					\
> 
> 

This looks good *and* fixes the build on my x86-64 box.  Since my
company's policy doesn't permit me to commit other people's patches, can
someone else on the project please do it?  ajax?  Someone? :)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFC99zlX1gOwKyEAw8RAprHAJ9poVmJuj8scfimIovd0nTWHD/KjACdEnXM
Sf+vF9M/kwy1msgJeQ/X22Y=
=L3Ax
-----END PGP SIGNATURE-----



More information about the xorg mailing list