Skip to contentSkip to conversation

meta-emenlow: fix ptr->int and Werror=address compile errors

PATCH New Tom Zanussi 1 participant 1 message Jan 11, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 meta-emenlow: fix ptr->int and Werror=address compile errors

A couple of things that had previously been warnings are now errors, so they need to be fixed up.

The first problem is the same problem encountered by xserver-kdrive, and has the same fix, namely create a new version of REGION_INIT and have all calls that pass in a pointer to a static struct use it instead. A different fix for this is upstream, which includes an API change; we don't need all that to fix this problem.

The second problem is a cast from pointer to integer in fbdevhw.c. This also is fixed upstream by removing the whole section of code which is bogus anyway, which is also done here.

---
 .../xorg-xserver/files/ptr-to-int-cast-fix.patch   |   92 ++++
 .../xorg-xserver/files/werror-address-fix.patch    |  515 ++++++++++++++++++++
 .../xorg-xserver/xserver-psb-1.7.99.2.inc          |    6 +-
 3 files changed, 611 insertions(+), 2 deletions(-)
 create mode 100644 meta-emenlow/recipes-graphics/xorg-xserver/files/ptr-to-int-cast-fix.patch
 create mode 100644 meta-emenlow/recipes-graphics/xorg-xserver/files/werror-address-fix.patch
meta-emenlow/recipes-graphics/xorg-xserver/files/ptr-to-int-cast-fix.patch new file +92 -0
new file mode 100644
index 0000000..19574d0
@@ -0,0 +1,92 @@
+Upstream-Status: Inappropriate [already upstream]
+
+It's broken for devices with BARs above 4G, and the sysfs method should         
+work everywhere anyway.  As a pleasant side effect, this fixes some             
+warnings:                                                                       
+                                                                                
+fbdevhw.c: In function 'fbdev_open_pci':                                        
+fbdevhw.c:333:4: warning: cast from pointer to integer of different size        
+fbdevhw.c:334:4: warning: cast from pointer to integer of different size        
+fbdevhw.c:336:4: warning: cast from pointer to integer of different size        
+fbdevhw.c:337:4: warning: cast from pointer to integer of different size        
+                                                                                
+Signed-off-by: Adam Jackson <ajax (a] redhat.com>                                   
+Integrated-by: Tom Zanussi <tom.zanussi (a] intel.com>
+
+Index: xorg-server-1.7.99.2/hw/xfree86/fbdevhw/fbdevhw.c
+===================================================================
+--- xorg-server-1.7.99.2.orig/hw/xfree86/fbdevhw/fbdevhw.c	2012-01-10 22:08:26.466693355 -0600
++++ xorg-server-1.7.99.2/hw/xfree86/fbdevhw/fbdevhw.c	2012-01-10 22:11:36.386936978 -0600
+@@ -291,14 +291,7 @@
+ {
+     struct	fb_fix_screeninfo fix;
+     char	filename[256];
+-    int	fd,i,j;
+-
+-
+-    /* There are two ways to that we can determine which fb device is
+-     * associated with this PCI device.  The more modern way is to look in
+-     * the sysfs directory for the PCI device for a file named
+-     * "graphics/fb*"
+-     */
++    int	fd, i;
+ 
+     for (i = 0; i < 8; i++) {
+ 	sprintf(filename, 
+@@ -331,55 +324,10 @@
+ 	}
+     }
+ 
+-
+-    /* The other way is to examine the resources associated with each fb
+-     * device and see if there is a match with the PCI device.  This technique
+-     * has some problems on certain mixed 64-bit / 32-bit architectures.
+-     * There is a flaw in the fb_fix_screeninfo structure in that it only
+-     * returns the low 32-bits of the address of the resources associated with
+-     * a device.  However, on a mixed architecture the base addresses of PCI
+-     * devices, even for 32-bit applications, may be higher than 0x0f0000000.
+-     */
+-
+-    for (i = 0; i < 8; i++) {
+-	sprintf(filename,"/dev/fb%d",i);
+-	if (-1 == (fd = open(filename,O_RDWR,0))) {
+-	    xf86DrvMsg(-1, X_WARNING,
+-		       "open %s: %s\n", filename, strerror(errno));
+-	    continue;
+-	}
+-	if (-1 == ioctl(fd,FBIOGET_FSCREENINFO,(void*)&fix)) {
+-	    close(fd);
+-	    continue;
+-	}
+-	for (j = 0; j < 6; j++) {
+-	    const pciaddr_t res_start = pPci->regions[j].base_addr;
+-	    const pciaddr_t res_end = res_start + pPci->regions[j].size;
+-
+-	    if ((0 != fix.smem_len &&
+-		 (pciaddr_t) fix.smem_start >= res_start &&
+-		 (pciaddr_t) fix.smem_start < res_end) ||
+-		(0 != fix.mmio_len &&
+-		 (pciaddr_t) fix.mmio_start >= res_start &&
+-		 (pciaddr_t) fix.mmio_start < res_end))
+-	      break;
+-	}
+-	if (j == 6) {
+-	    close(fd);
+-	    continue;
+-	}
+-	if (namep) {
+-	    *namep = xnfalloc(16);
+-	    strncpy(*namep,fix.id,16);
+-	}
+-	return fd;
+-    }
+-
+     if (namep)
+       *namep = NULL;
+ 
+-    xf86DrvMsg(-1, X_ERROR,
+-	       "Unable to find a valid framebuffer device\n");
++    xf86DrvMsg(-1, X_ERROR, "Unable to find a valid framebuffer device\n");
+     return -1;
+ }
+ 
meta-emenlow/recipes-graphics/xorg-xserver/files/werror-address-fix.patch new file +515 -0

515 lines not on this page · raw message

meta-emenlow/recipes-graphics/xorg-xserver/xserver-psb-1.7.99.2.inc +4 -2
index 0faee5e..9ee9c97 100644
@@ -1,4 +1,4 @@
-PR = "r4"
+PR = "r5"
 
 PROTO_DEPS += "xf86driproto dri2proto"
 
@@ -6,7 +6,9 @@ DEPENDS += "font-util"
 
 SRC_URI += "file://nodolt.patch \
             file://crosscompile.patch \
-	    file://libdrm-poulsbo.patch"
+	    file://libdrm-poulsbo.patch \
+	    file://werror-address-fix.patch \
+	    file://ptr-to-int-cast-fix.patch"
 
 # Misc build failure for master HEAD
 SRC_URI += "file://fix_open_max_preprocessor_error.patch"
Signature · 1 line
1.7.0.4