This patch fixes two problems with the version requirement check for the Linux agpgart module in kdrive and libdrm.a:
1. The current code has faulty logic which prevents an error from ocurring if the major version number of agpgart is equal to that required, but the minor version is less than that required. 2. The current code will raise an error if the agpgart major version number is higher than that required. Dave Jones, the current agpgart maintainer, submitted some agp changes to the 2.5 kernel tree and bumped the version number of agpgart from 0.99 to 1.0. This broke compatiblity with current XFree86 versions, despite the fact that the interface hasn't changed, so he had to change the version number to 0.100. I asked Dave if a patch to XFree86 could assume future backwards compatibility and he said: Given that any breakage would screw over the freebsd folks too, I'm inclined to do whatever I can to maintain backwards compatability. For now, I'm going to bump through 0.99 -> 0.100 -> 0.whatever as that matches the existing code, so we don't need to break existing X setups. Fixing this would be good for the future however, so one day, we can go to 1.0. So my patch will only produce an error if the agpgart version is earlier than the one required, assuming backwards compatibility in future versions. This will allow bumping the agpgart major version some time in the future, and still allows the agpgart version requirement in XFree86 to be bumped if new functionality is required from a future agpgart version (which again is assumed to also retain the original interface). I plan to commit this to the DRI cvs HEAD. Please apply this to XFree86 cvs so it can be included in XFree86 4.3.0. Thanks. -- Leif Delgass http://www.retinalburn.net
Index: xc/programs/Xserver/hw/kdrive/linux/agp.c =================================================================== RCS file: /cvsroot/dri/xc/xc/programs/Xserver/hw/kdrive/linux/agp.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 agp.c --- xc/programs/Xserver/hw/kdrive/linux/agp.c 9 Apr 2001 16:27:42 -0000 1.1.1.1 +++ xc/programs/Xserver/hw/kdrive/linux/agp.c 10 Dec 2002 20:51:02 -0000 @@ -120,9 +120,16 @@ KdReleaseGART(-1); #if defined(linux) - /* Should this look for version >= rather than version == ? */ - if (agpinf.version.major != AGPGART_MAJOR_VERSION && - agpinf.version.minor != AGPGART_MINOR_VERSION) { + /* Per Dave Jones, evey effort will be made to keep the + * agpgart interface backwards compatible, so allow all + * future versions. + */ + if ( +#if (AGPGART_MAJOR_VERSION > 0) /* quiet compiler */ + agpinf.version.major < AGPGART_MAJOR_VERSION || +#endif + (agpinf.version.major == AGPGART_MAJOR_VERSION && + agpinf.version.minor < AGPGART_MINOR_VERSION)) { fprintf(stderr, "Kernel agpgart driver version is not current" " (%d.%d vs %d.%d)\n", Index: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c =================================================================== RCS file: /cvsroot/dri/xc/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c,v retrieving revision 1.5 diff -u -r1.5 lnx_agp.c --- xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c 11 Sep 2002 00:57:49 -0000 1.5 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c 10 Dec 2002 20:51:03 +-0000 @@ -89,9 +89,16 @@ xf86ReleaseGART(-1); #if defined(linux) - /* Should this look for version >= rather than version == ? */ - if (agpinf.version.major != AGPGART_MAJOR_VERSION && - agpinf.version.minor != AGPGART_MINOR_VERSION) { + /* Per Dave Jones, evey effort will be made to keep the + * agpgart interface backwards compatible, so allow all + * future versions. + */ + if ( +#if (AGPGART_MAJOR_VERSION > 0) /* quiet compiler */ + agpinf.version.major < AGPGART_MAJOR_VERSION || +#endif + (agpinf.version.major == AGPGART_MAJOR_VERSION && + agpinf.version.minor < AGPGART_MINOR_VERSION)) { xf86DrvMsg(screenNum, X_ERROR, "GARTInit: Kernel agpgart driver version is not current" " (%d.%d vs %d.%d)\n",