[PATCH 1/4] modesetting: Fix 32bit breakage

Takashi Iwai tiwai at suse.de
Mon Feb 16 22:13:10 PST 2015


At Tue, 17 Feb 2015 12:15:04 +0900,
Michel Dänzer wrote:
> 
> On 17.02.2015 01:00, Takashi Iwai wrote:
> > The current modesetting driver fails with cirrus KMS and others on
> > 32bit architecture.  It aborts at mmap() call failure in dumb_bo.c,
> > and it's because the offset is passed as 32bit off_t; this truncates
> > DRM_FILE_PAGE_OFFSET bit and the KMS driver refuses the value.
> > 
> > This is an ad hoc fix just to let 64bit off_t being used for mmap() by
> > adding _FILE_OFFSET_BITS=64.
> > 
> > Signed-off-by: Takashi Iwai <tiwai at suse.de>
> > ---
> >  hw/xfree86/drivers/modesetting/dumb_bo.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/hw/xfree86/drivers/modesetting/dumb_bo.c b/hw/xfree86/drivers/modesetting/dumb_bo.c
> > index 58d420e07568..29948d453a1a 100644
> > --- a/hw/xfree86/drivers/modesetting/dumb_bo.c
> > +++ b/hw/xfree86/drivers/modesetting/dumb_bo.c
> > @@ -25,6 +25,8 @@
> >   *
> >   */
> >  
> > +#define _FILE_OFFSET_BITS	64
> > +
> 
> This is what AC_SYS_LARGEFILE is for in configure.ac. Does this work
> instead?

I guess it would work, too, but this touches all over the code, so I'm
afraid of a possible regression somewhere.  That's why I took a
band-aid fix at this time.


thanks,

Takashi

> 
> 
> diff --git a/include/dix-config.h.in b/include/dix-config.h.in
> index 1aa77a5..b0eb696 100644
> --- a/include/dix-config.h.in
> +++ b/include/dix-config.h.in
> @@ -388,9 +388,15 @@
>  /* Vendor name */
>  #undef XVENDORNAME
> 
> +/* Number of bits in a file offset, on hosts where this is settable. */
> +#undef _FILE_OFFSET_BITS
> +
>  /* Enable GNU and other extensions to the C environment for GLIBC */
>  #undef _GNU_SOURCE
> 
> +/* Define for large files, on AIX-style hosts. */
> +#undef _LARGE_FILES
> +
>  /* Define to empty if `const' does not conform to ANSI C. */
>  #undef const
> 
> 
> 
> -- 
> Earthling Michel Dänzer               |               http://www.amd.com
> Libre software enthusiast             |             Mesa and X developer
> 


More information about the xorg-devel mailing list