This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Dri-devel] Re: OpenGL and the LinuxThreads pthread_descr structure


On Fri, May 17, 2002 at 10:48:07AM +0100, Keith Whitwell wrote:
> Yes, we've been aware of this for a little while.  One thing that we've got a
> bit of in there is assembly for the non-threaded dispatch case (the opensource
> libGL.so doesn't really handle the threaded case in a performant way, but
> we've made some effort on the non-threaded case), that looks a bit like this:
> 
> ALIGNTEXT16
> GLOBL_FN(GL_PREFIX(NewList))
> GL_PREFIX(NewList):
> 	MOV_L(GLNAME(_glapi_Dispatch), EAX)
> 	JMP(GL_OFFSET(_gloffset_NewList))
> 
> This generates the library entrypoint 'glNewList', which just grabs the active
> dispatch table and jumps to the real function.  I had some emails with HJ Lu
> about this, but didn't really get what he was saying.  Are these a problem for
> building with -fPIC?  I'm not really interested in giving this up as I believe
> any benefits from -fPIC will be quickly outweighed by any loss at the dispatch
> layer.

Well, if you do this, you should at least put this into an
.section Gltext, "awx"
so that it is not DT_TEXTREL.
But I still wonder, how often will the target this jumps to change
during lifetime of typical GL application if using GLX extensions.
Won't it be most of the time the __indirect_* variant, even for threaded
apps? Or are they being changed between __indirect_*, noop and
software rendering all the time in typical application?
If changing it is rare, I think my proposal with jmp something; nop; nop; nop
and changing it at setdispatch time if something changed should be faster.

Other things: concerning compsize.c routines, I think they should be
at least inlined if not killed and replaced by switch () statements
doing copy by hand (with fallthrough's).
When they are out of line, gcc cannot even guess what values it has, has
to do the multiplication at runtime and call memcpy, which is a hop through
.plt and you loose the information that you're e.g. copying only 1, 2 or 4
words.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]