Index: ChangeLog =================================================================== RCS file: /cvs/xorg/xc/ChangeLog,v retrieving revision 1.1587 diff -u -d -b -w -r1.1587 ChangeLog --- ChangeLog 21 Dec 2005 19:35:09 -0000 1.1587 +++ ChangeLog 31 May 2006 22:08:56 -0000 @@ -1,3 +1,27 @@ +2006-05-31 Torrey T. Lyons + + * extras/Mesa/src/mesa/main/dispatch.c: + Remove Mac OS X specific hack. + + * lib/GL/apple/dri_dispatch.c: + * lib/GL/apple/dri_dispatch.defs: + * lib/GL/apple/dri_dispatch.h: + * lib/GL/apple/dri_driver.c: (driMesaFindDrawableByUID), + (driMesaUnbindContext), (DoBindContext), (driMesaBindContext), + (driMesaCreateSurface), (driMesaCreateNewDrawable), + (driCreatePixelFormat), (driMesaDestroyContext), + (driMesaCreateNewContext), (driMesaCreateContext), + (driMesaDestroyScreen), (driMesaCreateNewScreen), + (__driCreateNewScreen): + * lib/GL/apple/dri_driver.h: + * lib/GL/apple/dri_glx.c: (driCreateDisplay): + * lib/GL/apple/dri_glx.h: + * lib/GL/glx/Imakefile: + * lib/GL/mesa/main/Imakefile.inc: + * programs/Xserver/GL/mesa/GLcore/Imakefile: + * programs/Xserver/Imakefile: + Fix building on Mac OS X when using AppleDRI. + 2005-12-21 Alan Coopersmith * config/cf/xorgversion.def: Index: extras/Mesa/src/mesa/main/dispatch.c =================================================================== RCS file: /cvs/xorg/xc/extras/Mesa/src/mesa/main/dispatch.c,v retrieving revision 1.1.1.2 diff -u -d -b -w -r1.1.1.2 dispatch.c --- extras/Mesa/src/mesa/main/dispatch.c 31 Jul 2005 16:46:53 -0000 1.1.1.2 +++ extras/Mesa/src/mesa/main/dispatch.c 31 May 2006 22:08:58 -0000 @@ -37,8 +37,6 @@ * \author Brian Paul */ -#ifndef GLX_USE_APPLEGL - #include "glheader.h" #include "glapi.h" #include "glapitable.h" @@ -91,5 +89,3 @@ #include "glapitemp.h" #endif /* USE_X86_ASM */ - -#endif /* !GLX_USE_APPLEGL */ Index: lib/GL/apple/dri_dispatch.c =================================================================== RCS file: /cvs/xorg/xc/lib/GL/apple/dri_dispatch.c,v retrieving revision 1.5 diff -u -d -b -w -r1.5 dri_dispatch.c --- lib/GL/apple/dri_dispatch.c 3 Jul 2005 07:00:55 -0000 1.5 +++ lib/GL/apple/dri_dispatch.c 31 May 2006 22:09:00 -0000 @@ -124,7 +124,7 @@ #include "dri_dispatch.h" -__private_extern__ const CGLContextObj +__private_extern__ CGLContextObj XAppleDRIGetIndirectContext (void) { static CGLContextObj ctx; Index: lib/GL/apple/dri_dispatch.defs =================================================================== RCS file: /cvs/xorg/xc/lib/GL/apple/dri_dispatch.defs,v retrieving revision 1.5 diff -u -d -b -w -r1.5 dri_dispatch.defs --- lib/GL/apple/dri_dispatch.defs 18 Aug 2004 23:12:49 -0000 1.5 +++ lib/GL/apple/dri_dispatch.defs 31 May 2006 22:09:00 -0000 @@ -57,7 +57,9 @@ ;; external entry point for the function (because it doesn't exist in ;; OpenGL.framework) -;; The ordering matches the Mesa api table, but that's not important +;; The ordering matches the Mesa api table, found in +;; Mesa/src/mesa/glapi/glapitemp.h, but that's not important. The +;; Mesa prototypes can be found in Mesa/include/GL/glext.h. ;; This table has some dependencies on the version of Mac OS X. ;; Currently the script used to process this table does not handle @@ -477,7 +479,8 @@ (void MultTransposeMatrixfARB 378 "const GLfloat * m") (void MultTransposeMatrixdARB 377 "const GLdouble * m") (void SampleCoverageARB 459 "GLclampf value, GLboolean invert") -(void __unused413 -1 "void") +(void DrawBuffersARB 654 "GLsizei n, const GLenum * bufs") +(void DrawBuffersATI -1 "GLsizei n, const GLenum * bufs" DrawBuffersARB) (void PolygonOffsetEXT -1 "GLfloat factor, GLfloat bias" PolygonOffset) (void GetTexFilterFuncSGIS -1 "GLenum target, GLenum filter, GLfloat * weights") (void TexFilterFuncSGIS -1 "GLenum target, GLenum filter, GLsizei n, const GLfloat * weights") @@ -668,32 +671,32 @@ (void RequestResidentProgramsNV -1 "GLsizei n, const GLuint * ids") (void TrackMatrixNV -1 "GLenum target, GLuint address, GLenum matrix, GLenum transform") (void VertexAttribPointerNV -1 "GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer") -(void VertexAttrib1dNV 477 "GLuint index, GLdouble x" VertexAttrib1dARB) -(void VertexAttrib1dvNV 490 "GLuint index, const GLdouble * v" VertexAttrib1dvARB) -(void VertexAttrib1fNV 476 "GLuint index, GLfloat x" VertexAttrib1fARB) -(void VertexAttrib1fvNV 489 "GLuint index, const GLfloat * v" VertexAttrib1fvARB) -(void VertexAttrib1sNV 475 "GLuint index, GLshort x" VertexAttrib1sARB) -(void VertexAttrib1svNV 488 "GLuint index, const GLshort * v" VertexAttrib1svARB) -(void VertexAttrib2dNV 480 "GLuint index, GLdouble x, GLdouble y" VertexAttrib2dARB) -(void VertexAttrib2dvNV 493 "GLuint index, const GLdouble * v" VertexAttrib2dvARB) -(void VertexAttrib2fNV 479 "GLuint index, GLfloat x, GLfloat y" VertexAttrib2fARB) -(void VertexAttrib2fvNV 492 "GLuint index, const GLfloat * v" VertexAttrib2fvARB) -(void VertexAttrib2sNV 478 "GLuint index, GLshort x, GLshort y" VertexAttrib2sARB) -(void VertexAttrib2svNV 491 "GLuint index, const GLshort * v" VertexAttrib2svARB) -(void VertexAttrib3dNV 483 "GLuint index, GLdouble x, GLdouble y, GLdouble z" VertexAttrib3dARB) -(void VertexAttrib3dvNV 496 "GLuint index, const GLdouble * v" VertexAttrib3dvARB) -(void VertexAttrib3fNV 482 "GLuint index, GLfloat x, GLfloat y, GLfloat z" VertexAttrib3fARB) -(void VertexAttrib3fvNV 495 "GLuint index, const GLfloat * v" VertexAttrib3fvARB) -(void VertexAttrib3sNV 481 "GLuint index, GLshort x, GLshort y, GLshort z" VertexAttrib3sARB) -(void VertexAttrib3svNV 494 "GLuint index, const GLshort * v" VertexAttrib3svARB) -(void VertexAttrib4dNV 486 "GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w" VertexAttrib4dARB) -(void VertexAttrib4dvNV 504 "GLuint index, const GLdouble * v" VertexAttrib4dvARB) -(void VertexAttrib4fNV 485 "GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w" VertexAttrib4fARB) -(void VertexAttrib4fvNV 503 "GLuint index, const GLfloat * v" VertexAttrib4fvARB) -(void VertexAttrib4sNV 484 "GLuint index, GLshort x, GLshort y, GLshort z, GLshort w" VertexAttrib4sARB) -(void VertexAttrib4svNV 498 "GLuint index, const GLshort * v" VertexAttrib4svARB) -(void VertexAttrib4ubNV 487 "GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w" VertexAttrib4NubARB) -(void VertexAttrib4ubvNV 500 "GLuint index, const GLubyte * v" VertexAttrib4ubvARB) +(void VertexAttrib1dARB 477 "GLuint index, GLdouble x") +(void VertexAttrib1dvARB 490 "GLuint index, const GLdouble * v") +(void VertexAttrib1fARB 476 "GLuint index, GLfloat x") +(void VertexAttrib1fvARB 489 "GLuint index, const GLfloat * v") +(void VertexAttrib1sARB 475 "GLuint index, GLshort x") +(void VertexAttrib1svARB 488 "GLuint index, const GLshort * v") +(void VertexAttrib2dARB 480 "GLuint index, GLdouble x, GLdouble y") +(void VertexAttrib2dvARB 493 "GLuint index, const GLdouble * v") +(void VertexAttrib2fARB 479 "GLuint index, GLfloat x, GLfloat y") +(void VertexAttrib2fvARB 492 "GLuint index, const GLfloat * v") +(void VertexAttrib2sARB 478 "GLuint index, GLshort x, GLshort y") +(void VertexAttrib2svARB 491 "GLuint index, const GLshort * v") +(void VertexAttrib3dARB 483 "GLuint index, GLdouble x, GLdouble y, GLdouble z") +(void VertexAttrib3dvARB 496 "GLuint index, const GLdouble * v") +(void VertexAttrib3fARB 482 "GLuint index, GLfloat x, GLfloat y, GLfloat z") +(void VertexAttrib3fvARB 495 "GLuint index, const GLfloat * v") +(void VertexAttrib3sARB 481 "GLuint index, GLshort x, GLshort y, GLshort z") +(void VertexAttrib3svARB 494 "GLuint index, const GLshort * v") +(void VertexAttrib4dARB 486 "GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w") +(void VertexAttrib4dvARB 504 "GLuint index, const GLdouble * v") +(void VertexAttrib4fARB 485 "GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w") +(void VertexAttrib4fvARB 503 "GLuint index, const GLfloat * v") +(void VertexAttrib4sARB 484 "GLuint index, GLshort x, GLshort y, GLshort z, GLshort w") +(void VertexAttrib4svARB 498 "GLuint index, const GLshort * v") +(void VertexAttrib4NubARB 487 "GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w") +(void VertexAttrib4NubvARB 508 "GLuint index, const GLubyte * v") (void VertexAttribs1dvNV -1 "GLuint index, GLsizei n, const GLdouble * v") (void VertexAttribs1fvNV -1 "GLuint index, GLsizei n, const GLfloat * v") (void VertexAttribs1svNV -1 "GLuint index, GLsizei n, const GLshort * v") @@ -787,6 +790,46 @@ ;; else (void BlendEquationSeparateEXT 458 "GLenum modeRGB, GLenum modeA") ;; endif +(void VertexAttrib1dNV -1 "GLuint index, GLdouble x") +(void VertexAttrib1dvNV -1 "GLuint index, const GLdouble * v") +(void VertexAttrib1fNV -1 "GLuint index, GLfloat x") +(void VertexAttrib1fvNV -1 "GLuint index, const GLfloat * v") +(void VertexAttrib1sNV -1 "GLuint index, GLshort x") +(void VertexAttrib1svNV -1 "GLuint index, const GLshort * v") +(void VertexAttrib2dNV -1 "GLuint index, GLdouble x, GLdouble y") +(void VertexAttrib2dvNV -1 "GLuint index, const GLdouble * v") +(void VertexAttrib2fNV -1 "GLuint index, GLfloat x, GLfloat y") +(void VertexAttrib2fvNV -1 "GLuint index, const GLfloat * v") +(void VertexAttrib2sNV -1 "GLuint index, GLshort x, GLshort y") +(void VertexAttrib2svNV -1 "GLuint index, const GLshort * v") +(void VertexAttrib3dNV -1 "GLuint index, GLdouble x, GLdouble y, GLdouble z") +(void VertexAttrib3dvNV -1 "GLuint index, const GLdouble * v") +(void VertexAttrib3fNV -1 "GLuint index, GLfloat x, GLfloat y, GLfloat z") +(void VertexAttrib3fvNV -1 "GLuint index, const GLfloat * v") +(void VertexAttrib3sNV -1 "GLuint index, GLshort x, GLshort y, GLshort z") +(void VertexAttrib3svNV -1 "GLuint index, const GLshort * v") +(void VertexAttrib4dNV -1 "GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w") +(void VertexAttrib4dvNV -1 "GLuint index, const GLdouble * v") +(void VertexAttrib4fNV -1 "GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w") +(void VertexAttrib4fvNV -1 "GLuint index, const GLfloat * v") +(void VertexAttrib4sNV -1 "GLuint index, GLshort x, GLshort y, GLshort z, GLshort w") +(void VertexAttrib4svNV -1 "GLuint index, const GLshort * v") +(void VertexAttrib4NubNV -1 "GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w") +(void VertexAttrib4NubvNV -1 "GLuint index, const GLubyte * v") +(GLuint GenFragmentShadersATI -1 "GLuint range") +(void BindFragmentShaderATI -1 "GLuint id") +(void DeleteFragmentShaderATI -1 "GLuint id") +(void BeginFragmentShaderATI -1 "void") +(void EndFragmentShaderATI -1 "void") +(void PassTexCoordATI -1 "GLuint dst, GLuint coord, GLenum swizzle") +(void SampleMapATI -1 "GLuint dst, GLuint interp, GLenum swizzle") +(void ColorFragmentOp1ATI -1 "GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod") +(void ColorFragmentOp2ATI -1 "GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod") +(void ColorFragmentOp3ATI -1 "GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod") +(void AlphaFragmentOp1ATI -1 "GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod") +(void AlphaFragmentOp2ATI -1 "GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod") +(void AlphaFragmentOp3ATI -1 "GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod") +(void SetFragmentShaderConstantATI -1 "GLuint dst, const GLfloat *value") ;; Entry points that exist in standard XFree86 libGL, but aren't in the ;; Mesa dispatch table, and aren't in OpenGL.framework @@ -819,8 +862,6 @@ (void MinmaxEXT -1 "GLenum target, GLenum internalformat, GLboolean sink" Minmax) (void PointParameterfSGIS -1 "GLenum pname, GLfloat param" PointParameterf) (void PointParameterfvSGIS -1 "GLenum pname, const GLfloat * params" PointParameterfv) -(void PointParameteri -1 "GLenum pname, GLint params" PointParameteriNV) -(void PointParameteriv -1 "GLenum pname, const GLint * params" PointParameterivNV) (void PrioritizeTexturesEXT -1 "GLsizei n, const GLenum * textures, const GLclampf * priorities" PrioritizeTextures) (void ResetHistogramEXT -1 "GLenum target" ResetHistogram) (void ResetMinmaxEXT -1 "GLenum target" ResetMinmax) Index: lib/GL/apple/dri_dispatch.h =================================================================== RCS file: /cvs/xorg/xc/lib/GL/apple/dri_dispatch.h,v retrieving revision 1.6 diff -u -d -b -w -r1.6 dri_dispatch.h --- lib/GL/apple/dri_dispatch.h 3 Jul 2005 07:00:55 -0000 1.6 +++ lib/GL/apple/dri_dispatch.h 31 May 2006 22:09:01 -0000 @@ -1659,9 +1659,13 @@ (void *rend, GLclampf value, GLboolean invert), (value, invert)) -DEFUN_EXTERN_VOID (__unused413, - (), - ()) +DEFUN_LOCAL_VOID (DrawBuffersARB, + (void *rend, GLsizei n, const GLenum * bufs), + (n, bufs)) + +DEFUN_ALIAS_VOID (DrawBuffersATI, DrawBuffersARB, + (GLsizei n, const GLenum * bufs), + (n, bufs)) DEFUN_ALIAS_VOID (PolygonOffsetEXT, PolygonOffset, (GLfloat factor, GLfloat bias), @@ -2515,214 +2519,110 @@ (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer), (index, size, type, stride, pointer)) -DEFUN_LOCAL_VOID (VertexAttrib1dNV, +DEFUN_LOCAL_VOID (VertexAttrib1dARB, (void *rend, GLuint index, GLdouble x), (index, x)) -DEFUN_ALIAS_VOID (VertexAttrib1dNV, VertexAttrib1dARB, - (GLuint index, GLdouble x), - (index, x)) - -DEFUN_LOCAL_VOID (VertexAttrib1dvNV, +DEFUN_LOCAL_VOID (VertexAttrib1dvARB, (void *rend, GLuint index, const GLdouble * v), (index, v)) -DEFUN_ALIAS_VOID (VertexAttrib1dvNV, VertexAttrib1dvARB, - (GLuint index, const GLdouble * v), - (index, v)) - -DEFUN_LOCAL_VOID (VertexAttrib1fNV, +DEFUN_LOCAL_VOID (VertexAttrib1fARB, (void *rend, GLuint index, GLfloat x), (index, x)) -DEFUN_ALIAS_VOID (VertexAttrib1fNV, VertexAttrib1fARB, - (GLuint index, GLfloat x), - (index, x)) - -DEFUN_LOCAL_VOID (VertexAttrib1fvNV, +DEFUN_LOCAL_VOID (VertexAttrib1fvARB, (void *rend, GLuint index, const GLfloat * v), (index, v)) -DEFUN_ALIAS_VOID (VertexAttrib1fvNV, VertexAttrib1fvARB, - (GLuint index, const GLfloat * v), - (index, v)) - -DEFUN_LOCAL_VOID (VertexAttrib1sNV, +DEFUN_LOCAL_VOID (VertexAttrib1sARB, (void *rend, GLuint index, GLshort x), (index, x)) -DEFUN_ALIAS_VOID (VertexAttrib1sNV, VertexAttrib1sARB, - (GLuint index, GLshort x), - (index, x)) - -DEFUN_LOCAL_VOID (VertexAttrib1svNV, +DEFUN_LOCAL_VOID (VertexAttrib1svARB, (void *rend, GLuint index, const GLshort * v), (index, v)) -DEFUN_ALIAS_VOID (VertexAttrib1svNV, VertexAttrib1svARB, - (GLuint index, const GLshort * v), - (index, v)) - -DEFUN_LOCAL_VOID (VertexAttrib2dNV, +DEFUN_LOCAL_VOID (VertexAttrib2dARB, (void *rend, GLuint index, GLdouble x, GLdouble y), (index, x, y)) -DEFUN_ALIAS_VOID (VertexAttrib2dNV, VertexAttrib2dARB, - (GLuint index, GLdouble x, GLdouble y), - (index, x, y)) - -DEFUN_LOCAL_VOID (VertexAttrib2dvNV, +DEFUN_LOCAL_VOID (VertexAttrib2dvARB, (void *rend, GLuint index, const GLdouble * v), (index, v)) -DEFUN_ALIAS_VOID (VertexAttrib2dvNV, VertexAttrib2dvARB, - (GLuint index, const GLdouble * v), - (index, v)) - -DEFUN_LOCAL_VOID (VertexAttrib2fNV, +DEFUN_LOCAL_VOID (VertexAttrib2fARB, (void *rend, GLuint index, GLfloat x, GLfloat y), (index, x, y)) -DEFUN_ALIAS_VOID (VertexAttrib2fNV, VertexAttrib2fARB, - (GLuint index, GLfloat x, GLfloat y), - (index, x, y)) - -DEFUN_LOCAL_VOID (VertexAttrib2fvNV, +DEFUN_LOCAL_VOID (VertexAttrib2fvARB, (void *rend, GLuint index, const GLfloat * v), (index, v)) -DEFUN_ALIAS_VOID (VertexAttrib2fvNV, VertexAttrib2fvARB, - (GLuint index, const GLfloat * v), - (index, v)) - -DEFUN_LOCAL_VOID (VertexAttrib2sNV, +DEFUN_LOCAL_VOID (VertexAttrib2sARB, (void *rend, GLuint index, GLshort x, GLshort y), (index, x, y)) -DEFUN_ALIAS_VOID (VertexAttrib2sNV, VertexAttrib2sARB, - (GLuint index, GLshort x, GLshort y), - (index, x, y)) - -DEFUN_LOCAL_VOID (VertexAttrib2svNV, +DEFUN_LOCAL_VOID (VertexAttrib2svARB, (void *rend, GLuint index, const GLshort * v), (index, v)) -DEFUN_ALIAS_VOID (VertexAttrib2svNV, VertexAttrib2svARB, - (GLuint index, const GLshort * v), - (index, v)) - -DEFUN_LOCAL_VOID (VertexAttrib3dNV, +DEFUN_LOCAL_VOID (VertexAttrib3dARB, (void *rend, GLuint index, GLdouble x, GLdouble y, GLdouble z), (index, x, y, z)) -DEFUN_ALIAS_VOID (VertexAttrib3dNV, VertexAttrib3dARB, - (GLuint index, GLdouble x, GLdouble y, GLdouble z), - (index, x, y, z)) - -DEFUN_LOCAL_VOID (VertexAttrib3dvNV, +DEFUN_LOCAL_VOID (VertexAttrib3dvARB, (void *rend, GLuint index, const GLdouble * v), (index, v)) -DEFUN_ALIAS_VOID (VertexAttrib3dvNV, VertexAttrib3dvARB, - (GLuint index, const GLdouble * v), - (index, v)) - -DEFUN_LOCAL_VOID (VertexAttrib3fNV, +DEFUN_LOCAL_VOID (VertexAttrib3fARB, (void *rend, GLuint index, GLfloat x, GLfloat y, GLfloat z), (index, x, y, z)) -DEFUN_ALIAS_VOID (VertexAttrib3fNV, VertexAttrib3fARB, - (GLuint index, GLfloat x, GLfloat y, GLfloat z), - (index, x, y, z)) - -DEFUN_LOCAL_VOID (VertexAttrib3fvNV, +DEFUN_LOCAL_VOID (VertexAttrib3fvARB, (void *rend, GLuint index, const GLfloat * v), (index, v)) -DEFUN_ALIAS_VOID (VertexAttrib3fvNV, VertexAttrib3fvARB, - (GLuint index, const GLfloat * v), - (index, v)) - -DEFUN_LOCAL_VOID (VertexAttrib3sNV, +DEFUN_LOCAL_VOID (VertexAttrib3sARB, (void *rend, GLuint index, GLshort x, GLshort y, GLshort z), (index, x, y, z)) -DEFUN_ALIAS_VOID (VertexAttrib3sNV, VertexAttrib3sARB, - (GLuint index, GLshort x, GLshort y, GLshort z), - (index, x, y, z)) - -DEFUN_LOCAL_VOID (VertexAttrib3svNV, +DEFUN_LOCAL_VOID (VertexAttrib3svARB, (void *rend, GLuint index, const GLshort * v), (index, v)) -DEFUN_ALIAS_VOID (VertexAttrib3svNV, VertexAttrib3svARB, - (GLuint index, const GLshort * v), - (index, v)) - -DEFUN_LOCAL_VOID (VertexAttrib4dNV, +DEFUN_LOCAL_VOID (VertexAttrib4dARB, (void *rend, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w), (index, x, y, z, w)) -DEFUN_ALIAS_VOID (VertexAttrib4dNV, VertexAttrib4dARB, - (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w), - (index, x, y, z, w)) - -DEFUN_LOCAL_VOID (VertexAttrib4dvNV, +DEFUN_LOCAL_VOID (VertexAttrib4dvARB, (void *rend, GLuint index, const GLdouble * v), (index, v)) -DEFUN_ALIAS_VOID (VertexAttrib4dvNV, VertexAttrib4dvARB, - (GLuint index, const GLdouble * v), - (index, v)) - -DEFUN_LOCAL_VOID (VertexAttrib4fNV, +DEFUN_LOCAL_VOID (VertexAttrib4fARB, (void *rend, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w), (index, x, y, z, w)) -DEFUN_ALIAS_VOID (VertexAttrib4fNV, VertexAttrib4fARB, - (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w), - (index, x, y, z, w)) - -DEFUN_LOCAL_VOID (VertexAttrib4fvNV, +DEFUN_LOCAL_VOID (VertexAttrib4fvARB, (void *rend, GLuint index, const GLfloat * v), (index, v)) -DEFUN_ALIAS_VOID (VertexAttrib4fvNV, VertexAttrib4fvARB, - (GLuint index, const GLfloat * v), - (index, v)) - -DEFUN_LOCAL_VOID (VertexAttrib4sNV, +DEFUN_LOCAL_VOID (VertexAttrib4sARB, (void *rend, GLuint index, GLshort x, GLshort y, GLshort z, GLshort w), (index, x, y, z, w)) -DEFUN_ALIAS_VOID (VertexAttrib4sNV, VertexAttrib4sARB, - (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w), - (index, x, y, z, w)) - -DEFUN_LOCAL_VOID (VertexAttrib4svNV, +DEFUN_LOCAL_VOID (VertexAttrib4svARB, (void *rend, GLuint index, const GLshort * v), (index, v)) -DEFUN_ALIAS_VOID (VertexAttrib4svNV, VertexAttrib4svARB, - (GLuint index, const GLshort * v), - (index, v)) - -DEFUN_LOCAL_VOID (VertexAttrib4ubNV, +DEFUN_LOCAL_VOID (VertexAttrib4NubARB, (void *rend, GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w), (index, x, y, z, w)) -DEFUN_ALIAS_VOID (VertexAttrib4ubNV, VertexAttrib4NubARB, - (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w), - (index, x, y, z, w)) - -DEFUN_LOCAL_VOID (VertexAttrib4ubvNV, +DEFUN_LOCAL_VOID (VertexAttrib4NubvARB, (void *rend, GLuint index, const GLubyte * v), (index, v)) -DEFUN_ALIAS_VOID (VertexAttrib4ubvNV, VertexAttrib4ubvARB, - (GLuint index, const GLubyte * v), - (index, v)) - DEFUN_EXTERN_VOID (VertexAttribs1dvNV, (GLuint index, GLsizei n, const GLdouble * v), (index, n, v)) @@ -3067,6 +2967,166 @@ #endif /* OSVERSION < 704 */ +DEFUN_EXTERN_VOID (VertexAttrib1dNV, + (GLuint index, GLdouble x), + (index, x)) + +DEFUN_EXTERN_VOID (VertexAttrib1dvNV, + (GLuint index, const GLdouble * v), + (index, v)) + +DEFUN_EXTERN_VOID (VertexAttrib1fNV, + (GLuint index, GLfloat x), + (index, x)) + +DEFUN_EXTERN_VOID (VertexAttrib1fvNV, + (GLuint index, const GLfloat * v), + (index, v)) + +DEFUN_EXTERN_VOID (VertexAttrib1sNV, + (GLuint index, GLshort x), + (index, x)) + +DEFUN_EXTERN_VOID (VertexAttrib1svNV, + (GLuint index, const GLshort * v), + (index, v)) + +DEFUN_EXTERN_VOID (VertexAttrib2dNV, + (GLuint index, GLdouble x, GLdouble y), + (index, x, y)) + +DEFUN_EXTERN_VOID (VertexAttrib2dvNV, + (GLuint index, const GLdouble * v), + (index, v)) + +DEFUN_EXTERN_VOID (VertexAttrib2fNV, + (GLuint index, GLfloat x, GLfloat y), + (index, x, y)) + +DEFUN_EXTERN_VOID (VertexAttrib2fvNV, + (GLuint index, const GLfloat * v), + (index, v)) + +DEFUN_EXTERN_VOID (VertexAttrib2sNV, + (GLuint index, GLshort x, GLshort y), + (index, x, y)) + +DEFUN_EXTERN_VOID (VertexAttrib2svNV, + (GLuint index, const GLshort * v), + (index, v)) + +DEFUN_EXTERN_VOID (VertexAttrib3dNV, + (GLuint index, GLdouble x, GLdouble y, GLdouble z), + (index, x, y, z)) + +DEFUN_EXTERN_VOID (VertexAttrib3dvNV, + (GLuint index, const GLdouble * v), + (index, v)) + +DEFUN_EXTERN_VOID (VertexAttrib3fNV, + (GLuint index, GLfloat x, GLfloat y, GLfloat z), + (index, x, y, z)) + +DEFUN_EXTERN_VOID (VertexAttrib3fvNV, + (GLuint index, const GLfloat * v), + (index, v)) + +DEFUN_EXTERN_VOID (VertexAttrib3sNV, + (GLuint index, GLshort x, GLshort y, GLshort z), + (index, x, y, z)) + +DEFUN_EXTERN_VOID (VertexAttrib3svNV, + (GLuint index, const GLshort * v), + (index, v)) + +DEFUN_EXTERN_VOID (VertexAttrib4dNV, + (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w), + (index, x, y, z, w)) + +DEFUN_EXTERN_VOID (VertexAttrib4dvNV, + (GLuint index, const GLdouble * v), + (index, v)) + +DEFUN_EXTERN_VOID (VertexAttrib4fNV, + (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w), + (index, x, y, z, w)) + +DEFUN_EXTERN_VOID (VertexAttrib4fvNV, + (GLuint index, const GLfloat * v), + (index, v)) + +DEFUN_EXTERN_VOID (VertexAttrib4sNV, + (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w), + (index, x, y, z, w)) + +DEFUN_EXTERN_VOID (VertexAttrib4svNV, + (GLuint index, const GLshort * v), + (index, v)) + +DEFUN_EXTERN_VOID (VertexAttrib4ubNV, + (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w), + (index, x, y, z, w)) + +DEFUN_EXTERN_VOID (VertexAttrib4ubvNV, + (GLuint index, const GLubyte * v), + (index, v)) + +DEFUN_EXTERN (GLuint, GenFragmentShadersATI, + (GLuint range), + (range)) + +DEFUN_EXTERN_VOID (BindFragmentShaderATI, + (GLuint id), + (id)) + +DEFUN_EXTERN_VOID (DeleteFragmentShaderATI, + (GLuint id), + (id)) + +DEFUN_EXTERN_VOID (BeginFragmentShaderATI, + (), + ()) + +DEFUN_EXTERN_VOID (EndFragmentShaderATI, + (), + ()) + +DEFUN_EXTERN_VOID (PassTexCoordATI, + (GLuint dst, GLuint coord, GLenum swizzle), + (dst, coord, swizzle)) + +DEFUN_EXTERN_VOID (SampleMapATI, + (GLuint dst, GLuint interp, GLenum swizzle), + (dst, interp, swizzle)) + +DEFUN_EXTERN_VOID (ColorFragmentOp1ATI, + (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod), + (op, dst, dstMask, dstMod, arg1, arg1Rep, arg1Mod)) + +DEFUN_EXTERN_VOID (ColorFragmentOp2ATI, + (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod), + (op, dst, dstMask, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod)) + +DEFUN_EXTERN_VOID (ColorFragmentOp3ATI, + (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod), + (op, dst, dstMask, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, arg3, arg3Rep, arg3Mod)) + +DEFUN_EXTERN_VOID (AlphaFragmentOp1ATI, + (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod), + (op, dst, dstMod, arg1, arg1Rep, arg1Mod)) + +DEFUN_EXTERN_VOID (AlphaFragmentOp2ATI, + (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod), + (op, dst, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod)) + +DEFUN_EXTERN_VOID (AlphaFragmentOp3ATI, + (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod), + (op, dst, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, arg3, arg3Rep, arg3Mod)) + +DEFUN_EXTERN_VOID (SetFragmentShaderConstantATI, + (GLuint dst, const GLfloat *value), + (dst, value)) + DEFUN_ALIAS_VOID (ArrayElementEXT, ArrayElement, (GLint i), (i)) @@ -3179,14 +3239,6 @@ (GLenum pname, const GLfloat * params), (pname, params)) -DEFUN_ALIAS_VOID (PointParameteri, PointParameteriNV, - (GLenum pname, GLint params), - (pname, params)) - -DEFUN_ALIAS_VOID (PointParameteriv, PointParameterivNV, - (GLenum pname, const GLint * params), - (pname, params)) - DEFUN_ALIAS_VOID (PrioritizeTexturesEXT, PrioritizeTextures, (GLsizei n, const GLenum * textures, const GLclampf * priorities), (n, textures, priorities)) @@ -3772,40 +3824,40 @@ (d)[472] = (void *) &p ## DeleteProgramsNV; \ (d)[473] = (void *) &p ## GenProgramsNV; \ (d)[474] = (void *) &p ## IsProgramNV; \ - (d)[475] = (void *) &p ## VertexAttrib1sNV; \ - (d)[476] = (void *) &p ## VertexAttrib1fNV; \ - (d)[477] = (void *) &p ## VertexAttrib1dNV; \ - (d)[478] = (void *) &p ## VertexAttrib2sNV; \ - (d)[479] = (void *) &p ## VertexAttrib2fNV; \ - (d)[480] = (void *) &p ## VertexAttrib2dNV; \ - (d)[481] = (void *) &p ## VertexAttrib3sNV; \ - (d)[482] = (void *) &p ## VertexAttrib3fNV; \ - (d)[483] = (void *) &p ## VertexAttrib3dNV; \ - (d)[484] = (void *) &p ## VertexAttrib4sNV; \ - (d)[485] = (void *) &p ## VertexAttrib4fNV; \ - (d)[486] = (void *) &p ## VertexAttrib4dNV; \ - (d)[487] = (void *) &p ## VertexAttrib4ubNV; \ - (d)[488] = (void *) &p ## VertexAttrib1svNV; \ - (d)[489] = (void *) &p ## VertexAttrib1fvNV; \ - (d)[490] = (void *) &p ## VertexAttrib1dvNV; \ - (d)[491] = (void *) &p ## VertexAttrib2svNV; \ - (d)[492] = (void *) &p ## VertexAttrib2fvNV; \ - (d)[493] = (void *) &p ## VertexAttrib2dvNV; \ - (d)[494] = (void *) &p ## VertexAttrib3svNV; \ - (d)[495] = (void *) &p ## VertexAttrib3fvNV; \ - (d)[496] = (void *) &p ## VertexAttrib3dvNV; \ + (d)[475] = (void *) &p ## VertexAttrib1sARB; \ + (d)[476] = (void *) &p ## VertexAttrib1fARB; \ + (d)[477] = (void *) &p ## VertexAttrib1dARB; \ + (d)[478] = (void *) &p ## VertexAttrib2sARB; \ + (d)[479] = (void *) &p ## VertexAttrib2fARB; \ + (d)[480] = (void *) &p ## VertexAttrib2dARB; \ + (d)[481] = (void *) &p ## VertexAttrib3sARB; \ + (d)[482] = (void *) &p ## VertexAttrib3fARB; \ + (d)[483] = (void *) &p ## VertexAttrib3dARB; \ + (d)[484] = (void *) &p ## VertexAttrib4sARB; \ + (d)[485] = (void *) &p ## VertexAttrib4fARB; \ + (d)[486] = (void *) &p ## VertexAttrib4dARB; \ + (d)[487] = (void *) &p ## VertexAttrib4NubARB; \ + (d)[488] = (void *) &p ## VertexAttrib1svARB; \ + (d)[489] = (void *) &p ## VertexAttrib1fvARB; \ + (d)[490] = (void *) &p ## VertexAttrib1dvARB; \ + (d)[491] = (void *) &p ## VertexAttrib2svARB; \ + (d)[492] = (void *) &p ## VertexAttrib2fvARB; \ + (d)[493] = (void *) &p ## VertexAttrib2dvARB; \ + (d)[494] = (void *) &p ## VertexAttrib3svARB; \ + (d)[495] = (void *) &p ## VertexAttrib3fvARB; \ + (d)[496] = (void *) &p ## VertexAttrib3dvARB; \ (d)[497] = (void *) &p ## VertexAttrib4bvARB; \ - (d)[498] = (void *) &p ## VertexAttrib4svNV; \ + (d)[498] = (void *) &p ## VertexAttrib4svARB; \ (d)[498] = (void *) &p ## VertexAttrib4NsvARB; \ (d)[499] = (void *) &p ## VertexAttrib4ivARB; \ - (d)[500] = (void *) &p ## VertexAttrib4ubvNV; \ (d)[500] = (void *) &p ## VertexAttrib4ubvARB; \ (d)[501] = (void *) &p ## VertexAttrib4usvARB; \ (d)[502] = (void *) &p ## VertexAttrib4uivARB; \ - (d)[503] = (void *) &p ## VertexAttrib4fvNV; \ - (d)[504] = (void *) &p ## VertexAttrib4dvNV; \ + (d)[503] = (void *) &p ## VertexAttrib4fvARB; \ + (d)[504] = (void *) &p ## VertexAttrib4dvARB; \ (d)[505] = (void *) &p ## VertexAttrib4NbvARB; \ (d)[507] = (void *) &p ## VertexAttrib4NivARB; \ + (d)[508] = (void *) &p ## VertexAttrib4NubvARB; \ (d)[509] = (void *) &p ## VertexAttrib4NusvARB; \ (d)[510] = (void *) &p ## VertexAttrib4NuivARB; \ (d)[511] = (void *) &p ## VertexAttribPointerARB; \ @@ -3858,4 +3910,5 @@ (d)[583] = (void *) &p ## WindowPos3sMESA; \ (d)[584] = (void *) &p ## WindowPos3svMESA; \ (d)[585] = (void *) &p ## ActiveStencilFaceEXT; \ + (d)[654] = (void *) &p ## DrawBuffersARB; \ } while (0) Index: lib/GL/apple/dri_driver.c =================================================================== RCS file: /cvs/xorg/xc/lib/GL/apple/dri_driver.c,v retrieving revision 1.4 diff -u -d -b -w -r1.4 dri_driver.c --- lib/GL/apple/dri_driver.c 6 May 2005 00:45:30 -0000 1.4 +++ lib/GL/apple/dri_driver.c 31 May 2006 22:09:01 -0000 @@ -46,7 +46,7 @@ * pointers in the __DRIdisplayRec, __DRIscreenRec, __DRIcontextRec, * __DRIdrawableRec structures defined in glxclient.h. Those function * pointers are initialized by code in this file. The process starts when - * libGL calls the __driCreateScreen() function at the end of this file. + * libGL calls the __driCreateNewScreen() function at the end of this file. * * The above-mentioned DRI structures have no dependencies on Mesa. * Each structure instead has a generic (void *) private pointer that @@ -75,18 +75,36 @@ #include "dri_driver.h" #include "x-list.h" #include "x-hash.h" +#include "GL/internal/dri_interface.h" + +/* From src/mesa/glapi/dispatch.h */ +#define driDispatchRemapTable_size 408 + +int driDispatchRemapTable[ driDispatchRemapTable_size ]; + +/** + * These callbacks are the interface from our driver to the driver loader + */ +static const __DRIinterfaceMethods *dri_interface = NULL; /** * This is used in a couple of places that call \c driMesaCreateNewDrawable. */ static const int empty_attribute_list[1] = { None }; +/** + * Cached copy of the internal API version used by libGL and the client-side + * DRI driver. + */ +static int api_ver = 0; + /* Context binding */ -static Bool driMesaBindContext(Display *dpy, int scrn, - GLXDrawable draw, GLXContext gc); -static Bool driMesaUnbindContext(Display *dpy, int scrn, - GLXDrawable draw, GLXContext gc, - int will_rebind); +static GLboolean driMesaBindContext(__DRInativeDisplay *dpy, int scrn, + __DRIid draw, __DRIid read, + __DRIcontext * ctx); +static GLboolean driMesaUnbindContext(__DRInativeDisplay *dpy, int scrn, + __DRIid draw, __DRIid read, + __DRIcontext *ctx); /* Drawable methods */ static void *driMesaCreateNewDrawable(__DRInativeDisplay *dpy, @@ -100,30 +118,39 @@ static void driMesaDestroyDrawable(__DRInativeDisplay *dpy, void *drawPrivate); /* Context methods */ -static void *driMesaCreateContext(Display *dpy, XVisualInfo *vis, void *shared, - __DRIcontext *pctx); +static void *driMesaCreateNewContext(__DRInativeDisplay *dpy, const __GLcontextModes *modes, + int render_type, void *sharedPrivate, __DRIcontext *pctx); static void driMesaDestroyContext(__DRInativeDisplay *dpy, int scrn, void *screenPrivate); /* Screen methods */ -static void *driMesaCreateScreen(__DRInativeDisplay *dpy, int scrn, - __DRIscreen *psc, int numConfigs, - __GLXvisualConfig *config); +static __DRIscreenPrivate *driMesaCreateNewScreen( + __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, + __GLcontextModes * modes, + const __DRIversion * ddx_version, + const __DRIversion * dri_version, + const __DRIversion * drm_version, + const __DRIframebuffer * frame_buffer, + void *pSAREA, int fd, + int internal_api_version); static void driMesaDestroyScreen(__DRInativeDisplay *dpy, int scrn, void *screenPrivate); -static void driMesaCreateSurface(Display *dpy, int scrn, +static void driMesaCreateSurface(__DRInativeDisplay *dpy, int scrn, __DRIdrawablePrivate *pdp); static void unwrap_context(__DRIcontextPrivate *pcp); static void wrap_context(__DRIcontextPrivate *pcp); -extern const CGLContextObj XAppleDRIGetIndirectContext(void); +extern CGLContextObj XAppleDRIGetIndirectContext(void); /*****************************************************************/ /* Maintain a list of drawables */ +#pragma mark - +#pragma mark Drawable list utilities + static inline Bool __driMesaAddDrawable(x_hash_table *drawHash, __DRIdrawable *pdraw) { @@ -254,6 +281,9 @@ /*****************************************************************/ +#pragma mark - +#pragma mark Context (un)binding + /* returns with psp->mutex locked if successful. */ static Bool driMesaFindDrawableByUID(Display *dpy,unsigned int uid, @@ -267,7 +297,7 @@ for (scrn = 0; scrn < ScreenCount(dpy); scrn++) { - if (!(pDRIScreen = __glXFindDRIScreen(dpy, scrn))) { + if (!(pDRIScreen = dri_interface->getScreen(dpy, scrn))) { /* ERROR!!! */ return FALSE; } else if (!(psp = (__DRIscreenPrivate *)pDRIScreen->private)) { @@ -344,9 +374,28 @@ } } -static Bool driMesaUnbindContext(Display *dpy, int scrn, - GLXDrawable draw, GLXContext gc, - int will_rebind) +/** + * Unbind context. + * + * \param dpy the display handle. + * \param scrn the screen number. + * \param draw drawable. + * \param read Current reading drawable. + * \param gc context. + * + * \return \c GL_TRUE on success, or \c GL_FALSE on failure. + * + * \internal + * This function calls __DriverAPIRec::UnbindContext, and then decrements + * __DRIdrawablePrivateRec::refcount which must be non-zero for a successful + * return. + * + * While casting the opaque private pointers associated with the parameters + * into their respective real types it also assures they are not \c NULL. + */ +static GLboolean driMesaUnbindContext(__DRInativeDisplay *dpy, int scrn, + __DRIid draw, __DRIid read, + __DRIcontext *ctx) { __DRIscreen *pDRIScreen; // __DRIdrawable *pdraw; @@ -359,22 +408,22 @@ ** calling driMesaUnbindContext. */ - if (gc == NULL || draw == None) { + if (ctx == NULL || draw == None || read == None) { /* ERROR!!! */ return GL_FALSE; } - if (!(pDRIScreen = __glXFindDRIScreen(dpy, scrn))) { - /* ERROR!!! */ - return GL_FALSE; - } else if (!(psp = (__DRIscreenPrivate *)pDRIScreen->private)) { + pDRIScreen = (*dri_interface->getScreen)(dpy, scrn); + if ((pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) { /* ERROR!!! */ return GL_FALSE; } + psp = (__DRIscreenPrivate *)pDRIScreen->private; + xmutex_lock(psp->mutex); - pcp = (__DRIcontextPrivate *)gc->driContext.private; + pcp = (__DRIcontextPrivate *)ctx->private; pdp = pcp->driDrawablePriv; if (pdp == NULL) { @@ -426,35 +475,27 @@ return GL_TRUE; } -static Bool driMesaBindContext(Display *dpy, int scrn, - GLXDrawable draw, GLXContext gc) + +/** + * This function takes both a read buffer and a draw buffer. This is needed + * for \c glXMakeCurrentReadSGI or GLX 1.3's \c glXMakeContextCurrent + * function. + * + * \bug This function calls \c driCreateNewDrawable in two places with the + * \c renderType hard-coded to \c GLX_WINDOW_BIT. Some checking might + * be needed in those places when support for pbuffers and / or pixmaps + * is added. Is it safe to assume that the drawable is a window? + */ +static GLboolean DoBindContext(__DRInativeDisplay *dpy, int scrn, + __DRIid draw, __DRIid read, + __DRIcontext *ctx, const __GLcontextModes * modes, + __DRIscreenPrivate *psp) { - __DRIscreen *pDRIScreen; - const __GLcontextModes *modes; __DRIdrawable *pdraw; __DRIdrawablePrivate *pdp; - __DRIscreenPrivate *psp; - __DRIcontextPrivate *pcp; - - /* - ** Assume error checking is done properly in glXMakeCurrent before - ** calling driMesaBindContext. - */ - - if (gc == NULL || draw == None) { - /* ERROR!!! */ - return GL_FALSE; - } - - if (!(pDRIScreen = __glXFindDRIScreen(dpy, scrn))) { - /* ERROR!!! */ - return GL_FALSE; - } else if (!(psp = (__DRIscreenPrivate *)pDRIScreen->private)) { - /* ERROR!!! */ - return GL_FALSE; - } - - modes = gc->driContext.mode; + __DRIdrawable *pread; + __DRIdrawablePrivate *prp; + __DRIcontextPrivate * const pcp = ctx->private; if ( modes == NULL ) { /* ERROR!!! */ @@ -463,6 +504,7 @@ xmutex_lock(psp->mutex); + /* Find the _DRIdrawable which corresponds to the writing drawable. */ pdraw = __driMesaFindDrawable(psp->drawHash, draw); if (!pdraw) { /* Allocate a new drawable */ @@ -474,8 +516,7 @@ } /* Create a new drawable */ - pdraw->private = driMesaCreateNewDrawable(dpy, modes, draw, pdraw, - GLX_WINDOW_BIT, + driMesaCreateNewDrawable(dpy, modes, draw, pdraw, GLX_WINDOW_BIT, empty_attribute_list); if (!pdraw->private) { /* ERROR!!! */ @@ -483,6 +524,43 @@ xmutex_unlock(psp->mutex); return GL_FALSE; } + } + pdp = (__DRIdrawablePrivate *) pdraw->private; + + /* Find the _DRIdrawable which corresponds to the reading drawable. */ + if (read == draw) { + /* read buffer == draw buffer */ + prp = pdp; + } + else { + pread = __driMesaFindDrawable(psp->drawHash, read); + if (!pread) { + /* Allocate a new drawable */ + pread = (__DRIdrawable *)Xmalloc(sizeof(__DRIdrawable)); + if (!pread) { + /* ERROR!!! */ + return GL_FALSE; + } + + /* Create a new drawable */ + driMesaCreateNewDrawable(dpy, modes, read, pread, GLX_WINDOW_BIT, + empty_attribute_list); + if (!pread->private) { + /* ERROR!!! */ + Xfree(pread); + return GL_FALSE; + } + } + prp = (__DRIdrawablePrivate *) pread->private; + } + + /* Bind the drawable to the context */ + pcp->driDrawablePriv = pdp; + pdp->driContextPriv = pcp; + pdp->refcount++; + if ( pdp != prp ) { + prp->refcount++; + } /* Add pdraw to drawable list */ if (!__driMesaAddDrawable(psp->drawHash, pdraw)) { @@ -492,10 +570,6 @@ xmutex_unlock(psp->mutex); return GL_FALSE; } - } - - pdp = (__DRIdrawablePrivate *)pdraw->private; - pcp = (__DRIcontextPrivate *)gc->driContext.private; if (pdp->surface_id == 0) { @@ -548,8 +622,44 @@ return GL_TRUE; } + +/** + * This function takes both a read buffer and a draw buffer. This is needed + * for \c glXMakeCurrentReadSGI or GLX 1.3's \c glXMakeContextCurrent + * function. + */ +static GLboolean driMesaBindContext(__DRInativeDisplay *dpy, int scrn, + __DRIid draw, __DRIid read, + __DRIcontext * ctx) +{ + __DRIscreen *pDRIScreen; + + /* + ** Assume error checking is done properly in glXMakeCurrent before + ** calling driMesaBindContext. + */ + + if (ctx == NULL || draw == None || read == None) { + /* ERROR!!! */ + return GL_FALSE; + } + + pDRIScreen = (*dri_interface->getScreen)(dpy, scrn); + if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) { + /* ERROR!!! */ + return GL_FALSE; + } + + return DoBindContext( dpy, scrn, draw, read, ctx, ctx->mode, + (__DRIscreenPrivate *)pDRIScreen->private ); +} + + /*****************************************************************/ +#pragma mark - +#pragma mark GLX callbacks + static xp_client_id get_client_id(void) { @@ -567,7 +677,7 @@ return id; } -static void driMesaCreateSurface(Display *dpy, int scrn, +static void driMesaCreateSurface(__DRInativeDisplay *dpy, int scrn, __DRIdrawablePrivate *pdp) { xp_client_id client_id; @@ -597,7 +707,7 @@ int renderType, const int *attrs) { - __DRIscreen * const pDRIScreen = __glXFindDRIScreen(dpy, modes->screen); + __DRIscreen * const pDRIScreen = dri_interface->getScreen(dpy, modes->screen); __DRIscreenPrivate *psp; __DRIdrawablePrivate *pdp; @@ -731,6 +841,79 @@ /*****************************************************************/ +#pragma mark - +#pragma mark Context handling + +/* + * Make a CGL pixel format from the first member of __GLcontextModes. + */ +static CGLPixelFormatObj +driCreatePixelFormat(const __GLcontextModes *mode) +{ + int i; + CGLPixelFormatAttribute attr[64]; // currently uses max of 30 + CGLPixelFormatObj result; + long n_formats; + + if (!mode->rgbMode) + return NULL; + + i = 0; + + // attr [i++] = kCGLPFAAcelerated; // require hwaccel - BAD for multiscreen + // attr [i++] = kCGLPFANoRecovery; // disable fallback renderers - BAD + + if (mode->stereoMode) { + attr[i++] = kCGLPFAStereo; + } + if (mode->doubleBufferMode) { + attr[i++] = kCGLPFADoubleBuffer; + } + + if (mode->colorIndexMode) { + /* ignored */ + } + + if (mode->rgbMode) { + attr[i++] = kCGLPFAColorSize; + attr[i++] = mode->redBits + mode->greenBits + mode->blueBits; + attr[i++] = kCGLPFAAlphaSize; + attr[i++] = 1; /* FIXME: ignoring mode->alphaBits which is always 0 */ + } + + if (mode->haveAccumBuffer) { + attr[i++] = kCGLPFAAccumSize; + attr[i++] = mode->accumRedBits + mode->accumGreenBits + + mode->accumBlueBits + mode->accumAlphaBits; + } + if (mode->haveDepthBuffer) { + attr[i++] = kCGLPFADepthSize; + attr[i++] = mode->depthBits; + } + if (mode->haveStencilBuffer) { + attr[i++] = kCGLPFAStencilSize; + attr[i++] = mode->stencilBits; + } + + attr[i++] = kCGLPFAAuxBuffers; + attr[i++] = mode->numAuxBuffers; + + /* mode->level ignored */ + + /* mode->pixmapMode ? */ + + /* FIXME: things we don't handle: color/alpha masks, level, + visualrating, transparentFoo */ + + attr[i++] = 0; + + result = NULL; + CGLChoosePixelFormat(attr, &result, &n_formats); + + return result; +} + +#if 0 static CGLPixelFormatObj driCreatePixelFormat(Display *dpy, __DRIscreenPrivate *psp, XVisualInfo *visinfo, __GLXvisualConfig *config) @@ -789,8 +972,139 @@ return result; } +#endif -static void *driMesaCreateContext(Display *dpy, XVisualInfo *vis, void *shared, + +/*****************************************************************/ +/** \name Context handling functions */ +/*****************************************************************/ +/*@{*/ + +/** + * Destroy the per-context private information. + * + * \param dpy the display handle. + * \param scrn the screen number. + * \param contextPrivate opaque pointer to the per-drawable private info. + */ +static void driMesaDestroyContext(__DRInativeDisplay *dpy, int scrn, + void *contextPrivate) +{ + __DRIcontextPrivate *pcp = (__DRIcontextPrivate *) contextPrivate; + + if (pcp) { + xmutex_lock(pcp->driScreenPriv->mutex); + unbind_context(pcp); + __driMesaGarbageCollectDrawables(pcp->driScreenPriv->drawHash); + xmutex_unlock(pcp->driScreenPriv->mutex); + CGLDestroyContext(pcp->ctx); + Xfree(pcp); + } +} + + +/** + * Create the per-drawable private driver information. + * + * \param dpy The display handle. + * \param modes Mode used to create the new context. + * \param render_type Type of rendering target. \c GLX_RGBA is the only + * type likely to ever be supported for direct-rendering. + * \param sharedPrivate The shared context dependent methods or \c NULL if + * non-existent. + * \param pctx DRI context to receive the context dependent methods. + * + * \returns An opaque pointer to the per-context private information on + * success, or \c NULL on failure. + * + * \internal + * This function allocates and fills a __DRIcontextPrivateRec structure. It + * performs some device independent initialization and passes all the + * relevent information to __DriverAPIRec::CreateContext to create the + * context. + * + */ +static void * +driMesaCreateNewContext(__DRInativeDisplay *dpy, const __GLcontextModes *modes, + int render_type, void *sharedPrivate, __DRIcontext *pctx) +{ + __DRIscreen *pDRIScreen; + __DRIcontextPrivate *pcp; + __DRIcontextPrivate *pshare = (__DRIcontextPrivate *) sharedPrivate; + __DRIscreenPrivate *psp; + + pDRIScreen = (*dri_interface->getScreen)(dpy, modes->screen); + if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) { + /* ERROR!!! */ + return NULL; + } + + psp = (__DRIscreenPrivate *)pDRIScreen->private; + + /* Create the hash table */ + if (!psp->drawHash) { + xmutex_lock(psp->mutex); + if (!psp->drawHash) + psp->drawHash = x_hash_table_new(NULL, NULL, NULL, NULL); + xmutex_unlock(psp->mutex); + } + + pcp = (__DRIcontextPrivate *)Xmalloc(sizeof(__DRIcontextPrivate)); + if (!pcp) { + return NULL; + } + + pcp->display = dpy; + pcp->driScreenPriv = psp; + pcp->driDrawablePriv = NULL; + + /* When the first context is created for a screen, initialize a "dummy" + * context. + */ + + if (!psp->dummyContextPriv.driScreenPriv) { + psp->dummyContextPriv.contextID = 0; + psp->dummyContextPriv.driScreenPriv = psp; + psp->dummyContextPriv.driDrawablePriv = NULL; + /* No other fields should be used! */ + } + + pcp->surface_id = 0; + + pcp->pending_clear = FALSE; + pcp->pending_update = FALSE; + + pcp->pixelFormat = driCreatePixelFormat(modes); + if (!pcp->pixelFormat) { + free(pcp); + return NULL; + } + + pcp->ctx = NULL; + CGLCreateContext(pcp->pixelFormat, + pshare ? pshare->ctx : NULL, &pcp->ctx); + + if (!pcp->ctx) { + Xfree(pcp); + return NULL; + } + + pctx->destroyContext = driMesaDestroyContext; + pctx->bindContext = driMesaBindContext; + pctx->unbindContext = driMesaUnbindContext; + + wrap_context(pcp); + + xmutex_lock(psp->mutex); + __driMesaGarbageCollectDrawables(pcp->driScreenPriv->drawHash); + xmutex_unlock(psp->mutex); + + return pcp; +} +/*@}*/ + +#if 0 +static void *driMesaCreateContext(__DRInativeDisplay *dpy, XVisualInfo *vis, void *shared, __DRIcontext *pctx) { __DRIscreen *pDRIScreen; @@ -799,7 +1113,7 @@ __DRIscreenPrivate *psp; int i; - if (!(pDRIScreen = __glXFindDRIScreen(dpy, vis->screen))) { + if (!(pDRIScreen = dri_interface->getScreen(dpy, vis->screen))) { /* ERROR!!! */ return NULL; } else if (!(psp = (__DRIscreenPrivate *)pDRIScreen->private)) { @@ -855,24 +1169,45 @@ return pcp; } +#endif -static void driMesaDestroyContext(__DRInativeDisplay *dpy, int scrn, - void *contextPrivate) + +/*****************************************************************/ +/** \name Screen handling functions */ +/*****************************************************************/ +/*@{*/ + +#pragma mark - +#pragma mark Screen handling + +/** + * Destroy the per-screen private information. + * + * \param dpy the display handle. + * \param scrn the screen number. + * \param screenPrivate opaque pointer to the per-screen private information. + */ +static void driMesaDestroyScreen(__DRInativeDisplay *dpy, int scrn, + void *screenPrivate) { - __DRIcontextPrivate *pcp = (__DRIcontextPrivate *) contextPrivate; + __DRIscreenPrivate *psp = (__DRIscreenPrivate *) screenPrivate; - if (pcp) { - xmutex_lock(pcp->driScreenPriv->mutex); - unbind_context(pcp); - __driMesaGarbageCollectDrawables(pcp->driScreenPriv->drawHash); - xmutex_unlock(pcp->driScreenPriv->mutex); - CGLDestroyContext(pcp->ctx); - Xfree(pcp); + if (psp) { + /* No interaction with the X-server is possible at this point. This + * routine is called after XCloseDisplay, so there is no protocol + * stream open to the X-server anymore. + */ + + //FIXME resetDriver ? + if ( psp->modes != NULL ) { + (*dri_interface->destroyContextModes)( psp->modes ); + } + Xfree(psp); } } -/*****************************************************************/ +#if 0 static void *driMesaCreateScreen(__DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, int numConfigs, __GLXvisualConfig *config) @@ -956,19 +1291,147 @@ return (void *)psp; } +#endif -static void driMesaDestroyScreen(__DRInativeDisplay *dpy, int scrn, - void *screenPrivate) + +/** + * Utility function from Mesa used to create a new driver-private screen structure. + * + * \param dpy Display pointer + * \param scrn Index of the screen + * \param psc DRI screen data (not driver private) + * \param modes Linked list of known display modes. This list is, at a + * minimum, a list of modes based on the current display mode. + * These roughly match the set of available X11 visuals, but it + * need not be limited to X11! The calling libGL should create + * a list that will inform the driver of the current display + * mode (i.e., color buffer depth, depth buffer depth, etc.). + * \param ddx_version Version of the 2D DDX. This may not be meaningful for + * all drivers. + * \param dri_version Version of the "server-side" DRI. + * \param drm_version Version of the kernel DRM. + * \param frame_buffer Data describing the location and layout of the + * framebuffer. + * \param pSAREA Pointer the the SAREA. + * \param fd Device handle for the DRM. + * \param internal_api_version Version of the internal interface between the + * driver and libGL. + * + * \note + * There is no need to check the minimum API version in this function. Since + * the \c __driCreateNewScreen function is versioned, it is impossible for a + * loader that is too old to even load this driver. + */ +static __DRIscreenPrivate * +driMesaCreateNewScreen(__DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, + __GLcontextModes * modes, + const __DRIversion * ddx_version, + const __DRIversion * dri_version, + const __DRIversion * drm_version, + const __DRIframebuffer * frame_buffer, + void *pSAREA, + int fd, + int internal_api_version) { - __DRIscreenPrivate *psp = (__DRIscreenPrivate *) screenPrivate; + __DRIscreenPrivate *psp; - if (psp) { - //FIXME resetDriver ? + api_ver = internal_api_version; + + psp = (__DRIscreenPrivate *)Xmalloc(sizeof(__DRIscreenPrivate)); + if (!psp) { + return NULL; + } + + /* Create the hash table */ + psp->drawHash = x_hash_table_new(NULL, NULL, NULL, NULL); + if ( psp->drawHash == NULL ) { + Xfree( psp ); + return NULL; + } + + psp->mutex = xmutex_malloc(); + if (psp->mutex != NULL) { + xmutex_init (psp->mutex); + xmutex_set_name (psp->mutex, "AppleDRI"); + } + + psp->display = dpy; + psp->myNum = scrn; + psp->psc = psc; + psp->modes = modes; + +#if 0 + /* + * Allocate space for an array of visual records and initialize them. + */ + psp->visuals = (__DRIvisualPrivate *)Xmalloc(numConfigs * + sizeof(__DRIvisualPrivate)); + if (!psp->visuals) { + Xfree(psp); + return NULL; + } + + visTmpl.screen = scrn; + visinfo = XGetVisualInfo(dpy, VisualScreenMask, &visTmpl, &n); + if (n != numConfigs) { + Xfree(psp); + return NULL; + } + + psp->numVisuals = 0; + for (i = 0; i < numConfigs; i++, config++) { + psp->visuals[psp->numVisuals].vid = visinfo[i].visualid; + psp->visuals[psp->numVisuals].pixel_format = + driCreatePixelFormat(dpy, psp, &visinfo[i], config); + if (psp->visuals[psp->numVisuals].pixel_format != NULL) { + psp->numVisuals++; + } + } + + XFree(visinfo); + + if (psp->numVisuals == 0) { + /* Couldn't create any pixel formats. */ Xfree(psp->visuals); Xfree(psp); + return NULL; } +#endif + + /* + ** NOT_DONE: This is used by the X server to detect when the client + ** has died while holding the drawable lock. The client sets the + ** drawable lock to this value. + */ + psp->drawLockID = 1; + + psp->pFB = frame_buffer->base; + psp->fbSize = frame_buffer->size; + psp->fbStride = frame_buffer->stride; + psp->fbWidth = frame_buffer->width; + psp->fbHeight = frame_buffer->height; + psp->fbBPP = psp->fbStride * 8 / frame_buffer->width; + + /* + ** Do not init dummy context here; actual initialization will be + ** done when the first DRI context is created. Init screen priv ptr + ** to NULL to let CreateContext routine that it needs to be inited. + */ + psp->dummyContextPriv.driScreenPriv = NULL; + + psc->destroyScreen = driMesaDestroyScreen; + psc->createNewDrawable = driMesaCreateNewDrawable; + psc->getDrawable = driMesaGetDrawable; +#if 0 + /* FIXME: Not supported yet. */ + psc->getMSC = driMesaGetMSC; +#endif + psc->createNewContext = driMesaCreateNewContext; + + return psp; } + /* Note: definitely can't make any X protocol requests here. */ static void driAppleSurfaceNotify(Display *dpy, unsigned int uid, int kind) { @@ -1025,6 +1488,8 @@ } } + +#if 0 /** * Entrypoint function used to create a new driver-private screen structure. * @@ -1051,16 +1516,73 @@ return driMesaCreateScreen(dpy, scrn, psc, numConfigs, config); } +#endif + +/** + * Entrypoint function used to create a new driver-private screen structure. + * \param dpy Display pointer + * \param scrn Index of the screen + * \param psc DRI screen data (not driver private) + * \param modes Linked list of known display modes. This list is, at a + * minimum, a list of modes based on the current display mode. + * These roughly match the set of available X11 visuals, but it + * need not be limited to X11! The calling libGL should create + * a list that will inform the driver of the current display + * mode (i.e., color buffer depth, depth buffer depth, etc.). + * \param ddx_version Version of the 2D DDX. This may not be meaningful for + * all drivers. + * \param dri_version Version of the "server-side" DRI. + * \param drm_version Version of the kernel DRM. + * \param frame_buffer Data describing the location and layout of the + * framebuffer. + * \param pSAREA Pointer the the SAREA. + * \param fd Device handle for the DRM. + * \param internal_api_version Version of the internal interface between the + * driver and libGL. + * \param interface Loader interfacee functions. + * \param driver_modes Some modes. + * + * \note + * There is no need to check the minimum API version in this function. Since + * the \c __driCreateNewScreen function is versioned, it is impossible for a + * loader that is too old to even load this driver. + */ +void * +__driCreateNewScreen(__DRInativeDisplay *dpy, int scrn, + __DRIscreen *psc, __GLcontextModes * modes, + const __DRIversion * ddx_version, const __DRIversion * dri_version, + const __DRIversion * drm_version, const __DRIframebuffer * frame_buffer, + void * pSAREA, int fd, int internal_api_version, + const __DRIinterfaceMethods * interface, + __GLcontextModes ** driver_modes) +{ + static int here_before; + + dri_interface = interface; + + if (!here_before) + { + XAppleDRISetSurfaceNotifyHandler(driAppleSurfaceNotify); + here_before = True; + } + + return (void *)driMesaCreateNewScreen(dpy, scrn, psc, modes, ddx_version, dri_version, + drm_version, frame_buffer, pSAREA, fd, + internal_api_version); +} + void __driRegisterExtensions(void) { } + __private_extern__ void XAppleDRIUseIndirectDispatch(void) { CGLSetCurrentContext(XAppleDRIGetIndirectContext()); } + /*****************************************************************/ /* Index: lib/GL/apple/dri_driver.h =================================================================== RCS file: /cvs/xorg/xc/lib/GL/apple/dri_driver.h,v retrieving revision 1.2 diff -u -d -b -w -r1.2 dri_driver.h --- lib/GL/apple/dri_driver.h 23 Apr 2004 18:43:09 -0000 1.2 +++ lib/GL/apple/dri_driver.h 31 May 2006 22:09:01 -0000 @@ -59,6 +59,10 @@ } \ } while (0) + +/** + * Per-drawable private DRI driver information. + */ struct __DRIdrawablePrivateRec { /* ** X's drawable ID associated with this private drawable. @@ -91,6 +95,10 @@ unsigned int destroyed :1; }; + +/** + * Per-context private driver information. + */ struct __DRIcontextPrivateRec { /* ** Other contexts bound to the same drawable. @@ -102,7 +110,11 @@ */ XID contextID; + /* + ** CGL context info + */ CGLContextObj ctx; + CGLPixelFormatObj pixelFormat; /* ** Set when attached @@ -113,7 +125,7 @@ /* ** This context's display pointer. */ - Display *display; + __DRInativeDisplay *display; /* ** Pointer to drawable currently bound to this context. @@ -139,6 +151,7 @@ unsigned int pending_clear :1; }; + struct __DRIvisualPrivateRec { /* ** X's visual ID associated with this private visual. @@ -151,11 +164,15 @@ CGLPixelFormatObj pixel_format; }; + +/** + * Per-screen private driver information. + */ struct __DRIscreenPrivateRec { /* ** Display for this screen */ - Display *display; + __DRInativeDisplay *display; /* ** Mutex for this screen @@ -167,21 +184,64 @@ */ int myNum; - /* - ** Core rendering library's visuals associated with the current - ** screen. + /** + * ID used when the client sets the drawable lock. + * + * The X server uses this value to detect if the client has died while + * holding the drawable lock. */ - __DRIvisualPrivate *visuals; - int numVisuals; + int drawLockID; + + /** + * \name Direct frame buffer access information + * Used for software fallbacks. + */ + /*@{*/ + unsigned char *pFB; + int fbSize; + int fbOrigin; + int fbStride; + int fbWidth; + int fbHeight; + int fbBPP; + /*@}*/ + + /** + * Dummy context to which drawables are bound when not bound to any + * other context. + * + * A dummy hHWContext is created for this context, and is used by the GL + * core when a hardware lock is required but the drawable is not currently + * bound (e.g., potentially during a SwapBuffers request). The dummy + * context is created when the first "real" context is created on this + * screen. + */ + __DRIcontextPrivate dummyContextPriv; /* ** Hash table to hold the drawable information for this screen. */ void *drawHash; + + /** + * GLX visuals / FBConfigs for this screen. These are stored as a + * linked list. + * + * \note + * This field is \b only used in conjunction with the old interfaces. If + * the new interfaces are used, this field will be set to \c NULL and will + * not be dereferenced. + */ + __GLcontextModes *modes; + + /** + * Pointer back to the \c __DRIscreen that contains this structure. + */ + __DRIscreen *psc; }; -extern void driMesaUpdateDrawableInfo(Display *dpy, int scrn, +extern void driMesaUpdateDrawableInfo(__DRInativeDisplay *dpy, int scrn, __DRIdrawablePrivate *pdp); Index: lib/GL/apple/dri_glx.c =================================================================== RCS file: /cvs/xorg/xc/lib/GL/apple/dri_glx.c,v retrieving revision 1.4 diff -u -d -b -w -r1.4 dri_glx.c --- lib/GL/apple/dri_glx.c 16 Apr 2005 00:21:21 -0000 1.4 +++ lib/GL/apple/dri_glx.c 31 May 2006 22:09:01 -0000 @@ -2,7 +2,7 @@ Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. Copyright (c) 2002 Apple Computer, Inc. -Copyright (c) 2004 Torrey T. Lyons +Copyright (c) 2004-2006 Torrey T. Lyons All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a @@ -183,7 +183,7 @@ */ pdisp->private = NULL; pdisp->destroyDisplay = NULL; - pdisp->createScreen = NULL; + pdisp->createNewScreen = NULL; if (!XAppleDRIQueryExtension(dpy, &eventBase, &errorBase)) { return NULL; @@ -204,15 +204,9 @@ pdisp->destroyDisplay = driDestroyDisplay; - /* allocate array of pointers to createScreen funcs */ - pdisp->createScreen = (CreateScreenFunc *) Xmalloc(numScreens * sizeof(void *)); - if (!pdisp->createScreen) - return NULL; - - /* allocate array of pointers to createScreen funcs */ - pdisp->createNewScreen = (CreateNewScreenFunc *) Xmalloc(numScreens * sizeof(void *)); + /* allocate array of pointers to createNewScreen funcs */ + pdisp->createNewScreen = (PFNCREATENEWSCREENFUNC *) Xmalloc(numScreens * sizeof(void *)); if (!pdisp->createNewScreen) { - Xfree(pdisp->createScreen); Xfree(pdpyp); return NULL; } @@ -221,15 +215,13 @@ pdpyp->libraryHandles = (void **) Xmalloc(numScreens * sizeof(void*)); if (!pdpyp->libraryHandles) { Xfree(pdisp->createNewScreen); - Xfree(pdisp->createScreen); Xfree(pdpyp); return NULL; } - /* we'll statically bind to the __driCreateScreen function */ + /* we'll statically bind to the __driCreateNewScreen function */ for (scrn = 0; scrn < numScreens; scrn++) { - pdisp->createScreen[scrn] = __driCreateScreen; - pdisp->createNewScreen[scrn] = NULL; + pdisp->createNewScreen[scrn] = __driCreateNewScreen; pdpyp->libraryHandles[scrn] = NULL; } Index: lib/GL/apple/dri_glx.h =================================================================== RCS file: /cvs/xorg/xc/lib/GL/apple/dri_glx.h,v retrieving revision 1.3 diff -u -d -b -w -r1.3 dri_glx.h --- lib/GL/apple/dri_glx.h 27 Jul 2004 20:23:58 -0000 1.3 +++ lib/GL/apple/dri_glx.h 31 May 2006 22:09:01 -0000 @@ -59,8 +59,13 @@ typedef struct __DRIcontextPrivateRec __DRIcontextPrivate; typedef struct __DRIdrawablePrivateRec __DRIdrawablePrivate; -extern void *__driCreateScreen (Display *dpy, int scrn, __DRIscreen *psc, - int numConfigs, __GLXvisualConfig *config); +void *__driCreateNewScreen(__DRInativeDisplay *dpy, int scrn, + __DRIscreen *psc, const __GLcontextModes * modes, + const __DRIversion * ddx_version, const __DRIversion * dri_version, + const __DRIversion * drm_version, const __DRIframebuffer * frame_buffer, + void * pSAREA, int fd, int internal_api_version, + const __DRIinterfaceMethods * interface, + __GLcontextModes ** driver_modes); extern void __driRegisterExtensions (void); #endif /* GLX_DIRECT_RENDERING */ Index: lib/GL/glx/Imakefile =================================================================== RCS file: /cvs/xorg/xc/lib/GL/glx/Imakefile,v retrieving revision 1.12 diff -u -d -b -w -r1.12 Imakefile --- lib/GL/glx/Imakefile 23 Aug 2005 04:03:51 -0000 1.12 +++ lib/GL/glx/Imakefile 31 May 2006 22:09:01 -0000 @@ -44,7 +44,14 @@ LinkSourceFile(glthread.c, $(MESASRCDIR)/src/mesa/glapi) LinkSourceFile(glcontextmodes.c, $(MESASRCDIR)/src/mesa/drivers/dri/common) LinkSourceFile(glcontextmodes.h, $(MESASRCDIR)/src/mesa/drivers/dri/common) + +#if defined(DarwinArchitecture) && BuildAppleDRI +/* AppleDRI uses its own dispatch table. */ +#elif LinkSourceFile(dispatch.c, $(MESASRCDIR)/src/mesa/main) +DISPATCHSRCS = dispatch.c +DISPATCHOBJS = dispatch.o +#endif #ifdef i386Architecture LinkSourceFile(glapi_x86.S, $(MESASRCDIR)/src/mesa/x86) @@ -99,7 +106,7 @@ GLX_SRCS = \ clientattrib.c \ compsize.c \ - dispatch.c \ + $(DISPATCHSRCS) \ eval.c \ glapi.c \ glthread.c \ @@ -130,7 +137,7 @@ clientattrib.o \ compsize.o \ eval.o \ - dispatch.o \ + $(DISPATCHOBJS) \ glapi.o \ glthread.o \ glx_pbuffer.o \ @@ -195,7 +202,7 @@ DRI_SRCS = XF86dri.c DRI_OBJS = XF86dri.o - DRI_INCS = -I$(SERVERSRC)/GL/dri + DRI_INCS = -I$(SERVERSRC)/GL/dri -I$(DRMSRCDIR)/libdrm #endif SRCS = $(GLX_SRCS) $(ASM_SRCS) $(DRI_SRCS) Index: lib/GL/mesa/main/Imakefile.inc =================================================================== RCS file: /cvs/xorg/xc/lib/GL/mesa/main/Imakefile.inc,v retrieving revision 1.3 diff -u -d -b -w -r1.3 Imakefile.inc --- lib/GL/mesa/main/Imakefile.inc 10 Nov 2005 06:38:24 -0000 1.3 +++ lib/GL/mesa/main/Imakefile.inc 31 May 2006 22:09:01 -0000 @@ -7,9 +7,15 @@ MESABUILDDIR = MesaBuildDir #ifdef NeedAllMesaSrc - DISPATCHSRCS = $(MESABUILDDIR)dispatch.c +#define NeedMostMesaSrc +#endif + +#ifdef NeedMostMesaSrc GLAPISRCS = $(MESABUILDDIR)glapi.c GLTHREADSRCS = $(MESABUILDDIR)glthread.c +# ifdef NeedAllMesaSrc + DISPATCHSRCS = $(MESABUILDDIR)dispatch.c +# endif #endif MESA_CORE_INCLUDES = -I$(MESASRCDIR)/src/array_cache \ @@ -138,7 +144,7 @@ LinkSourceFile(get.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(get.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(getstring.c, $(MESASRCDIR)/src/mesa/main) -#ifdef NeedAllMesaSrc +#ifdef NeedMostMesaSrc LinkSourceFile(glapi.c, $(MESASRCDIR)/src/mesa/glapi) LinkSourceFile(glthread.c, $(MESASRCDIR)/src/mesa/glapi) #endif @@ -207,10 +213,12 @@ LinkSourceFile(vtxfmt_tmp.h, $(MESASRCDIR)/src/mesa/main) #endif -#ifdef NeedAllMesaSrc - DISPATCHOBJS = $(MESABUILDDIR)dispatch.o +#ifdef NeedMostMesaSrc GLAPIOBJS = $(MESABUILDDIR)glapi.o GLTHREADOBJS = $(MESABUILDDIR)glthread.o +# ifdef NeedAllMesaSrc + DISPATCHOBJS = $(MESABUILDDIR)dispatch.o +# endif #endif COREMESABASEOBJS = \ @@ -275,10 +283,12 @@ $(MESABUILDDIR)varray.o \ $(MESABUILDDIR)vtxfmt.o -#ifdef NeedAllMesaSrc - DISPATCHUOBJS = $(MESABUILDDIR)unshared/dispatch.o +#ifdef NeedMostMesaSrc GLAPIUOBJS = $(MESABUILDDIR)unshared/glapi.o GLTHREADUOBJS = $(MESABUILDDIR)unshared/glthread.o +# ifdef NeedAllMesaSrc + DISPATCHUOBJS = $(MESABUILDDIR)unshared/dispatch.o +# endif #endif #if defined(DoSharedLib) && DoSharedLib @@ -347,10 +357,12 @@ COREMESABASEUOBJS = $(COREMESABASEOBJS) #endif -#ifdef NeedAllMesaSrc - DISPATCHDOBJS = $(MESABUILDDIR)debugger/dispatch.o +#ifdef NeedMostMesaSrc GLAPIDOBJS = $(MESABUILDDIR)debugger/glapi.o GLTHREADDOBJS = $(MESABUILDDIR)debugger/glthread.o +# ifdef NeedAllMesaSrc + DISPATCHDOBJS = $(MESABUILDDIR)debugger/dispatch.o +# endif #endif COREMESABASEDOBJS = \ @@ -415,10 +427,12 @@ $(MESABUILDDIR)debugger/varray.o \ $(MESABUILDDIR)debugger/vtxfmt.o -#ifdef NeedAllMesaSrc - DISPATCHPOBJS = $(MESABUILDDIR)profiled/dispatch.o +#ifdef NeedMostMesaSrc GLAPIPOBJS = $(MESABUILDDIR)profiled/glapi.o GLTHREADPOBJS = $(MESABUILDDIR)profiled/glthread.o +# ifdef NeedAllMesaSrc + DISPATCHPOBJS = $(MESABUILDDIR)profiled/dispatch.o +# endif #endif COREMESABASEPOBJS = \ Index: programs/Xserver/Imakefile =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/Imakefile,v retrieving revision 1.37 diff -u -d -b -w -r1.37 Imakefile --- programs/Xserver/Imakefile 18 Nov 2005 18:15:23 -0000 1.37 +++ programs/Xserver/Imakefile 31 May 2006 22:09:02 -0000 @@ -92,7 +92,11 @@ # else GLXEXT = $(GLXLIB) # endif +# if defined(DarwinArchitecture) && BuildAppleDRI +DISPATCHOBJS = GL/mesa/main/dispatch.o #endif +#endif + #if BuildXInputExt XINPUTEXT = Xi/LibraryTargetName(xinput) @@ -835,7 +839,7 @@ MIDAMAGEDIR = miext/damage XPSUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB32DIR) $(DEPDIRS) \ $(MIDAMAGEDIR) -XPOBJS = Xprint/ddxInit.o Xprint/dpmsstubs.o Xprint/miinitext.o +XPOBJS = Xprint/ddxInit.o Xprint/dpmsstubs.o Xprint/miinitext.o $(DISPATCHOBJS) #if PrintOnlyServer XPLIBS = PreFbLibs $(XPDDXLIBS) $(XPDDXFBLIBS) PostFbLibs #else @@ -874,7 +878,7 @@ #if !defined(LynxOSArchitecture) && \ !defined(Win32Architecture) && \ !defined(QNX4Architecture) -XNESTOBJS = hw/xnest/miinitext.o $(XNESTDPMSSTUBOBJS) +XNESTOBJS = hw/xnest/miinitext.o $(XNESTDPMSSTUBOBJS) $(DISPATCHOBJS) #else XNESTOBJS = hw/xnest/miinitext.o dix/main.o $(XNESTDPMSSTUBOBJS) #endif @@ -924,7 +928,7 @@ #if BuildDPMS XVFBDPMSSTUBOBJS = $(XVFBDDXDIR)/dpmsstubs.o #endif -XVFBOBJS = $(XVFBDDXDIR)/stubs.o $(XVFBDDXDIR)/miinitext.o $(XVFBDPMSSTUBOBJS) +XVFBOBJS = $(XVFBDDXDIR)/stubs.o $(XVFBDDXDIR)/miinitext.o $(XVFBDPMSSTUBOBJS) $(DISPATCHOBJS) #else XVFBOBJS = dix/main.o hw/vfb/stubs.o hw/vfb/miinitext.o #endif @@ -1109,7 +1113,7 @@ /* * IOKit X server */ -SetUIDServerTarget(XDarwin,$(DARWINDIRS),$(DARWINOBJS), \ +SetUIDServerTarget(XDarwin,$(DARWINDIRS),$(DARWINOBJS) $(DISPATCHOBJS), \ $(DARWINLIBS) $(IOKITLIB) $(DARWINEXTLIBS),$(DARWINSYSLIBS)) #if DarwinQuartzSupport @@ -1185,7 +1189,8 @@ #endif BundleProgramTarget(glxMesa,XDarwinApp,GL,GL/glx/glxext.o,GL/glx/libglx.a \ - GL/mesa/GLcore/libGLcore.a,NullParameter,$(XDARWINAPPDIR)/Resources) + GL/mesa/GLcore/libGLcore.a $(DISPATCHOBJS),NullParameter, \ + $(XDARWINAPPDIR)/Resources) #else /* !DarwinQuartzSupport */ Index: programs/Xserver/GL/mesa/GLcore/Imakefile =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/GL/mesa/GLcore/Imakefile,v retrieving revision 1.4 diff -u -d -b -w -r1.4 Imakefile --- programs/Xserver/GL/mesa/GLcore/Imakefile 31 Jul 2005 17:19:25 -0000 1.4 +++ programs/Xserver/GL/mesa/GLcore/Imakefile 31 May 2006 22:09:02 -0000 @@ -11,7 +11,13 @@ #include +#if defined(DarwinArchitecture) && BuildAppleDRI +/* AppleDRI uses its own dispatch table. */ +#define NeedMostMesaSrc +#elif #define NeedAllMesaSrc +#endif + #define MesaInXServer #define MesaBuildDir ../main/ #define MesaACBuildDir ../array_cache/