Bug 5835

Summary: xorg-server use wrong datatypes compiling glcontextmodes.c imported from Mesa
Product: Mesa Reporter: Igor V. Kovalenko <garrison>
Component: GLXAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact:
Severity: blocker    
Priority: high CC: dberkholz, mharris
Version: 6.4   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 5387    
Attachments: Patch to include dix-config.h before X.h if compiling from within xorg-server
mesa-6.4.2-xorg-server-uses-bad-datatypes-breaking-AMD64-fdo5835.patch
patch to include dix-config.h
making sure HAVE_DIX_CONFIG_H is defined
Adds -D_XSERVER64 to CFLAGS when building glx and mesa sources in 64bit machines

Description Igor V. Kovalenko 2006-02-07 19:03:08 UTC
The problem is that glcontextmodes.c being imported from Mesa sources to GL/glx
module of xorg-server does not include necessary server-related configuration
files. This is resulting in e.g. VisualID being typedef'd differently from other
glx files at least on amd64.
Therefore attempt to copy visual config using glcontextmodes.c results in
off-by-4byte error, and blue bits size is copied from alpha bit size, which
preclude detection of matching visuals later.
Comment 1 Igor V. Kovalenko 2006-02-07 19:04:14 UTC
Created attachment 4573 [details] [review]
Patch to include dix-config.h before X.h if compiling from within xorg-server
Comment 2 Mike A. Harris 2006-02-08 20:56:31 UTC
Created attachment 4578 [details] [review]
mesa-6.4.2-xorg-server-uses-bad-datatypes-breaking-AMD64-fdo5835.patch

This is the patch I've applied to Red Hat packages for Fedora Core, which has
been confirmed to resolve the problem:

https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=176976
Comment 3 Brian Paul 2006-02-09 01:48:23 UTC
OK, I've checked in this patch to Mesa CVS, both the 6.4 branch and the trunk.
Closing bug now.
Comment 4 Igor V. Kovalenko 2006-02-09 19:14:21 UTC
(In reply to comment #3)
> OK, I've checked in this patch to Mesa CVS, both the 6.4 branch and the trunk.
> Closing bug now.

Brian, you should have committed the second patch which was actually discussed
on xorg-devel and tested by Mike's users. Though the only diff is removed
conditional on XFree86Server.
Comment 5 Brian Paul 2006-02-10 01:24:27 UTC
OK, fixed.
Comment 6 David Reveman 2006-02-15 02:34:44 UTC
Still not fixed for me. glcontextmodes.c is not the only file that needs to
include dix-config.h. Any file that end up including X.h will need dix-config.h.
Not sure exactly what files that is but including dix-config.h in glheader.h and
making sure HAVE_DIX_CONFIG is defined when building mesa sources in xorg works
for me. I'm attaching my mesa and xorg diffs.
Comment 7 David Reveman 2006-02-15 02:36:25 UTC
Created attachment 4608 [details] [review]
patch to include dix-config.h
Comment 8 David Reveman 2006-02-15 02:38:26 UTC
Created attachment 4609 [details] [review]
making sure HAVE_DIX_CONFIG_H is defined
Comment 9 Michel Dänzer 2006-02-15 02:47:19 UTC
(In reply to comment #6)
> Any file that end up including X.h will need dix-config.h.

Couldn't the #include <dix-config.h> be added to X.h itself then?
Comment 10 David Reveman 2006-02-15 03:20:32 UTC
X.h is part of the xproto package. It would be a bit ugly to have it include an
xorg server config.h file.

I think the best would be to have the server add -D_XSERVER64 to it's CFLAGS
(when building glx and glcore) as then we wouldn't have to worry about having
the mesa sources include dix-config.h.
Comment 11 Michel Dänzer 2006-02-15 03:27:09 UTC
(In reply to comment #10)
> X.h is part of the xproto package. It would be a bit ugly to have it include an
> xorg server config.h file.

I agree, but doesn't that apply to glheader.h in the Mesa tree as well?

I completely agree that this should ideally be solved in the xserver tree, but
if I had to choose between glheader.h and X.h, I'd choose the latter because
that would also cover other similar problems that may lurk somewhere.
Comment 12 David Reveman 2006-02-15 10:21:41 UTC
glheader.h is at least not installed on the system.

I've made a patch for xorg that adds -D_XSERVER64 to GLX_CFLAGS on 64bit
machines and GLX_CFLAGS is added to CFLAGS when building all mesa sources. This
should work OK and we don't have to modify Mesa at all. I'll commit this patch
to the xgl branch once I've verified that it works.
Comment 13 David Reveman 2006-02-15 10:24:08 UTC
Created attachment 4610 [details] [review]
Adds -D_XSERVER64 to CFLAGS when building glx and mesa sources in 64bit machines
Comment 14 Daniel Stone 2006-02-15 14:58:33 UTC
this is the exact reason dix-config.h was created.  new files that are going to
be compiled in the server should be using it.  if dix-config.h inclusion is not
guaranteed, then a whole bunch of assumptions the build system makes are
invalid, and we're back to the bad old days of everything ever in CFLAGS.  so
please just make all the relevant files include dix-config.h.
Comment 15 David Reveman 2006-02-15 15:34:37 UTC
OK. That means all mesa source files need to include dix-config.h. My glheader.h
patch seams like the best way to accomplish that.

I've already committed my CFLAGS patch to xorg xgl branch but I'll back that out
as soon as mesa sources include dix-config.h properly.
Comment 16 Eric Anholt 2006-02-16 13:38:45 UTC
Fixed in HEAD and xgl-0-0-1 as of today.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.