The DRI code makes invalid assumptions about page size being 
4k.  Most (all?) non x86 architectures use page sizes larger 
than 4k (alpha, ia64, etc..).

I don't know how portable the patch is, but it has worked fine in 
Red Hat Linux for quite some time now.  An alternative to using 
getpagesize() would be to have compile time conditional code, 
however that is a problem on some architectures, since some 
architectures have pagesize that is variable depending on the 
kernel you're using, etc.

So I'm not sure if this is the best/most flexible solution or 
not, but it has at least worked now for us for quite a while, 
needing only slight changes with new XFree86 releases to patch 
cleanly.

Please apply.


-- 
Mike A. Harris                  Shipping/mailing address:
OS Systems Engineer             190 Pittsburgh Ave., Sault Ste. Marie,
XFree86 maintainer              Ontario, Canada, P6C 5B3
Red Hat Inc.
http://www.redhat.com           ftp://people.redhat.com/mharris
--- xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c.foo        Sun Aug  5 
16:23:24 2001
+++ xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c    Sun Aug  5 16:23:41 
+2001
@@ -405,7 +405,7 @@
      * for SAREA mapping that includes a device private record
      */
     pDRIInfo->SAREASize = 
-       ((sizeof(XF86DRISAREARec) + 0xfff) & 0x1000); /* round to page */
+       ((sizeof(XF86DRISAREARec) + getpagesize() -1) & getpagesize()); /* round to 
+page */
        /* + shared memory device private rec */
 #else
     /* For now the mapping works by using a fixed size defined
--- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c.foo    Sun Aug  5 16:22:27 
2001
+++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c        Sun Aug  5 16:17:10 
+2001
@@ -237,7 +237,7 @@
    * for SAREA mapping that includes a device private record
    */
   pDRIInfo->SAREASize = 
-    ((sizeof(XF86DRISAREARec) + 0xfff) & 0x1000); /* round to page */
+    ((sizeof(XF86DRISAREARec) + getpagesize() - 1) & getpagesize()); /* round to page 
+*/
   /* + shared memory device private rec */
 #else
   /* For now the mapping works by using a fixed size defined
--- xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c.foo  Sun Aug  5 16:21:32 
2001
+++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c      Sun Aug  5 16:23:13 
+2001
@@ -357,7 +357,7 @@
    * for SAREA mapping that includes a device private record
    */
   pDRIInfo->SAREASize =
-    ((sizeof(XF86DRISAREARec) + 0xfff) & 0x1000); /* round to page */
+    ((sizeof(XF86DRISAREARec) + getpagesize() - 1) & getpagesize()); /* round to page 
+*/
   /* + shared memory device private rec */
 #else
   /* For now the mapping works by using a fixed size defined

Reply via email to