Bug 2996

Summary: libglx / libGLcore should use a dispatch table
Product: DRI Reporter: Ian Romanick <idr>
Component: GeneralAssignee: Default DRI bug account <dri-devel>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: high    
Version: XOrg git   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 2994    
Attachments:
Description Flags
Server-side Mesa patch
none
Allows X.org to use Mesa CVS
none
Make server-size GLX use autogenerated "size" code.
none
Make server-size GLX use autogenerated dispatch code.
none
Make server-side GLX use autogenerated dispatch code, version 02
none
Make server-size GLX use autogenerated "size" code, version 02
none
Make server-side GLX use autogenerated dispatch code, version 03
none
New size and dispatch patch for modular build. none

Description Ian Romanick 2005-04-12 09:16:17 UTC
All of the GLX protocol handler functions in libglx call static GL functions
(e.g., glVertex3fv) exported by libGLcore.  Instead of doing it like this, the
GLX protocol handler functions should work like the static dispatch functions in
the client-side libGL.  That is, they should use a dispatch table that is set up
by the driver (i.e., libGLcore).  Instead of calling glVertex3fv,
_glapi_dispatch->Vertex3fv would be called.

This bug is primarilly a place-holder for patches.
Comment 1 Ian Romanick 2005-04-13 11:50:27 UTC
Created attachment 2408 [details] [review]
Server-side Mesa patch

Changes to Mesa required for all future server-side patches.  Adds a new script
to src/mesa/glapi (glX_proto_recv.py) that is used to generate the server-side
code that processes GLX protocol and dispatches the function calls.  The
server-side code is generated by setting XORG_BASE in src/mesa/glapi/Makefile
and invoking the Makefile with 'make server'.
Comment 2 Ian Romanick 2005-04-13 11:53:24 UTC
Created attachment 2409 [details] [review]
Allows X.org to use Mesa CVS

After setting MesaSrcDir and DRMSrcDir in config/cf/host.def to point at Mesa
CVS and DRM CVS, this patch allows the X.org build to work.

This patch is also required for all the future patches.
Comment 3 Ian Romanick 2005-04-13 12:04:09 UTC
Created attachment 2410 [details] [review]
Make server-size GLX use autogenerated "size" code.

Apply this patch after the other 2.  This makes the server-side GLX code use
the "size" functions generated by the glX_proto_size.py script.
Comment 4 Ian Romanick 2005-04-13 12:28:50 UTC
Created attachment 2411 [details] [review]
Make server-size GLX use autogenerated dispatch code.

This is the last of the patches (for now).  This one does two things.  First,
it makes the server-side code use the GLX protocol handling functions generated
by glX_proto_recv.py.  Second, it eliminiates the need for the static GL
dispatch functions in libGLcore by using the dispatch pointer directly.
Comment 5 Ian Romanick 2005-04-13 12:41:40 UTC
Applying all 4 of the current patches to Mesa CVS and Xorg CVS should resolve
this issue.  Before this code can find its way into CVS, there are a couple
issues that still need to be resolved.

1. Byte-swapping code.  The old SGI code used some really slow (as admitted by
comments in the code) routines for doing byte-swapping.  The new autogenerated
code uses Linux-specific routines from byteswap.h.  This ensures that optimial,
in many cases a single instruction, routines are used for byte-swapping. 
However, this is not portable.  An abstraction layer and OS-specific glue is
needed here.

2. Symbol visibility.  After having used the autogenerated HIDDEN stuff for a
couple months now, I can honestly say that I don't like it.  Something better
needs to be done for HIDDEN, INTERNAL, PURE, FASTCALL, and other future
annotations.  The best answer might be to just put all of that in glxserver.h,
glcore.h, dri_interface.h, or some similar, global include file.

3. Darwin hacks.  Since the static dispatch functions are no longer used and the
driver (libGLcore) can setup the dispatch table however it sees fit, all of the
#ifdef stuff to work around missing functions in older versions of OS X should
be removed.

Also, I didn't realize that the last two patches were so huge (140KiB and
460KiB).  If I had realized that, I would have compressed them before uploading.
 Sorry.
Comment 6 Ian Romanick 2005-04-13 15:28:35 UTC
Created attachment 2416 [details] [review]
Make server-side GLX use autogenerated dispatch code, version 02

Very small update to attachment #2411 [details] [review].	No functional changes, but this does
remove a large number of compiler warnings caused by a couple missing
prototypes and missing includes.
Comment 7 Ian Romanick 2005-09-26 15:37:59 UTC
Comment on attachment 2409 [details] [review]
Allows X.org to use Mesa CVS

The version of Mesa CVS supported by this patch has sense been merged into
X.org CVS.
Comment 8 Ian Romanick 2005-09-26 15:38:11 UTC
Comment on attachment 2408 [details] [review]
Server-side Mesa patch

The version of Mesa CVS supported by this patch has sense been merged into
X.org CVS.
Comment 9 Ian Romanick 2005-10-11 09:28:16 UTC
Created attachment 3543 [details] [review]
Make server-size GLX use autogenerated "size" code, version 02

This updates the previous server-side generated "size" code patch for current
Xorg CVS.  In addition, this patch eliminates the /requirement/ for byteswap.h
and bswap_*.  That header file only exists on Linux.  As such, it is only used
on Linux.  Non-Linux systems fallback to the crufty macros in X11/misc.h.

To apply this patch, cd to xc, and do 'patch -p1 -E < Xorg-new-size-02.patch'.
Comment 10 Ian Romanick 2005-10-11 10:13:52 UTC
Created attachment 3544 [details] [review]
Make server-side GLX use autogenerated dispatch code, version 03

This updates the previous server-side generated dispatch code patch for current

Xorg CVS.

This patch still needs some cleaning to remove the dependency on Linux's
byteswap.h.

To apply this patch, cd to xc, and do 'patch -p1 -E < Xorg-dispatch-03.patch'. 
This patch assumes that Xorg-new-size-02.patch has already been applied!

To use this patch, you MUST build against the Mesa 6.4 tree.  There are a
couple changes (relative to the version of Mesa in xc/extras/Mesa) in that tree
that are required by this patch.  Without those changes, the build will fail.
Comment 11 Ian Romanick 2006-01-12 11:01:48 UTC
Created attachment 4330 [details] [review]
New size and dispatch patch for modular build.

This patch unifies the old "size" and "dispath" patches.  In addition to the
changes in this patch, the entire xorg/GL/mesa/glapi directory will go away.
Comment 12 Kristian Høgsberg 2006-04-04 08:48:58 UTC
This is in HEAD now, closing bug.

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.