diff options
author | Eric Anholt <anholt@freebsd.org> | 2004-06-16 09:25:21 +0000 |
---|---|---|
committer | Eric Anholt <anholt@freebsd.org> | 2004-06-16 09:25:21 +0000 |
commit | 2e1868b560315a8b20d688e646c489a5ad93eeae (patch) | |
tree | ebe22dc92bc971e96deebba2b95ef690289f0292 | |
parent | f45c46c630855e8e0d1c28b1f0d3b2ad54334619 (diff) |
DRI trunk-20040613 importDRI-trunk-20040721DRI-trunk-20040613
32 files changed, 1207 insertions, 545 deletions
diff --git a/GL/glx/g_disptab.c b/GL/glx/g_disptab.c index b85d5d844..85bca389a 100644 --- a/GL/glx/g_disptab.c +++ b/GL/glx/g_disptab.c @@ -54,18 +54,18 @@ __GLXdispatchSingleProcPtr __glXSingleTable[__GLX_SINGLE_TABLE_SIZE] = { __glXQueryExtensionsString, __glXQueryServerString, __glXClientInfo, - __glXNoSuchSingleOpcode, /* glXGetFBConfigs */ - __glXNoSuchSingleOpcode, /* glXCreatePixmap */ - __glXNoSuchSingleOpcode, /* glXDestroyPixmap */ - __glXNoSuchSingleOpcode, /* glXCreateNewContext */ + __glXGetFBConfigs, + __glXCreatePixmap, + __glXDestroyGLXPixmap, /* glXDestroyPixmap */ + __glXCreateNewContext, __glXNoSuchSingleOpcode, /* glXQueryContext */ __glXMakeContextCurrent, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, /* glXCreatePbuffer */ + __glXNoSuchSingleOpcode, /* glXDestroyPbuffer */ + __glXNoSuchSingleOpcode, /* glXGetDrawableAttributes */ + __glXNoSuchSingleOpcode, /* glXChangeDrawableAttributes */ + __glXNoSuchSingleOpcode, /* glXCreateWindow */ + __glXNoSuchSingleOpcode, /* glXDestroyWindow */ __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, @@ -425,7 +425,7 @@ __GLXdispatchRenderProcPtr __glXRenderTable[] = { __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, + __glXDisp_SampleCoverageARB, __glXDisp_WindowPos3fARB /* 230 */ }; @@ -451,18 +451,18 @@ __GLXdispatchSingleProcPtr __glXSwapSingleTable[__GLX_SINGLE_TABLE_SIZE] = { __glXSwapQueryExtensionsString, __glXSwapQueryServerString, __glXSwapClientInfo, - __glXNoSuchSingleOpcode, /* glXGetFBConfigs */ - __glXNoSuchSingleOpcode, /* glXCreatePixmap */ - __glXNoSuchSingleOpcode, /* glXDestroyPixmap */ - __glXNoSuchSingleOpcode, /* glXCreateNewContext */ + __glXSwapGetFBConfigs, + __glXSwapCreatePixmap, + __glXSwapDestroyGLXPixmap, /* glXDestroyPixmap */ + __glXSwapCreateNewContext, __glXNoSuchSingleOpcode, /* glXQueryContext */ __glXSwapMakeContextCurrent, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, /* glXCreatePbuffer */ + __glXNoSuchSingleOpcode, /* glXDestroyPbuffer */ + __glXNoSuchSingleOpcode, /* glXGetDrawableAttributes */ + __glXNoSuchSingleOpcode, /* glXChangeDrawableAttributes */ + __glXNoSuchSingleOpcode, /* glXCreateWindow */ + __glXNoSuchSingleOpcode, /* glXDestroyWindow */ __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, @@ -822,6 +822,6 @@ __GLXdispatchRenderProcPtr __glXSwapRenderTable[__GLX_RENDER_TABLE_SIZE] = { __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, + __glXDispSwap_SampleCoverageARB, __glXDispSwap_WindowPos3fARB /* 230 */ }; diff --git a/GL/glx/g_disptab.h b/GL/glx/g_disptab.h index 65a594d3e..6702980b9 100644 --- a/GL/glx/g_disptab.h +++ b/GL/glx/g_disptab.h @@ -52,6 +52,9 @@ extern int __glXQueryExtensionsString(__GLXclientState*, GLbyte*); extern int __glXQueryServerString(__GLXclientState*, GLbyte*); extern int __glXClientInfo(__GLXclientState*, GLbyte*); extern int __glXMakeContextCurrent(__GLXclientState*, GLbyte*); +extern int __glXGetFBConfigs(__GLXclientState*, GLbyte*); +extern int __glXCreateNewContext(__GLXclientState*, GLbyte*); +extern int __glXCreatePixmap(__GLXclientState*, GLbyte*); extern int __glXDisp_NewList(__GLXclientState*, GLbyte*); extern int __glXDisp_EndList(__GLXclientState*, GLbyte*); @@ -325,6 +328,7 @@ extern void __glXDisp_MultiTexCoord4dvARB(GLbyte*); extern void __glXDisp_MultiTexCoord4fvARB(GLbyte*); extern void __glXDisp_MultiTexCoord4ivARB(GLbyte*); extern void __glXDisp_MultiTexCoord4svARB(GLbyte*); +extern void __glXDisp_SampleCoverageARB(GLbyte *); extern void __glXDisp_WindowPos3fARB(GLbyte *); extern int __glXSwapRender(__GLXclientState*, GLbyte*); @@ -348,6 +352,9 @@ extern int __glXSwapQueryExtensionsString(__GLXclientState*, GLbyte*); extern int __glXSwapQueryServerString(__GLXclientState*, GLbyte*); extern int __glXSwapClientInfo(__GLXclientState*, GLbyte*); extern int __glXSwapMakeContextCurrent(__GLXclientState*, GLbyte*); +extern int __glXSwapGetFBConfigs(__GLXclientState*, GLbyte*); +extern int __glXSwapCreateNewContext(__GLXclientState*, GLbyte*); +extern int __glXSwapCreatePixmap(__GLXclientState*, GLbyte*); extern int __glXDispSwap_NewList(__GLXclientState*, GLbyte*); extern int __glXDispSwap_EndList(__GLXclientState*, GLbyte*); @@ -621,6 +628,7 @@ extern void __glXDispSwap_MultiTexCoord4dvARB(GLbyte*); extern void __glXDispSwap_MultiTexCoord4fvARB(GLbyte*); extern void __glXDispSwap_MultiTexCoord4ivARB(GLbyte*); extern void __glXDispSwap_MultiTexCoord4svARB(GLbyte*); +extern void __glXDispSwap_SampleCoverageARB(GLbyte *); extern void __glXDispSwap_WindowPos3fARB(GLbyte *); #define __GLX_MIN_GLXCMD_OPCODE 1 diff --git a/GL/glx/g_disptab_EXT.c b/GL/glx/g_disptab_EXT.c index be82264a4..c37a236db 100644 --- a/GL/glx/g_disptab_EXT.c +++ b/GL/glx/g_disptab_EXT.c @@ -2104,22 +2104,22 @@ __GLXdispatchRenderProcPtr __glXRenderTable_EXT[__GLX_MAX_RENDER_OPCODE_EXT - __ __glXDisp_CopyTexSubImage1D, /* 4121 */ __glXDisp_CopyTexSubImage2D, /* 4122 */ __glXDisp_CopyTexSubImage3D, /* 4123 */ - __glXNoSuchRenderOpcode, /* 4124 */ - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, /* 4130 */ - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, + __glXDisp_FogCoordfv, /* 4124 */ + __glXDisp_FogCoorddv, /* 4125 */ + __glXDisp_SecondaryColor3bv, /* 4126 */ + __glXDisp_SecondaryColor3sv, /* 4127 */ + __glXDisp_SecondaryColor3iv, /* 4128 */ + __glXDisp_SecondaryColor3fv, /* 4129 */ + __glXDisp_SecondaryColor3dv, /* 4130 */ + __glXDisp_SecondaryColor3ubv, /* 4131 */ + __glXDisp_SecondaryColor3usv, /* 4132 */ + __glXDisp_SecondaryColor3uiv, /* 4133 */ + __glXDisp_BlendFuncSeparate, /* 4134 */ + __glXNoSuchRenderOpcode, /* 4135 */ + __glXNoSuchRenderOpcode, /* 4136 */ + __glXNoSuchRenderOpcode, /* 4137 */ + __glXNoSuchRenderOpcode, /* 4138 */ + __glXNoSuchRenderOpcode, /* 4139 */ __glXNoSuchRenderOpcode, /* 4140 */ __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, @@ -2201,6 +2201,8 @@ __GLXdispatchRenderProcPtr __glXRenderTable_EXT[__GLX_MAX_RENDER_OPCODE_EXT - __ __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, /* 4219 */ __glXDisp_ActiveStencilFaceEXT, /* 4220 */ + __glXDisp_PointParameteri, /* 4221 */ + __glXDisp_PointParameteriv, /* 4222 */ }; __GLXdispatchVendorPrivProcPtr __glXVendorPrivTable_EXT[__GLX_MAX_VENDPRIV_OPCODE_EXT - __GLX_MIN_VENDPRIV_OPCODE_EXT + 1] = { __glXDisp_AreTexturesResidentEXT, /* 11 */ @@ -4282,22 +4284,22 @@ __GLXdispatchRenderProcPtr __glXSwapRenderTable_EXT[__GLX_MAX_RENDER_OPCODE_EXT __glXDispSwap_CopyTexSubImage1D, /* 4121 */ __glXDispSwap_CopyTexSubImage2D, /* 4122 */ __glXDispSwap_CopyTexSubImage3D, /* 4123 */ - __glXNoSuchRenderOpcode, /* 4124 */ - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, /* 4130 */ - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, + __glXDispSwap_FogCoordfv, /* 4124 */ + __glXDispSwap_FogCoorddv, /* 4125 */ + __glXDispSwap_SecondaryColor3bv, /* 4126 */ + __glXDispSwap_SecondaryColor3sv, /* 4127 */ + __glXDispSwap_SecondaryColor3iv, /* 4128 */ + __glXDispSwap_SecondaryColor3fv, /* 4129 */ + __glXDispSwap_SecondaryColor3dv, /* 4130 */ + __glXDispSwap_SecondaryColor3ubv, /* 4131 */ + __glXDispSwap_SecondaryColor3usv, /* 4132 */ + __glXDispSwap_SecondaryColor3uiv, /* 4133 */ + __glXDisp_BlendFuncSeparate, /* 4134 */ + __glXNoSuchRenderOpcode, /* 4135 */ + __glXNoSuchRenderOpcode, /* 4136 */ + __glXNoSuchRenderOpcode, /* 4137 */ + __glXNoSuchRenderOpcode, /* 4138 */ + __glXNoSuchRenderOpcode, /* 4139 */ __glXNoSuchRenderOpcode, /* 4140 */ __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, @@ -4379,6 +4381,8 @@ __GLXdispatchRenderProcPtr __glXSwapRenderTable_EXT[__GLX_MAX_RENDER_OPCODE_EXT __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, /* 4219 */ __glXDispSwap_ActiveStencilFaceEXT, /* 4220 */ + __glXDispSwap_PointParameteri, /* 4221 */ + __glXDispSwap_PointParameteriv, /* 4222 */ }; __GLXdispatchVendorPrivProcPtr __glXSwapVendorPrivTable_EXT[__GLX_MAX_VENDPRIV_OPCODE_EXT - __GLX_MIN_VENDPRIV_OPCODE_EXT + 1] = { __glXDispSwap_AreTexturesResidentEXT, /* 11 */ diff --git a/GL/glx/g_disptab_EXT.h b/GL/glx/g_disptab_EXT.h index 0d118c5c4..52eb44324 100644 --- a/GL/glx/g_disptab_EXT.h +++ b/GL/glx/g_disptab_EXT.h @@ -69,6 +69,37 @@ extern void __glXDisp_CopyTexSubImage2D(GLbyte*); extern void __glXDisp_CopyTexSubImage3D(GLbyte*); extern void __glXDisp_PointParameterfARB(GLbyte*); extern void __glXDisp_PointParameterfvARB(GLbyte*); + +extern void __glXDisp_FogCoordfv(GLbyte *); +extern void __glXDisp_FogCoorddv(GLbyte *); +extern void __glXDispSwap_FogCoordfv(GLbyte *); +extern void __glXDispSwap_FogCoorddv(GLbyte *); + +extern void __glXDisp_SecondaryColor3bv(GLbyte *); +extern void __glXDisp_SecondaryColor3sv(GLbyte *); +extern void __glXDisp_SecondaryColor3iv(GLbyte *); +extern void __glXDisp_SecondaryColor3ubv(GLbyte *); +extern void __glXDisp_SecondaryColor3usv(GLbyte *); +extern void __glXDisp_SecondaryColor3uiv(GLbyte *); +extern void __glXDisp_SecondaryColor3fv(GLbyte *); +extern void __glXDisp_SecondaryColor3dv(GLbyte *); +extern void __glXDispSwap_SecondaryColor3bv(GLbyte *); +extern void __glXDispSwap_SecondaryColor3sv(GLbyte *); +extern void __glXDispSwap_SecondaryColor3iv(GLbyte *); +extern void __glXDispSwap_SecondaryColor3ubv(GLbyte *); +extern void __glXDispSwap_SecondaryColor3usv(GLbyte *); +extern void __glXDispSwap_SecondaryColor3uiv(GLbyte *); +extern void __glXDispSwap_SecondaryColor3fv(GLbyte *); +extern void __glXDispSwap_SecondaryColor3dv(GLbyte *); + +extern void __glXDisp_BlendFuncSeparate(GLbyte *); +extern void __glXDispSwap_BlendFuncSeparate(GLbyte *); + +extern void __glXDisp_PointParameteri(GLbyte *); +extern void __glXDisp_PointParameteriv(GLbyte *); +extern void __glXDispSwap_PointParameteri(GLbyte *); +extern void __glXDispSwap_PointParameteriv(GLbyte *); + extern void __glXDisp_ActiveStencilFaceEXT(GLbyte*); extern int __glXDispSwap_AreTexturesResidentEXT(__GLXclientState*, GLbyte*); @@ -112,7 +143,7 @@ extern void __glXDispSwap_PointParameterfvARB(GLbyte*); extern void __glXDispSwap_ActiveStencilFaceEXT(GLbyte*); #define __GLX_MIN_RENDER_OPCODE_EXT 2053 -#define __GLX_MAX_RENDER_OPCODE_EXT 4220 +#define __GLX_MAX_RENDER_OPCODE_EXT 4222 #define __GLX_MIN_VENDPRIV_OPCODE_EXT 11 #define __GLX_MAX_VENDPRIV_OPCODE_EXT 14 #define __GLX_VENDPRIV_TABLE_SIZE_EXT (__GLX_MAX_VENDPRIV_OPCODE_EXT - __GLX_MIN_VENDPRIV_OPCODE_EXT + 1) diff --git a/GL/glx/g_render.c b/GL/glx/g_render.c index 35e083399..c1aa6a115 100644 --- a/GL/glx/g_render.c +++ b/GL/glx/g_render.c @@ -59,6 +59,155 @@ void __glXDisp_Begin(GLbyte *pc) ); } +#define __GLX_SWAP_GLbyte(ptr) +#define __GLX_SWAP_GLshort(ptr) __GLX_SWAP_SHORT(ptr) +#define __GLX_SWAP_GLint(ptr) __GLX_SWAP_INT(ptr) +#define __GLX_SWAP_GLubyte(ptr) +#define __GLX_SWAP_GLushort(ptr) __GLX_SWAP_SHORT(ptr) +#define __GLX_SWAP_GLuint(ptr) __GLX_SWAP_INT(ptr) +#define __GLX_SWAP_GLdouble(ptr) __GLX_SWAP_DOUBLE(ptr) +#define __GLX_SWAP_GLfloat(ptr) __GLX_SWAP_FLOAT(ptr) + +#define __GLX_SWAP_GLbyte_ARRAY(ptr,count) (void) swapEnd; (void) swapPC; (void) sw; +#define __GLX_SWAP_GLshort_ARRAY(ptr,count) __GLX_SWAP_SHORT_ARRAY(ptr,count) +#define __GLX_SWAP_GLint_ARRAY(ptr,count) __GLX_SWAP_INT_ARRAY(ptr,count) +#define __GLX_SWAP_GLenum_ARRAY(ptr,count) __GLX_SWAP_INT_ARRAY(ptr,count) +#define __GLX_SWAP_GLubyte_ARRAY(ptr,count) (void) swapEnd; (void) swapPC; (void) sw; +#define __GLX_SWAP_GLushort_ARRAY(ptr,count) __GLX_SWAP_SHORT_ARRAY(ptr,count) +#define __GLX_SWAP_GLuint_ARRAY(ptr,count) __GLX_SWAP_INT_ARRAY(ptr,count) +#define __GLX_SWAP_GLdouble_ARRAY(ptr,count) __GLX_SWAP_DOUBLE_ARRAY(ptr,count) +#define __GLX_SWAP_GLfloat_ARRAY(ptr,count) __GLX_SWAP_FLOAT_ARRAY(ptr,count) + +#ifdef __GLX_ALIGN64 +/* If type is not GLdouble, the compiler should optimize this away. + */ +# define GLX_DO_ALIGN_MAGIC(count, type) \ + do { \ + if ( (sizeof(type) == 8) && ((unsigned long)(pc) & 7)) \ + { \ + __GLX_MEM_COPY(pc-4, pc, (count * sizeof( type ) )); \ + pc -= 4; \ + } \ + } while( 0 ) +#else +# define GLX_DO_ALIGN_MAGIC(count, type) +#endif + +#define dispatch_template_1( name, type ) \ + void __glXDisp_ ## name ( GLbyte * pc ) \ + { \ + GLX_DO_ALIGN_MAGIC( 1, type ); \ + gl ## name ( (type *) pc ); \ + } \ + void __glXDispSwap_ ## name ( GLbyte * pc ) \ + { \ + __GLX_DECLARE_SWAP_VARIABLES; \ + GLX_DO_ALIGN_MAGIC( 1, type ); \ + __GLX_SWAP_ ## type ( pc ); \ + gl ## name ( (type *) pc ); \ + } + +#define dispatch_template_3( name, type ) \ + void __glXDisp_ ## name ( GLbyte * pc ) \ + { \ + GLX_DO_ALIGN_MAGIC( 3, type ); \ + gl ## name ( (type *) pc ); \ + } \ + void __glXDispSwap_ ## name ( GLbyte * pc ) \ + { \ + __GLX_DECLARE_SWAP_VARIABLES; \ + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; \ + GLX_DO_ALIGN_MAGIC( 3, type ); \ + __GLX_SWAP_ ## type ## _ARRAY(pc, 3); \ + gl ## name ( (type *) pc ); \ + } + +#define dispatch_template_4( name, type ) \ + void __glXDisp_ ## name ( GLbyte * pc ) \ + { \ + GLX_DO_ALIGN_MAGIC( 4, type ); \ + gl ## name ( (type *) pc ); \ + } \ + void __glXDispSwap_ ## name ( GLbyte * pc ) \ + { \ + __GLX_DECLARE_SWAP_VARIABLES; \ + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; \ + GLX_DO_ALIGN_MAGIC( 4, type ); \ + __GLX_SWAP_ ## type ## _ARRAY(pc, 4); \ + gl ## name ( (type *) pc ); \ + } + +#define dispatch_template_4s( name, type ) \ + void __glXDisp_ ## name ( GLbyte * pc ) \ + { \ + GLX_DO_ALIGN_MAGIC( 4, type ); \ + gl ## name ( ((type *) pc)[0], ((type *) pc)[1], \ + ((type *) pc)[2], ((type *) pc)[3] ); \ + } \ + void __glXDispSwap_ ## name ( GLbyte * pc ) \ + { \ + __GLX_DECLARE_SWAP_VARIABLES; \ + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; \ + GLX_DO_ALIGN_MAGIC( 4, type ); \ + __GLX_SWAP_ ## type ## _ARRAY(pc, 4); \ + gl ## name ( ((type *) pc)[0], ((type *) pc)[1], \ + ((type *) pc)[2], ((type *) pc)[3] ); \ + } + +/** + * \bug All of the enum1 templates need to be updated to handle the case where + * \c type is \c GLdouble. When the type is a double, the data comes before + * the enum. This is also the reason the invocation of the + * \c GLX_DO_ALIGN_MAGIC macro was removed. + */ +#define dispatch_template_enum1_1s( name, type ) \ + void __glXDisp_ ## name ( GLbyte * pc ) \ + { \ + gl ## name ( *(GLenum *) (pc + 0), \ + *(type *) (pc + 4) ); \ + } \ + void __glXDispSwap_ ## name ( GLbyte * pc ) \ + { \ + __GLX_DECLARE_SWAP_VARIABLES; \ + __GLX_SWAP_INT (pc + 0); \ + __GLX_SWAP_ ## type (pc + 4); \ + gl ## name ( *(GLenum *) (pc + 0), \ + *(type *) (pc + 4) ); \ + } + +#define dispatch_template_enum1_Vv( name, type ) \ + void __glXDisp_ ## name ( GLbyte * pc ) \ + { \ + gl ## name ( *(GLenum *) (pc + 0), \ + (type *) (pc + 4) ); \ + } \ + void __glXDispSwap_ ## name ( GLbyte * pc ) \ + { \ + GLenum pname; GLint compsize; \ + __GLX_DECLARE_SWAP_VARIABLES; \ + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; \ + __GLX_SWAP_INT(pc + 0); \ + pname = *(GLenum *)(pc + 0); \ + compsize = __gl ## name ## _size(pname); \ + if (compsize < 0) compsize = 0; \ + __GLX_SWAP_ ## type ## _ARRAY(pc + 4, compsize); \ + gl ## name ( *(GLenum *) (pc + 0), \ + (type *) (pc + 4) ); \ + } + +dispatch_template_1( FogCoordfv, GLfloat ) +dispatch_template_1( FogCoorddv, GLdouble ) +dispatch_template_3( SecondaryColor3bv, GLbyte ) +dispatch_template_3( SecondaryColor3sv, GLshort ) +dispatch_template_3( SecondaryColor3iv, GLint ) +dispatch_template_3( SecondaryColor3ubv, GLubyte ) +dispatch_template_3( SecondaryColor3usv, GLushort ) +dispatch_template_3( SecondaryColor3uiv, GLuint ) +dispatch_template_3( SecondaryColor3fv, GLfloat ) +dispatch_template_3( SecondaryColor3dv, GLdouble ) + +dispatch_template_4s( BlendFuncSeparate, GLenum ) + void __glXDisp_Color3bv(GLbyte *pc) { glColor3bv( @@ -2097,6 +2246,9 @@ void __glXDisp_PointParameterfvARB(GLbyte *pc) ); } +dispatch_template_enum1_1s(PointParameteri, GLint) +dispatch_template_enum1_Vv(PointParameteriv, GLint) + void __glXDisp_ActiveStencilFaceEXT(GLbyte *pc) { glActiveStencilFaceEXT( @@ -2112,3 +2264,11 @@ void __glXDisp_WindowPos3fARB(GLbyte *pc) *(GLfloat *)(pc + 8) ); } + +void __glXDisp_SampleCoverageARB(GLbyte *pc) +{ + glSampleCoverageARB( + *(GLfloat *)(pc + 0), + *(GLboolean *)(pc + 4) + ); +} diff --git a/GL/glx/g_renderswap.c b/GL/glx/g_renderswap.c index 6a199d8c7..5c74d2598 100644 --- a/GL/glx/g_renderswap.c +++ b/GL/glx/g_renderswap.c @@ -3364,3 +3364,15 @@ void __glXDispSwap_WindowPos3fARB(GLbyte *pc) *(GLfloat *)(pc + 8) ); } + +void __glXDispSwap_SampleCoverageARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + __GLX_SWAP_FLOAT(pc + 0); + __GLX_SWAP_INT(pc + 4); + + glSampleCoverageARB( + *(GLfloat *)(pc + 0), + *(GLboolean *)(pc + 4) + ); +} diff --git a/GL/glx/glxcmds.c b/GL/glx/glxcmds.c index b6f358f2e..d3c9f2565 100644 --- a/GL/glx/glxcmds.c +++ b/GL/glx/glxcmds.c @@ -47,6 +47,7 @@ #include "glxutil.h" #include "glxext.h" #include "GL/glx_ansic.h" +#include "glcontextmodes.h" /************************************************************************/ @@ -68,29 +69,32 @@ static __GLimports imports = { NULL }; -static int DoMakeCurrent( __GLXclientState *cl, GLXDrawable drawId, - GLXDrawable readId, GLXContextID contextId, GLXContextTag tag ); +static int __glXGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc); +static int __glXCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc); +static int __glXCreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc); +static int __glXMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc); /************************************************************************/ -/* -** Create a GL context with the given properties. -*/ -int __glXCreateContext(__GLXclientState *cl, GLbyte *pc) +/** + * Create a GL context with the given properties. This routine is used + * to implement \c glXCreateContext, \c glXCreateNewContext, and + * \c glXCreateContextWithConfigSGIX. This works becuase of the hack way + * that GLXFBConfigs are implemented. Basically, the FBConfigID is the + * same as the VisualID. + */ + +int DoCreateContext(__GLXclientState *cl, GLXContextID gcId, + GLXContextID shareList, VisualID visual, + GLuint screen, GLboolean isDirect) { ClientPtr client = cl->client; - xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc; VisualPtr pVisual; ScreenPtr pScreen; __GLXcontext *glxc, *shareglxc; - __GLXvisualConfig *pGlxVisual; + __GLcontextModes *modes; __GLXscreenInfo *pGlxScreen; __GLinterface *shareGC; - GLXContextID gcId = req->context; - GLXContextID shareList = req->shareList; - VisualID visual = req->visual; - GLuint screen = req->screen; - GLboolean isDirect = req->isDirect; GLint i; /* @@ -123,13 +127,9 @@ int __glXCreateContext(__GLXclientState *cl, GLbyte *pc) ** subset of Visuals that are supported by this implementation of the ** OpenGL. */ - pGlxVisual = pGlxScreen->pGlxVisual; - for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) { - if (pGlxVisual->vid == visual) { - break; - } - } - if (i == pGlxScreen->numVisuals) { + + modes = _gl_context_modes_find_visual( pGlxScreen->modes, visual ); + if (modes == NULL) { /* ** Visual not support on this screen by this OpenGL implementation. */ @@ -192,22 +192,15 @@ int __glXCreateContext(__GLXclientState *cl, GLbyte *pc) glxc->pScreen = pScreen; glxc->pGlxScreen = pGlxScreen; glxc->pVisual = pVisual; - glxc->pGlxVisual = pGlxVisual; + glxc->modes = modes; if (!isDirect) { - __GLcontextModes *modes; - /* - ** first build __GLcontextModes from __GLXvisualConfig - */ - modes = (__GLcontextModes *) __glXMalloc(sizeof(__GLcontextModes)); - glxc->modes = modes; - __glXFormatGLModes(modes, pGlxVisual); /* ** Allocate a GL context */ imports.other = (void *)glxc; - glxc->gc = (*pGlxScreen->createContext)(&imports, modes, shareGC); + glxc->gc = (*pGlxScreen->createContext)(&imports, glxc->modes, shareGC); if (!glxc->gc) { __glXFree(glxc); client->errorValue = gcId; @@ -245,6 +238,31 @@ int __glXCreateContext(__GLXclientState *cl, GLbyte *pc) return Success; } + +int __glXCreateContext(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc; + return DoCreateContext( cl, req->context, req->shareList, req->visual, + req->screen, req->isDirect ); +} + + +int __glXCreateNewContext(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc; + return DoCreateContext( cl, req->context, req->shareList, req->fbconfig, + req->screen, req->isDirect ); +} + + +int __glXCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateContextWithConfigSGIXReq *req = + (xGLXCreateContextWithConfigSGIXReq *) pc; + return DoCreateContext( cl, req->context, req->shareList, req->fbconfig, + req->screen, req->isDirect ); +} + /* ** Destroy a GL context as an X resource. */ @@ -370,24 +388,24 @@ int __glXMakeCurrent(__GLXclientState *cl, GLbyte *pc) { xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc; - return DoMakeCurrent( cl, req->drawable, req->drawable, - req->context, req->oldContextTag ); + return DoMakeCurrent( cl, req->drawable, req->drawable, + req->context, req->oldContextTag ); } int __glXMakeContextCurrent(__GLXclientState *cl, GLbyte *pc) { xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc; - return DoMakeCurrent( cl, req->drawable, req->readdrawable, - req->context, req->oldContextTag ); + return DoMakeCurrent( cl, req->drawable, req->readdrawable, + req->context, req->oldContextTag ); } int __glXMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc) { xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc; - return DoMakeCurrent( cl, req->drawable, req->readable, - req->context, req->oldContextTag ); + return DoMakeCurrent( cl, req->drawable, req->readable, + req->context, req->oldContextTag ); } @@ -449,7 +467,7 @@ static int GetDrawableOrPixmap( __GLXcontext *glxc, GLXDrawable drawId, ** Check if pixmap and context are similar. */ if (drawPixmap->pScreen != glxc->pScreen || - drawPixmap->pGlxVisual != glxc->pGlxVisual) { + drawPixmap->modes->visualID != glxc->modes->visualID) { client->errorValue = drawId; return BadMatch; } @@ -471,9 +489,9 @@ static int GetDrawableOrPixmap( __GLXcontext *glxc, GLXDrawable drawId, } -static int DoMakeCurrent( __GLXclientState *cl, - GLXDrawable drawId, GLXDrawable readId, - GLXContextID contextId, GLXContextTag tag ) +int DoMakeCurrent( __GLXclientState *cl, + GLXDrawable drawId, GLXDrawable readId, + GLXContextID contextId, GLXContextTag tag ) { ClientPtr client = cl->client; DrawablePtr pDraw; @@ -879,18 +897,19 @@ int __glXCopyContext(__GLXclientState *cl, GLbyte *pc) return Success; } -int __glXGetVisualConfigs(__GLXclientState *cl, GLbyte *pc) + +int DoGetVisualConfigs(__GLXclientState *cl, unsigned screen, + GLboolean do_swap) { ClientPtr client = cl->client; - xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc; xGLXGetVisualConfigsReply reply; __GLXscreenInfo *pGlxScreen; - __GLXvisualConfig *pGlxVisual; + __GLcontextModes *modes; CARD32 buf[__GLX_TOTAL_CONFIG]; - unsigned int screen; - int i, p; + int p; + __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - screen = req->screen; if (screen >= screenInfo.numScreens) { /* The client library must send a valid screen number. */ client->errorValue = screen; @@ -905,77 +924,206 @@ int __glXGetVisualConfigs(__GLXclientState *cl, GLbyte *pc) reply.type = X_Reply; reply.sequenceNumber = client->sequence; + if ( do_swap ) { + __GLX_SWAP_SHORT(&reply.sequenceNumber); + __GLX_SWAP_INT(&reply.length); + __GLX_SWAP_INT(&reply.numVisuals); + __GLX_SWAP_INT(&reply.numProps); + } + WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *)&reply); - for (i=0; i < pGlxScreen->numVisuals; i++) { - pGlxVisual = &pGlxScreen->pGlxVisual[i]; - if (pGlxVisual->vid == 0) { + for ( modes = pGlxScreen->modes ; modes != NULL ; modes = modes->next ) { + if (modes->visualID == 0) { /* not a usable visual */ continue; } p = 0; - buf[p++] = pGlxVisual->vid; - buf[p++] = pGlxVisual->class; - buf[p++] = pGlxVisual->rgba; - - buf[p++] = pGlxVisual->redSize; - buf[p++] = pGlxVisual->greenSize; - buf[p++] = pGlxVisual->blueSize; - buf[p++] = pGlxVisual->alphaSize; - buf[p++] = pGlxVisual->accumRedSize; - buf[p++] = pGlxVisual->accumGreenSize; - buf[p++] = pGlxVisual->accumBlueSize; - buf[p++] = pGlxVisual->accumAlphaSize; - - buf[p++] = pGlxVisual->doubleBuffer; - buf[p++] = pGlxVisual->stereo; - - buf[p++] = pGlxVisual->bufferSize; - buf[p++] = pGlxVisual->depthSize; - buf[p++] = pGlxVisual->stencilSize; - buf[p++] = pGlxVisual->auxBuffers; - buf[p++] = pGlxVisual->level; + buf[p++] = modes->visualID; + buf[p++] = _gl_convert_to_x_visual_type( modes->visualType ); + buf[p++] = modes->rgbMode; + + buf[p++] = modes->redBits; + buf[p++] = modes->greenBits; + buf[p++] = modes->blueBits; + buf[p++] = modes->alphaBits; + buf[p++] = modes->accumRedBits; + buf[p++] = modes->accumGreenBits; + buf[p++] = modes->accumBlueBits; + buf[p++] = modes->accumAlphaBits; + + buf[p++] = modes->doubleBufferMode; + buf[p++] = modes->stereoMode; + + buf[p++] = modes->rgbBits; + buf[p++] = modes->depthBits; + buf[p++] = modes->stencilBits; + buf[p++] = modes->numAuxBuffers; + buf[p++] = modes->level; /* ** Add token/value pairs for extensions. */ buf[p++] = GLX_VISUAL_CAVEAT_EXT; - buf[p++] = pGlxVisual->visualRating; - buf[p++] = GLX_TRANSPARENT_TYPE_EXT; - buf[p++] = pGlxVisual->transparentPixel; - buf[p++] = GLX_TRANSPARENT_RED_VALUE_EXT; - buf[p++] = pGlxVisual->transparentRed; - buf[p++] = GLX_TRANSPARENT_GREEN_VALUE_EXT; - buf[p++] = pGlxVisual->transparentGreen; - buf[p++] = GLX_TRANSPARENT_BLUE_VALUE_EXT; - buf[p++] = pGlxVisual->transparentBlue; - buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE_EXT; - buf[p++] = pGlxVisual->transparentAlpha; - buf[p++] = GLX_TRANSPARENT_INDEX_VALUE_EXT; - buf[p++] = pGlxVisual->transparentIndex; - + buf[p++] = modes->visualRating; + buf[p++] = GLX_TRANSPARENT_TYPE; + buf[p++] = modes->transparentPixel; + buf[p++] = GLX_TRANSPARENT_RED_VALUE; + buf[p++] = modes->transparentRed; + buf[p++] = GLX_TRANSPARENT_GREEN_VALUE; + buf[p++] = modes->transparentGreen; + buf[p++] = GLX_TRANSPARENT_BLUE_VALUE; + buf[p++] = modes->transparentBlue; + buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE; + buf[p++] = modes->transparentAlpha; + buf[p++] = GLX_TRANSPARENT_INDEX_VALUE; + buf[p++] = modes->transparentIndex; + + if ( do_swap ) { + __GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_CONFIG); + } WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG, (char *)buf); } return Success; } +int __glXGetVisualConfigs(__GLXclientState *cl, GLbyte *pc) +{ + xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc; + return DoGetVisualConfigs( cl, req->screen, GL_FALSE ); +} + + + +#define __GLX_TOTAL_FBCONFIG_ATTRIBS (28) + +/** + * Send the set of GLXFBConfigs to the client. There is not currently + * and interface into the driver on the server-side to get GLXFBConfigs, + * so we "invent" some based on the \c __GLXvisualConfig structures that + * the driver does supply. + * + * The reply format for both \c glXGetFBConfigs and \c glXGetFBConfigsSGIX + * is the same, so this routine pulls double duty. + */ + +int DoGetFBConfigs(__GLXclientState *cl, unsigned screen, GLboolean do_swap) +{ + ClientPtr client = cl->client; + xGLXGetFBConfigsReply reply; + __GLXscreenInfo *pGlxScreen; + CARD32 buf[__GLX_TOTAL_FBCONFIG_ATTRIBS * 2]; + int p; + __GLcontextModes *modes; + __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; + + + if (screen >= screenInfo.numScreens) { + /* The client library must send a valid screen number. */ + client->errorValue = screen; + return BadValue; + } + pGlxScreen = &__glXActiveScreens[screen]; + + reply.numFBConfigs = pGlxScreen->numUsableVisuals; + reply.numAttribs = __GLX_TOTAL_FBCONFIG_ATTRIBS; + reply.length = (reply.numAttribs * reply.numFBConfigs); + reply.type = X_Reply; + reply.sequenceNumber = client->sequence; + + if ( do_swap ) { + __GLX_SWAP_SHORT(&reply.sequenceNumber); + __GLX_SWAP_INT(&reply.length); + __GLX_SWAP_INT(&reply.numFBConfigs); + __GLX_SWAP_INT(&reply.numAttribs); + } + + WriteToClient(client, sz_xGLXGetFBConfigsReply, (char *)&reply); + + for ( modes = pGlxScreen->modes ; modes != NULL ; modes = modes->next ) { + if (modes->visualID == 0) { + /* not a usable visual */ + continue; + } + p = 0; + +#define WRITE_PAIR(tag,value) \ + do { buf[p++] = tag ; buf[p++] = value ; } while( 0 ) + + WRITE_PAIR( GLX_VISUAL_ID, modes->visualID ); + WRITE_PAIR( GLX_FBCONFIG_ID, modes->visualID ); + WRITE_PAIR( GLX_X_RENDERABLE, GL_TRUE ); + + WRITE_PAIR( GLX_RGBA, modes->rgbMode ); + WRITE_PAIR( GLX_DOUBLEBUFFER, modes->doubleBufferMode ); + WRITE_PAIR( GLX_STEREO, modes->stereoMode ); + + WRITE_PAIR( GLX_BUFFER_SIZE, modes->rgbBits ); + WRITE_PAIR( GLX_LEVEL, modes->level ); + WRITE_PAIR( GLX_AUX_BUFFERS, modes->numAuxBuffers ); + WRITE_PAIR( GLX_RED_SIZE, modes->redBits ); + WRITE_PAIR( GLX_GREEN_SIZE, modes->greenBits ); + WRITE_PAIR( GLX_BLUE_SIZE, modes->blueBits ); + WRITE_PAIR( GLX_ALPHA_SIZE, modes->alphaBits ); + WRITE_PAIR( GLX_ACCUM_RED_SIZE, modes->accumRedBits ); + WRITE_PAIR( GLX_ACCUM_GREEN_SIZE, modes->accumGreenBits ); + WRITE_PAIR( GLX_ACCUM_BLUE_SIZE, modes->accumBlueBits ); + WRITE_PAIR( GLX_ACCUM_ALPHA_SIZE, modes->accumAlphaBits ); + WRITE_PAIR( GLX_DEPTH_SIZE, modes->depthBits ); + WRITE_PAIR( GLX_STENCIL_SIZE, modes->stencilBits ); + + WRITE_PAIR( GLX_X_VISUAL_TYPE, modes->visualType ); + + /* + ** Add token/value pairs for extensions. + */ + WRITE_PAIR( GLX_CONFIG_CAVEAT, modes->visualRating ); + WRITE_PAIR( GLX_TRANSPARENT_TYPE, modes->transparentPixel ); + WRITE_PAIR( GLX_TRANSPARENT_RED_VALUE, modes->transparentRed ); + WRITE_PAIR( GLX_TRANSPARENT_GREEN_VALUE, modes->transparentGreen ); + WRITE_PAIR( GLX_TRANSPARENT_BLUE_VALUE, modes->transparentBlue ); + WRITE_PAIR( GLX_TRANSPARENT_ALPHA_VALUE, modes->transparentAlpha ); + WRITE_PAIR( GLX_TRANSPARENT_INDEX_VALUE, modes->transparentIndex ); + WRITE_PAIR( GLX_SWAP_METHOD_OML, modes->swapMethod ); + + if ( do_swap ) { + __GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_FBCONFIG_ATTRIBS * 2); + } + WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_FBCONFIG_ATTRIBS * 2, + (char *)buf); + } + return Success; +} + + +int __glXGetFBConfigs(__GLXclientState *cl, GLbyte *pc) +{ + xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc; + return DoGetFBConfigs( cl, req->screen, GL_FALSE ); +} + + +int __glXGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc) +{ + xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc; + return DoGetFBConfigs( cl, req->screen, GL_FALSE ); +} + + /* ** Create a GLX Pixmap from an X Pixmap. */ -int __glXCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) +int DoCreateGLXPixmap(__GLXclientState *cl, VisualID visual, + GLuint screenNum, XID pixmapId, XID glxpixmapId) { ClientPtr client = cl->client; - xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc; - VisualID visual = req->visual; - GLuint screenNum = req->screen; - XID pixmapId = req->pixmap; - XID glxpixmapId = req->glxpixmap; DrawablePtr pDraw; ScreenPtr pScreen; VisualPtr pVisual; __GLXpixmap *pGlxPixmap; __GLXscreenInfo *pGlxScreen; - __GLXvisualConfig *pGlxVisual; + __GLcontextModes *modes; int i; pDraw = (DrawablePtr) LookupDrawable(pixmapId, client); @@ -1016,13 +1164,8 @@ int __glXCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) ** Get configuration of the visual. */ pGlxScreen = &__glXActiveScreens[screenNum]; - pGlxVisual = pGlxScreen->pGlxVisual; - for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) { - if (pGlxVisual->vid == visual) { - break; - } - } - if (i == pGlxScreen->numVisuals) { + modes = _gl_context_modes_find_visual( pGlxScreen->modes, visual ); + if (modes == NULL) { /* ** Visual not support on this screen by this OpenGL implementation. */ @@ -1039,11 +1182,12 @@ int __glXCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) } pGlxPixmap->pDraw = pDraw; pGlxPixmap->pGlxScreen = pGlxScreen; - pGlxPixmap->pGlxVisual = pGlxVisual; pGlxPixmap->pScreen = pScreen; pGlxPixmap->idExists = True; pGlxPixmap->refcnt = 0; + pGlxPixmap->modes = modes; + /* ** Bump the ref count on the X pixmap so it won't disappear. */ @@ -1052,6 +1196,34 @@ int __glXCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) return Success; } +int __glXCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc; + return DoCreateGLXPixmap( cl, req->visual, req->screen, + req->pixmap, req->glxpixmap ); +} + +int __glXCreatePixmap(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc; + return DoCreateGLXPixmap( cl, req->fbconfig, req->screen, + req->pixmap, req->glxpixmap ); +} + +int __glXCreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateGLXPixmapWithConfigSGIXReq *req = + (xGLXCreateGLXPixmapWithConfigSGIXReq *) pc; + return DoCreateGLXPixmap( cl, req->fbconfig, req->screen, + req->pixmap, req->glxpixmap ); +} + + +/** + * Destroy a GLX pixmap. This function is used for both + * \c glXDestroyGLXPixmap and \c glXDestroyPixmap. + */ + int __glXDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; @@ -1552,6 +1724,17 @@ int __glXVendorPrivate(__GLXclientState *cl, GLbyte *pc) req = (xGLXVendorPrivateReq *) pc; vendorcode = req->vendorCode; + switch( vendorcode ) { + case X_GLvop_SampleMaskSGIS: + glSampleMaskSGIS(*(GLfloat *)(pc + 4), + *(GLboolean *)(pc + 8)); + return Success; + case X_GLvop_SamplePatternSGIS: + glSamplePatternSGIS( *(GLenum *)(pc + 4)); + return Success; + } + + if ((vendorcode >= __GLX_MIN_VENDPRIV_OPCODE_EXT) && (vendorcode <= __GLX_MAX_VENDPRIV_OPCODE_EXT)) { (*__glXVendorPrivTable_EXT[vendorcode-__GLX_MIN_VENDPRIV_OPCODE_EXT]) @@ -1578,6 +1761,12 @@ int __glXVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc) return __glXQueryContextInfoEXT(cl, pc); case X_GLXvop_MakeCurrentReadSGI: return __glXMakeCurrentReadSGI(cl, pc); + case X_GLXvop_GetFBConfigsSGIX: + return __glXGetFBConfigsSGIX(cl, pc); + case X_GLXvop_CreateContextWithConfigSGIX: + return __glXCreateContextWithConfigSGIX(cl, pc); + case X_GLXvop_CreateGLXPixmapWithConfigSGIX: + return __glXCreateGLXPixmapWithConfigSGIX(cl, pc); default: break; } diff --git a/GL/glx/glxcmdsswap.c b/GL/glx/glxcmdsswap.c index c6623db2f..6e63fc580 100644 --- a/GL/glx/glxcmdsswap.c +++ b/GL/glx/glxcmdsswap.c @@ -47,6 +47,11 @@ #include "glxext.h" #include "GL/glx_ansic.h" +static int __glXSwapGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc); +static int __glXSwapCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc); +static int __glXSwapCreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc); +static int __glXSwapMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc); + /************************************************************************/ /* @@ -67,7 +72,41 @@ int __glXSwapCreateContext(__GLXclientState *cl, GLbyte *pc) __GLX_SWAP_INT(&req->screen); __GLX_SWAP_INT(&req->shareList); - return __glXCreateContext(cl, pc); + return DoCreateContext( cl, req->context, req->shareList, req->visual, + req->screen, req->isDirect ); +} + +int __glXSwapCreateNewContext(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->context); + __GLX_SWAP_INT(&req->fbconfig); + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->renderType); + __GLX_SWAP_INT(&req->shareList); + + return DoCreateContext( cl, req->context, req->shareList, req->fbconfig, + req->screen, req->isDirect ); +} + +int __glXSwapCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateContextWithConfigSGIXReq *req = + (xGLXCreateContextWithConfigSGIXReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->context); + __GLX_SWAP_INT(&req->fbconfig); + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->renderType); + __GLX_SWAP_INT(&req->shareList); + + return DoCreateContext( cl, req->context, req->shareList, req->fbconfig, + req->screen, req->isDirect ); } int __glXSwapDestroyContext(__GLXclientState *cl, GLbyte *pc) @@ -91,7 +130,8 @@ int __glXSwapMakeCurrent(__GLXclientState *cl, GLbyte *pc) __GLX_SWAP_INT(&req->context); __GLX_SWAP_INT(&req->oldContextTag); - return __glXMakeCurrent(cl, pc); + return DoMakeCurrent( cl, req->drawable, req->drawable, + req->context, req->oldContextTag ); } int __glXSwapMakeContextCurrent(__GLXclientState *cl, GLbyte *pc) @@ -105,7 +145,8 @@ int __glXSwapMakeContextCurrent(__GLXclientState *cl, GLbyte *pc) __GLX_SWAP_INT(&req->context); __GLX_SWAP_INT(&req->oldContextTag); - return __glXMakeContextCurrent(cl, pc); + return DoMakeCurrent( cl, req->drawable, req->readdrawable, + req->context, req->oldContextTag ); } int __glXSwapMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc) @@ -119,7 +160,8 @@ int __glXSwapMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc) __GLX_SWAP_INT(&req->context); __GLX_SWAP_INT(&req->oldContextTag); - return __glXMakeCurrentReadSGI(cl, pc); + return DoMakeCurrent( cl, req->drawable, req->readable, + req->context, req->oldContextTag ); } int __glXSwapIsDirect(__GLXclientState *cl, GLbyte *pc) @@ -182,90 +224,29 @@ int __glXSwapCopyContext(__GLXclientState *cl, GLbyte *pc) int __glXSwapGetVisualConfigs(__GLXclientState *cl, GLbyte *pc) { - ClientPtr client = cl->client; xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc; - xGLXGetVisualConfigsReply reply; - __GLXscreenInfo *pGlxScreen; - __GLXvisualConfig *pGlxVisual; - CARD32 buf[__GLX_TOTAL_CONFIG]; - unsigned int screen; - int i, p; __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&req->screen); - screen = req->screen; - if (screen > screenInfo.numScreens) { - /* The client library must send a valid screen number. */ - client->errorValue = screen; - return BadValue; - } - pGlxScreen = &__glXActiveScreens[screen]; - - reply.numVisuals = pGlxScreen->numUsableVisuals; - reply.numProps = __GLX_TOTAL_CONFIG; - reply.length = (pGlxScreen->numUsableVisuals * __GLX_SIZE_CARD32 * - __GLX_TOTAL_CONFIG) >> 2; - reply.type = X_Reply; - reply.sequenceNumber = client->sequence; - - __GLX_SWAP_SHORT(&reply.sequenceNumber); - __GLX_SWAP_INT(&reply.length); - __GLX_SWAP_INT(&reply.numVisuals); - __GLX_SWAP_INT(&reply.numProps); - WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *)&reply); - - for (i=0; i < pGlxScreen->numVisuals; i++) { - pGlxVisual = &pGlxScreen->pGlxVisual[i]; - if (pGlxVisual->vid == 0) { - /* not a usable visual */ - continue; - } - p = 0; - buf[p++] = pGlxVisual->vid; - buf[p++] = pGlxVisual->class; - buf[p++] = pGlxVisual->rgba; - - buf[p++] = pGlxVisual->redSize; - buf[p++] = pGlxVisual->greenSize; - buf[p++] = pGlxVisual->blueSize; - buf[p++] = pGlxVisual->alphaSize; - buf[p++] = pGlxVisual->accumRedSize; - buf[p++] = pGlxVisual->accumGreenSize; - buf[p++] = pGlxVisual->accumBlueSize; - buf[p++] = pGlxVisual->accumAlphaSize; - - buf[p++] = pGlxVisual->doubleBuffer; - buf[p++] = pGlxVisual->stereo; - - buf[p++] = pGlxVisual->bufferSize; - buf[p++] = pGlxVisual->depthSize; - buf[p++] = pGlxVisual->stencilSize; - buf[p++] = pGlxVisual->auxBuffers; - buf[p++] = pGlxVisual->level; - /* - ** Add token/value pairs for extensions. - */ - buf[p++] = GLX_VISUAL_CAVEAT_EXT; - buf[p++] = pGlxVisual->visualRating; - buf[p++] = GLX_TRANSPARENT_TYPE_EXT; - buf[p++] = pGlxVisual->transparentPixel; - buf[p++] = GLX_TRANSPARENT_RED_VALUE_EXT; - buf[p++] = pGlxVisual->transparentRed; - buf[p++] = GLX_TRANSPARENT_GREEN_VALUE_EXT; - buf[p++] = pGlxVisual->transparentGreen; - buf[p++] = GLX_TRANSPARENT_BLUE_VALUE_EXT; - buf[p++] = pGlxVisual->transparentBlue; - buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE_EXT; - buf[p++] = pGlxVisual->transparentAlpha; - buf[p++] = GLX_TRANSPARENT_INDEX_VALUE_EXT; - buf[p++] = pGlxVisual->transparentIndex; - - __GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_CONFIG); - WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG, - (char *)buf); - } - return Success; + return DoGetVisualConfigs( cl, req->screen, GL_TRUE ); +} + +int __glXSwapGetFBConfigs(__GLXclientState *cl, GLbyte *pc) +{ + xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&req->screen); + return DoGetFBConfigs( cl, req->screen, GL_TRUE ); +} + +int __glXSwapGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc) +{ + xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&req->screen); + return DoGetFBConfigs( cl, req->screen, GL_TRUE ); } int __glXSwapCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) @@ -279,7 +260,39 @@ int __glXSwapCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) __GLX_SWAP_INT(&req->pixmap); __GLX_SWAP_INT(&req->glxpixmap); - return __glXCreateGLXPixmap(cl, pc); + return DoCreateGLXPixmap( cl, req->visual, req->screen, + req->pixmap, req->glxpixmap ); +} + +int __glXSwapCreatePixmap(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->fbconfig); + __GLX_SWAP_INT(&req->pixmap); + __GLX_SWAP_INT(&req->glxpixmap); + + return DoCreateGLXPixmap( cl, req->fbconfig, req->screen, + req->pixmap, req->glxpixmap ); +} + +int __glXSwapCreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateGLXPixmapWithConfigSGIXReq *req = + (xGLXCreateGLXPixmapWithConfigSGIXReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->fbconfig); + __GLX_SWAP_INT(&req->pixmap); + __GLX_SWAP_INT(&req->glxpixmap); + + return DoCreateGLXPixmap( cl, req->fbconfig, req->screen, + req->pixmap, req->glxpixmap ); } int __glXSwapDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc) @@ -357,7 +370,7 @@ int __glXSwapClientInfo(__GLXclientState *cl, GLbyte *pc) return __glXClientInfo(cl, pc); } -int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, char *pc) +int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc) { xGLXQueryContextInfoEXTReq *req = (xGLXQueryContextInfoEXTReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; @@ -791,6 +804,20 @@ int __glXSwapVendorPrivate(__GLXclientState *cl, GLbyte *pc) vendorcode = req->vendorCode; + switch( vendorcode ) { + case X_GLvop_SampleMaskSGIS: + __GLX_SWAP_FLOAT(pc + 4); + __GLX_SWAP_INT(pc + 8); + glSampleMaskSGIS(*(GLfloat *)(pc + 4), + *(GLboolean *)(pc + 8)); + return Success; + case X_GLvop_SamplePatternSGIS: + __GLX_SWAP_INT(pc + 4); + glSamplePatternSGIS( *(GLenum *)(pc + 4)); + return Success; + } + + if ((vendorcode >= __GLX_MIN_VENDPRIV_OPCODE_EXT) && (vendorcode <= __GLX_MAX_VENDPRIV_OPCODE_EXT)) { (*__glXSwapVendorPrivTable_EXT[vendorcode-__GLX_MIN_VENDPRIV_OPCODE_EXT])(cl, (GLbyte*)req); @@ -818,6 +845,12 @@ int __glXSwapVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc) return __glXSwapQueryContextInfoEXT(cl, pc); case X_GLXvop_MakeCurrentReadSGI: return __glXSwapMakeCurrentReadSGI(cl, pc); + case X_GLXvop_GetFBConfigsSGIX: + return __glXSwapGetFBConfigsSGIX(cl, pc); + case X_GLXvop_CreateContextWithConfigSGIX: + return __glXSwapCreateContextWithConfigSGIX(cl, pc); + case X_GLXvop_CreateGLXPixmapWithConfigSGIX: + return __glXSwapCreateGLXPixmapWithConfigSGIX(cl, pc); default: break; } diff --git a/GL/glx/glxcontext.h b/GL/glx/glxcontext.h index 5eb72177e..9a16851f0 100644 --- a/GL/glx/glxcontext.h +++ b/GL/glx/glxcontext.h @@ -80,7 +80,6 @@ struct __GLXcontextRec { ** This context is created with respect to this visual. */ VisualRec *pVisual; - __GLXvisualConfig *pGlxVisual; /* ** The XID of this context. diff --git a/GL/glx/glxdrawable.h b/GL/glx/glxdrawable.h index 972a6045f..1d7f44352 100644 --- a/GL/glx/glxdrawable.h +++ b/GL/glx/glxdrawable.h @@ -40,7 +40,7 @@ typedef struct { DrawablePtr pDraw; - __GLXvisualConfig *pGlxVisual; + __GLcontextModes *modes; __GLXscreenInfo *pGlxScreen; ScreenPtr pScreen; Bool idExists; @@ -69,11 +69,12 @@ struct __GLXdrawablePrivateRec { /* ** Configuration of the visual to which this drawable was created. */ - __GLXvisualConfig *pGlxVisual; + __GLcontextModes *modes; /* ** cached drawable size and origin */ + GLint xorigin, yorigin; GLint width, height; diff --git a/GL/glx/glxext.c b/GL/glx/glxext.c index 4515c702c..5e6801744 100644 --- a/GL/glx/glxext.c +++ b/GL/glx/glxext.c @@ -31,6 +31,9 @@ extern __GLXextensionInfo __glDDXExtensionInfo; +void GlxWrapInitVisuals(miInitVisualsProcPtr *); +void GlxSetVisualConfigs(int nconfigs, + __GLXvisualConfig *configs, void **privates); __GLXextensionInfo *__glXExt = &__glDDXExtensionInfo; diff --git a/GL/glx/glxext.h b/GL/glx/glxext.h index 7d0383d8d..a5bf34d7f 100644 --- a/GL/glx/glxext.h +++ b/GL/glx/glxext.h @@ -71,15 +71,26 @@ extern GLboolean __glXErrorOccured(void); extern void __glXResetLargeCommandStatus(__GLXclientState*); extern int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc); -extern int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, char *pc); +extern int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc); -extern int __glXMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc); -extern int __glXSwapMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc); +extern int DoMakeCurrent( __GLXclientState *cl, GLXDrawable drawId, + GLXDrawable readId, GLXContextID contextId, GLXContextTag tag ); +extern int DoGetVisualConfigs(__GLXclientState *cl, unsigned screen, + GLboolean do_swap); +extern int DoGetFBConfigs(__GLXclientState *cl, unsigned screen, + GLboolean do_swap); +extern int DoCreateContext(__GLXclientState *cl, GLXContextID gcId, + GLXContextID shareList, VisualID visual, GLuint screen, GLboolean isDirect); +extern int DoCreateGLXPixmap(__GLXclientState *cl, VisualID visual, + GLuint screenNum, XID pixmapId, XID glxpixmapId); extern void GlxExtensionInit(void); extern Bool __glXCoreType(void); +extern const char GLServerVersion[]; +extern int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap); + extern int GlxInitVisuals( #if NeedFunctionPrototypes VisualPtr * visualp, diff --git a/GL/glx/glxscreens.c b/GL/glx/glxscreens.c index aea774105..04882098a 100644 --- a/GL/glx/glxscreens.c +++ b/GL/glx/glxscreens.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxscreens.c,v 1.10 2002/04/04 14:05:36 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/glxscreens.c,v 1.11 2003/06/23 17:35:44 eich Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -46,11 +46,13 @@ #include "glxserver.h" #include "glxutil.h" +const char GLServerVersion[] = "1.2"; static const char GLServerExtensions[] = "GL_ARB_depth_texture " "GL_ARB_imaging " "GL_ARB_multitexture " "GL_ARB_point_parameters " + "GL_ARB_point_sprite " "GL_ARB_shadow " "GL_ARB_shadow_ambient " "GL_ARB_texture_border_clamp " @@ -108,6 +110,7 @@ static const char GLServerExtensions[] = "GL_MESA_pack_invert " "GL_MESA_ycbcr_texture " "GL_NV_blend_square " + "GL_NV_point_sprite " "GL_NV_texgen_reflection " "GL_NV_texture_rectangle " "GL_SGIS_generate_mipmap " @@ -125,11 +128,15 @@ static const char GLServerExtensions[] = */ static char GLXServerVendorName[] = "SGI"; static char GLXServerVersion[] = "1.2"; -static char GLXServerExtensions[] = +static char GLXServerExtensions[] = + "GLX_ARB_multisample " "GLX_EXT_visual_info " "GLX_EXT_visual_rating " "GLX_EXT_import_context " + "GLX_OML_swap_method " "GLX_SGI_make_current_read " + "GLX_SGIS_multisample " + "GLX_SGIX_fbconfig " ; /* @@ -149,81 +156,6 @@ GLint __glXNumActiveScreens; RESTYPE __glXDrawableRes; -#if 0 -static int -CountBits(unsigned long mask) -{ - int count = 0; - - while(mask) { - count += (mask&1); - mask >>= 1; - } - - return count; -} -#endif - -#if 0 -/* -** A typical implementation would not probably not run through the screen's -** visuals to find ones that match the visual configs supplied by the DDX -** Sample OpenGL as we do here; we have done this to make this code easy to -** drop into an existing X server. -*/ -static int matchVisuals(__GLXvisualConfig *pGlxVisual, int numVisuals, - int screen) -{ - int i, j; - __GLXvisualConfig *pvis = pGlxVisual; - ScreenPtr pScreen = screenInfo.screens[screen]; - VisualPtr pVisual; - int numMatchingVisuals = 0; - int *used; - - used = (int *)__glXMalloc(pScreen->numVisuals*sizeof(int)); - __glXMemset(used, 0, pScreen->numVisuals*sizeof(int)); - - for (i=0; i < numVisuals; i++, pvis++) { - /* - ** Look through all the server's visuals to see which match. - */ - pvis->vid = 0; - pVisual = pScreen->visuals; - for (j=0; j < pScreen->numVisuals; j++, pVisual++) { - if (pvis->class == pVisual->class && - pvis->bufferSize == pVisual->nplanes && - !used[j]) { - int rBits, gBits, bBits, aBits; - - /* count bits per rgb */ - rBits = CountBits(pVisual->redMask); - gBits = CountBits(pVisual->greenMask); - bBits = CountBits(pVisual->blueMask); - aBits = 0; - if ((pvis->redSize == rBits) && - (pvis->greenSize == gBits) && - (pvis->blueSize == bBits) && - (pvis->alphaSize == aBits)) { - /* - ** We'll consider this a match. - */ - pvis->vid = pVisual->vid; - pvis->redMask = pVisual->redMask; - pvis->greenMask = pVisual->greenMask; - pvis->blueMask = pVisual->blueMask; - pvis->alphaMask = 0; - numMatchingVisuals++; - used[j] = 1; - break; - } - } - } - } - __glXFree(used); - return numMatchingVisuals; -} -#endif /* ** Destroy routine that gets called when a drawable is freed. A drawable @@ -353,14 +285,7 @@ void __glXScreenInit(GLint numscreens) if ((*__glXScreens[j]->screenProbe)(i)) { __glXActiveScreens[i] = *__glXScreens[j]; -#if 0 - /* we don't use this since matchVisuals doesn't allow alpha */ - __glXActiveScreens[i].numUsableVisuals = - matchVisuals(__glXActiveScreens[i].pGlxVisual, - __glXActiveScreens[i].numVisuals, i); -#else __glXActiveScreens[i].numUsableVisuals = __glXActiveScreens[i].numVisuals; -#endif __glXActiveScreens[i].GLextensions = __glXStrdup(GLServerExtensions); __glXActiveScreens[i].GLXvendor = __glXStrdup(GLXServerVendorName); __glXActiveScreens[i].GLXversion = __glXStrdup(GLXServerVersion); diff --git a/GL/glx/glxscreens.h b/GL/glx/glxscreens.h index 99f76dc38..9ca166b74 100644 --- a/GL/glx/glxscreens.h +++ b/GL/glx/glxscreens.h @@ -70,7 +70,11 @@ typedef struct { */ void (*createBuffer)(__GLXdrawablePrivate *glxPriv); - __GLXvisualConfig *pGlxVisual; + /** + * Linked list of valid context modes for this screen. + */ + __GLcontextModes *modes; + void **pVisualPriv; GLint numVisuals; GLint numUsableVisuals; diff --git a/GL/glx/glxserver.h b/GL/glx/glxserver.h index cfefd4096..67f5e961f 100644 --- a/GL/glx/glxserver.h +++ b/GL/glx/glxserver.h @@ -280,5 +280,6 @@ extern int __glXColorTableParameterfvSize(GLenum pname); extern int __glXColorTableParameterivSize(GLenum pname); extern int __glXPointParameterfvARBReqSize(GLbyte *pc, Bool swap); +extern int __glXPointParameterivReqSize(GLbyte *pc, Bool swap); #endif /* !__GLX_server_h__ */ diff --git a/GL/glx/glxutil.c b/GL/glx/glxutil.c index 7aafd0065..4512aa5e9 100644 --- a/GL/glx/glxutil.c +++ b/GL/glx/glxutil.c @@ -44,6 +44,9 @@ #include "glxutil.h" #include "glxbuf.h" #include "GL/glx_ansic.h" +#include "GL/internal/glcore.h" +#include "GL/glxint.h" +#include "glcontextmodes.h" /************************************************************************/ @@ -214,53 +217,6 @@ __glXResizeDrawable(__GLdrawablePrivate *glPriv) } -/************************************************************************/ - -void -__glXFormatGLModes(__GLcontextModes *modes, __GLXvisualConfig *config) -{ - __glXMemset(modes, 0, sizeof(__GLcontextModes)); - - modes->rgbMode = (config->rgba != 0); - modes->colorIndexMode = !(modes->rgbMode); - modes->doubleBufferMode = (config->doubleBuffer != 0); - modes->stereoMode = (config->stereo != 0); - - modes->haveAccumBuffer = ((config->accumRedSize + - config->accumGreenSize + - config->accumBlueSize + - config->accumAlphaSize) > 0); - modes->haveDepthBuffer = (config->depthSize > 0); - modes->haveStencilBuffer = (config->stencilSize > 0); - - modes->redBits = config->redSize; - modes->greenBits = config->greenSize; - modes->blueBits = config->blueSize; - modes->alphaBits = config->alphaSize; - modes->redMask = config->redMask; - modes->greenMask = config->greenMask; - modes->blueMask = config->blueMask; - modes->alphaMask = config->alphaMask; -#if 0 - modes->rgbBits = modes->redBits + modes->greenBits + - modes->blueBits + modes->alphaBits; -#endif - assert( !modes->rgbMode || ((config->bufferSize & 0x7) == 0) ); - modes->rgbBits = config->bufferSize; - modes->indexBits = config->bufferSize; - - modes->accumRedBits = config->accumRedSize; - modes->accumGreenBits = config->accumGreenSize; - modes->accumBlueBits = config->accumBlueSize; - modes->accumAlphaBits = config->accumAlphaSize; - modes->depthBits = config->depthSize; - modes->stencilBits = config->stencilSize; - - modes->numAuxBuffers = 0; /* XXX: should be picked up from the visual */ - - modes->level = config->level; -} - /*****************************************************************************/ /* accessing the drawable private */ @@ -382,21 +338,13 @@ __glXCreateDrawablePrivate(DrawablePtr pDraw, XID drawId, pGlxScreen = &__glXActiveScreens[pDraw->pScreen->myNum]; - /* allocate the buffers */ if (glxPriv->type == DRAWABLE_WINDOW) { - int i; VisualID vid = wVisual((WindowPtr)pDraw); - __GLXvisualConfig *pGlxVisual = pGlxScreen->pGlxVisual; - for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) { - if (pGlxVisual->vid == vid) { - glxPriv->pGlxVisual = pGlxVisual; - break; - } - } + glxPriv->modes = _gl_context_modes_find_visual( pGlxScreen->modes, vid ); __glXFBInitDrawable(glxPriv, modes); } else { - glxPriv->pGlxVisual = glxPriv->pGlxPixmap->pGlxVisual; + glxPriv->modes = glxPriv->pGlxPixmap->modes; __glXPixInitDrawable(glxPriv, modes); } diff --git a/GL/glx/glxutil.h b/GL/glx/glxutil.h index 67bfb06f9..970683cb1 100644 --- a/GL/glx/glxutil.h +++ b/GL/glx/glxutil.h @@ -55,7 +55,6 @@ extern void __glXGetDrawableSize(__GLdrawablePrivate *glPriv, GLuint *width, GLuint *height); extern GLboolean __glXResizeDrawable(__GLdrawablePrivate *glPriv); extern GLboolean __glXResizeDrawableBuffers(__GLXdrawablePrivate *glxPriv); -extern void __glXFormatGLModes(__GLcontextModes *modes, __GLXvisualConfig *config); /* drawable management */ extern void __glXRefDrawablePrivate(__GLXdrawablePrivate *glxPriv); diff --git a/GL/glx/impsize.h b/GL/glx/impsize.h index 63fdcef20..8932fb33f 100644 --- a/GL/glx/impsize.h +++ b/GL/glx/impsize.h @@ -67,6 +67,7 @@ extern int __glTexParameterfv_size(GLenum e); extern int __glTexParameteriv_size(GLenum e); extern int __glEvalComputeK(GLenum target); -extern int __glPointParameterfvARB_size(GLenum pname); +extern int __glPointParameterfvARB_size(GLenum e); +extern int __glPointParameteriv_size(GLenum e); #endif /* _impsize_h_ */ diff --git a/GL/glx/render2.c b/GL/glx/render2.c index 04bef0e8c..8ef67e2a2 100644 --- a/GL/glx/render2.c +++ b/GL/glx/render2.c @@ -220,6 +220,14 @@ void __glXDisp_DrawArrays(GLbyte *pc) glEnableClientState(GL_EDGE_FLAG_ARRAY); glEdgeFlagPointer(stride, (const GLboolean *)pc); break; + case GL_SECONDARY_COLOR_ARRAY: + glEnableClientState(GL_SECONDARY_COLOR_ARRAY); + glSecondaryColorPointer(numVals, datatype, stride, pc); + break; + case GL_FOG_COORD_ARRAY: + glEnableClientState(GL_FOG_COORD_ARRAY); + glFogCoordPointer(datatype, stride, pc); + break; default: break; } @@ -236,10 +244,11 @@ void __glXDisp_DrawArrays(GLbyte *pc) glDisableClientState(GL_INDEX_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_EDGE_FLAG_ARRAY); + glDisableClientState(GL_SECONDARY_COLOR_ARRAY); + glDisableClientState(GL_FOG_COORD_ARRAY); } void __glXDisp_DrawArraysEXT(GLbyte *pc) { -#ifdef XXX_STUB -#endif /*XXX_STUB*/ + __glXDisp_DrawArrays(pc); } diff --git a/GL/glx/render2swap.c b/GL/glx/render2swap.c index e873d88aa..7c94b5268 100644 --- a/GL/glx/render2swap.c +++ b/GL/glx/render2swap.c @@ -386,6 +386,5 @@ void __glXDispSwap_DrawArrays(GLbyte *pc) void __glXDispSwap_DrawArraysEXT(GLbyte *pc) { -#ifdef XXX_STUB -#endif /*XXX_STUB*/ + __glXDispSwap_DrawArrays(pc); } diff --git a/GL/glx/rensize.c b/GL/glx/rensize.c index 95a10e2e2..519c6a90e 100644 --- a/GL/glx/rensize.c +++ b/GL/glx/rensize.c @@ -551,12 +551,14 @@ int __glXDrawArraysSize( GLbyte *pc, Bool swap ) case GL_COLOR_ARRAY: case GL_TEXTURE_COORD_ARRAY: break; + case GL_SECONDARY_COLOR_ARRAY: case GL_NORMAL_ARRAY: if (numVals != 3) { /* bad size */ return -1; } break; + case GL_FOG_COORD_ARRAY: case GL_INDEX_ARRAY: if (numVals != 1) { /* bad size */ @@ -918,3 +920,9 @@ int __glXPointParameterfvARBReqSize(GLbyte *pc, Bool swap ) } return 4 * __glPointParameterfvARB_size( pname ); } + +int __glXPointParameterivReqSize(GLbyte *pc, Bool swap ) +{ + /* no difference between fv and iv versions */ + return __glXPointParameterfvARBReqSize(pc, swap); +} diff --git a/GL/glx/rensizetab.c b/GL/glx/rensizetab.c index feaac9869..95ba462b2 100644 --- a/GL/glx/rensizetab.c +++ b/GL/glx/rensizetab.c @@ -231,9 +231,9 @@ __GLXrenderSizeData __glXRenderSizeTable[__GLX_MAX_RENDER_OPCODE_EXT - __GLX_MIN /* Translatef */ { 16, 0 }, /* Viewport */ { 20, 0 }, /* PolygonOffset */ { 12, 0 }, - /* no such opcode */ { 0, 0 }, + /* DrawArrays */ { 16, __glXDrawArraysSize }, /* Indexubv */ { 8, 0 }, - /* ColorSubTable */ { 44, __glXColorSubTableReqSize }, + /* ColorSubTable */ { 44, __glXColorSubTableReqSize }, /* CopyColorSubTable */ { 24, 0 }, /* ActiveTextureARB */ { 8, 0 }, /* MultiTexCoord1dvARB */ { 16, 0 }, @@ -2342,17 +2342,17 @@ __GLXrenderSizeData __glXRenderSizeTable_EXT[__GLX_MAX_RENDER_OPCODE_EXT - __GLX /* CopyTexSubImage1D */ { 28, 0 }, /* CopyTexSubImage2D */ { 36, 0 }, /* CopyTexSubImage3D 4123 */ { 40, 0 }, - /* no such opcode */ { 0, 0 }, - /* no such opcode */ { 0, 0 }, - /* no such opcode */ { 0, 0 }, - /* no such opcode */ { 0, 0 }, - /* no such opcode */ { 0, 0 }, - /* no such opcode */ { 0, 0 }, - /* no such opcode */ { 0, 0 }, - /* no such opcode */ { 0, 0 }, - /* no such opcode */ { 0, 0 }, - /* no such opcode */ { 0, 0 }, - /* no such opcode */ { 0, 0 }, + /* FogCoordfv 4124 */ { 8, 0 }, + /* FogCoorddv 4125 */ { 12, 0 }, + /* SecondaryColor3bv 4126 */ { 8, 0 }, + /* SecondaryColor3sv 4127 */ { 12, 0 }, + /* SecondaryColor3iv 4128 */ { 16, 0 }, + /* SecondaryColor3fv 4129 */ { 16, 0 }, + /* SecondaryColor3dv 4130 */ { 28, 0 }, + /* SecondaryColor3ubv 4131 */ { 8, 0 }, + /* SecondaryColor3usv 4132 */ { 12, 0 }, + /* SecondaryColor3uiv 4133 */ { 16, 0 }, + /* BlendFuncSeparate 4134 */ { 20, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, @@ -2439,4 +2439,6 @@ __GLXrenderSizeData __glXRenderSizeTable_EXT[__GLX_MAX_RENDER_OPCODE_EXT - __GLX /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* ActiveStencilFaceEXT 4220 */ { 8, 0 }, + /* PointParameteri 4221 */ { 12, 0 }, + /* PointParameteriv 4222 */ { 8, __glXPointParameterivReqSize }, }; diff --git a/GL/glx/single2.c b/GL/glx/single2.c index 286f63d70..c542d60f4 100644 --- a/GL/glx/single2.c +++ b/GL/glx/single2.c @@ -296,16 +296,25 @@ char *__glXcombine_strings(const char *cext_string, const char *sext_string) return combo_string; } -int __glXDisp_GetString(__GLXclientState *cl, GLbyte *pc) +int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap) { ClientPtr client; __GLXcontext *cx; GLenum name; const char *string; + __GLX_DECLARE_SWAP_VARIABLES; int error; char *buf = NULL, *buf1 = NULL; GLint length = 0; + /* If the client has the opposite byte order, swap the contextTag and + * the name. + */ + if ( need_swap ) { + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + __GLX_SINGLE_HDR_SIZE); + } + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -331,12 +340,32 @@ int __glXDisp_GetString(__GLXclientState *cl, GLbyte *pc) } string = buf; } + else if ( name == GL_VERSION ) { + if ( xf86atof( string ) > xf86atof( GLServerVersion ) ) { + buf = __glXMalloc( __glXStrlen( string ) + + __glXStrlen( GLServerVersion ) + + 4 ); + if ( buf == NULL ) { + string = GLServerVersion; + } + else { + __glXSprintf( buf, "%s (%s)", GLServerVersion, string ); + string = buf; + } + } + } if (string) { length = __glXStrlen((const char *) string) + 1; } __GLX_BEGIN_REPLY(length); __GLX_PUT_SIZE(length); + + if ( need_swap ) { + __GLX_SWAP_REPLY_SIZE(); + __GLX_SWAP_REPLY_HEADER(); + } + __GLX_SEND_HEADER(); WriteToClient(client, length, (char *) string); if (buf != NULL) { @@ -345,6 +374,11 @@ int __glXDisp_GetString(__GLXclientState *cl, GLbyte *pc) return Success; } +int __glXDisp_GetString(__GLXclientState *cl, GLbyte *pc) +{ + return DoGetString(cl, pc, GL_FALSE); +} + int __glXDisp_GetClipPlane(__GLXclientState *cl, GLbyte *pc) { __GLXcontext *cx; diff --git a/GL/glx/single2swap.c b/GL/glx/single2swap.c index 96db415f9..c8c496871 100644 --- a/GL/glx/single2swap.c +++ b/GL/glx/single2swap.c @@ -262,58 +262,7 @@ int __glXDispSwap_Finish(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_GetString(__GLXclientState *cl, GLbyte *pc) { - ClientPtr client; - __GLXcontext *cx; - GLenum name; - const char *string; - __GLX_DECLARE_SWAP_VARIABLES; - int error; - char *buf = NULL, *buf1 = NULL; - GLint length = 0; - - __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); - cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); - if (!cx) { - return error; - } - - pc += __GLX_SINGLE_HDR_SIZE; - __GLX_SWAP_INT(pc + 0); - name = *(GLenum *)(pc + 0); - string = (const char *)glGetString(name); - client = cl->client; - - /* - ** Restrict extensions to those that are supported by both the - ** implementation and the connection. That is, return the - ** intersection of client, server, and core extension strings. - */ - if (name == GL_EXTENSIONS) { - buf1 = __glXcombine_strings(string, - cl->GLClientextensions); - buf = __glXcombine_strings(buf1, - cx->pGlxScreen->GLextensions); - if (buf1 != NULL) { - __glXFree(buf1); - } - string = buf; - } - if (string) { - length = __glXStrlen((const char *) string) + 1; - } - - __GLX_BEGIN_REPLY(length); - __GLX_PUT_SIZE(length); - - __GLX_SWAP_REPLY_SIZE(); - __GLX_SWAP_REPLY_HEADER(); - __GLX_SEND_HEADER(); - WriteToClient(client, length, (char *) string); - if (buf != NULL) { - __glXFree(buf); - } - - return Success; + return DoGetString(cl, pc, GL_TRUE); } int __glXDispSwap_GetClipPlane(__GLXclientState *cl, GLbyte *pc) diff --git a/GL/glx/singlesize.c b/GL/glx/singlesize.c index 7f59816e9..836ace25d 100644 --- a/GL/glx/singlesize.c +++ b/GL/glx/singlesize.c @@ -49,32 +49,48 @@ GLint __glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h) return __glXImage3DSize( format, type, w, h, 1, 0, 0, 0, 0, 4 ); } +/** + * Determine the number of data elements that go with the specified \c pname + * to a \c glGetTexEnvfv or \c glGetTexEnviv call. + * + * \todo + * Replace this function with a call to \c __glTexEnvfv_size. Make that there + * aren't any values of \c pname that are valid for one but not the other. + */ GLint __glGetTexEnvfv_size(GLenum pname) { switch (pname) { case GL_TEXTURE_ENV_MODE: + case GL_TEXTURE_LOD_BIAS: + case GL_COMBINE_RGB: + case GL_COMBINE_ALPHA: + case GL_SOURCE0_RGB: + case GL_SOURCE1_RGB: + case GL_SOURCE2_RGB: + case GL_SOURCE0_ALPHA: + case GL_SOURCE1_ALPHA: + case GL_SOURCE2_ALPHA: + case GL_OPERAND0_RGB: + case GL_OPERAND1_RGB: + case GL_OPERAND2_RGB: + case GL_OPERAND0_ALPHA: + case GL_OPERAND1_ALPHA: + case GL_OPERAND2_ALPHA: + case GL_RGB_SCALE: + case GL_ALPHA_SCALE: + + /* GL_ARB_point_sprite / GL_NV_point_sprite */ + case GL_COORD_REPLACE_ARB: + + /* GL_NV_texture_env_combine4 */ + case GL_SOURCE3_RGB_NV: + case GL_SOURCE3_ALPHA_NV: + case GL_OPERAND3_RGB_NV: + case GL_OPERAND3_ALPHA_NV: return 1; + case GL_TEXTURE_ENV_COLOR: return 4; - case GL_TEXTURE_LOD_BIAS_EXT: - return 1; - case GL_COMBINE_RGB_ARB: - case GL_COMBINE_ALPHA_ARB: - case GL_SOURCE0_RGB_ARB: - case GL_SOURCE1_RGB_ARB: - case GL_SOURCE2_RGB_ARB: - case GL_SOURCE0_ALPHA_ARB: - case GL_SOURCE1_ALPHA_ARB: - case GL_SOURCE2_ALPHA_ARB: - case GL_OPERAND0_RGB_ARB: - case GL_OPERAND1_RGB_ARB: - case GL_OPERAND2_RGB_ARB: - case GL_OPERAND0_ALPHA_ARB: - case GL_OPERAND1_ALPHA_ARB: - case GL_OPERAND2_ALPHA_ARB: - case GL_RGB_SCALE_ARB: - case GL_ALPHA_SCALE: - return 1; default: return -1; } @@ -139,6 +155,15 @@ GLint __glGetTexParameterfv_size(GLenum pname) case GL_TEXTURE_COMPARE_MODE: case GL_TEXTURE_COMPARE_FUNC: + /* GL_SGIS_generate_mipmap / GL 1.4 */ + case GL_GENERATE_MIPMAP: + + /* GL_ARB_depth_texture / GL 1.4 */ + case GL_DEPTH_TEXTURE_MODE: + + /* GL_EXT_texture_lod_bias / GL 1.4 */ + case GL_TEXTURE_LOD_BIAS: + /* GL_SGIX_shadow_ambient / GL_ARB_shadow_ambient */ case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: @@ -150,6 +175,12 @@ GLint __glGetTexParameterfv_size(GLenum pname) case GL_TEXTURE_MAX_CLAMP_S_SGIX: case GL_TEXTURE_MAX_CLAMP_T_SGIX: case GL_TEXTURE_MAX_CLAMP_R_SGIX: + + /* GL_EXT_texture_filter_anisotropic */ + case GL_TEXTURE_MAX_ANISOTROPY_EXT: + + /* GL_NV_texture_expand_normal */ + case GL_TEXTURE_UNSIGNED_REMAP_MODE_NV: return 1; default: @@ -833,10 +864,6 @@ GLint __glGet_size(GLenum sq) case GL_MAX_CONVOLUTION_WIDTH: case GL_MAX_CONVOLUTION_HEIGHT: return 1; - case GL_TEXTURE_CUBE_MAP_ARB: - case GL_TEXTURE_BINDING_CUBE_MAP_ARB: - case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: - return 1; case GL_OCCLUSION_TEST_RESULT_HP: case GL_OCCLUSION_TEST_HP: return 1; @@ -846,6 +873,223 @@ GLint __glGet_size(GLenum sq) return 1; case GL_RASTER_POSITION_UNCLIPPED_IBM: return 1; + + /* GL_ARB_texture_cube_map / GL 1.3 */ + case GL_TEXTURE_CUBE_MAP: + case GL_TEXTURE_BINDING_CUBE_MAP: + case GL_MAX_CUBE_MAP_TEXTURE_SIZE: + + /* GL_ARB_multisample / GL 1.3 */ + case GL_MULTISAMPLE: + case GL_SAMPLE_ALPHA_TO_COVERAGE: + case GL_SAMPLE_ALPHA_TO_ONE: + case GL_SAMPLE_COVERAGE: + case GL_SAMPLE_BUFFERS: + case GL_SAMPLES: + case GL_SAMPLE_COVERAGE_VALUE: + case GL_SAMPLE_COVERAGE_INVERT: + + /* GL_ARB_texture_comrpession / GL 1.3 */ + case GL_TEXTURE_COMPRESSION_HINT: + case GL_NUM_COMPRESSED_TEXTURE_FORMATS: + + /* GL_EXT_blend_func_separate / GL 1.4 */ + case GL_BLEND_DST_RGB: + case GL_BLEND_SRC_RGB: + case GL_BLEND_DST_ALPHA: + case GL_BLEND_SRC_ALPHA: + + /* GL_EXT_fog_coord / GL 1.4 */ + case GL_CURRENT_FOG_COORD: + case GL_FOG_COORD_ARRAY_TYPE: + case GL_FOG_COORD_ARRAY_STRIDE: + case GL_FOG_COORD_ARRAY: + case GL_FOG_COORD_SOURCE: + + /* GL_EXT_secondary_color / GL 1.4 */ + case GL_COLOR_SUM: + case GL_SECONDARY_COLOR_ARRAY_SIZE: + case GL_SECONDARY_COLOR_ARRAY_TYPE: + case GL_SECONDARY_COLOR_ARRAY_STRIDE: + case GL_SECONDARY_COLOR_ARRAY: + + /* GL_EXT_texture_lod_bias / GL 1.4 */ + case GL_MAX_TEXTURE_LOD_BIAS: + + /* GL_ARB_point_sprite */ + case GL_POINT_SPRITE_ARB: + + /* GL_ARB_vertex_blend */ + case GL_MAX_VERTEX_UNITS_ARB: + case GL_ACTIVE_VERTEX_UNITS_ARB: + case GL_WEIGHT_SUM_UNITY_ARB: + case GL_VERTEX_BLEND_ARB: + case GL_CURRENT_WEIGHT_ARB: + case GL_WEIGHT_ARRAY_ARB: + case GL_WEIGHT_ARRAY_TYPE_ARB: + case GL_WEIGHT_ARRAY_STRIDE_ARB: + case GL_WEIGHT_ARRAY_SIZE_ARB: + + /* GL_ARB_matrix_palette */ + case GL_MATRIX_PALETTE_ARB: + case GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB: + case GL_MAX_PALETTE_MATRICES_ARB: + case GL_CURRENT_PALETTE_MATRIX_ARB: + case GL_CURRENT_MATRIX_INDEX_ARB: + case GL_MATRIX_INDEX_ARRAY_ARB: + case GL_MATRIX_INDEX_ARRAY_SIZE_ARB: + case GL_MATRIX_INDEX_ARRAY_TYPE_ARB: + case GL_MATRIX_INDEX_ARRAY_STRIDE_ARB: + + /* GL_EXT_clip_volume_hint */ + case GL_CLIP_VOLUME_CLIPPING_HINT_EXT: + + /* GL_EXT_depth_bounds_test */ + case GL_DEPTH_BOUNDS_TEST_EXT: + + /* GL_EXT_stencil_two_size */ + case GL_STENCIL_TEST_TWO_SIDE_EXT: + case GL_ACTIVE_STENCIL_FACE_EXT: + + /* GL_EXT_vertex_weighting */ + case GL_VERTEX_WEIGHTING_EXT: + case GL_MODELVIEW0_EXT: + case GL_MODELVIEW1_EXT: + case GL_CURRENT_VERTEX_WEIGHT_EXT: + case GL_VERTEX_WEIGHT_ARRAY_EXT: + case GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT: + case GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT: + case GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT: + /* case GL_MODELVIEW0_STACK_DEPTH_EXT: */ /* alias */ + case GL_MODELVIEW1_STACK_DEPTH_EXT: + + /* GL_EXT_blend_equation_separate */ + /* case GL_BLEND_EQUATION_RGB_EXT: */ /* alias */ + case GL_BLEND_EQUATION_ALPHA_EXT: + + /* GL_ATI_vertex_streams */ + case GL_MAX_VERTEX_STREAMS_ATI: + + /* GL_ATI_draw_buffers */ + case GL_MAX_DRAW_BUFFERS_ATI: + case GL_DRAW_BUFFER0_ATI: + case GL_DRAW_BUFFER1_ATI: + case GL_DRAW_BUFFER2_ATI: + case GL_DRAW_BUFFER3_ATI: + case GL_DRAW_BUFFER4_ATI: + case GL_DRAW_BUFFER5_ATI: + case GL_DRAW_BUFFER6_ATI: + case GL_DRAW_BUFFER7_ATI: + case GL_DRAW_BUFFER8_ATI: + case GL_DRAW_BUFFER9_ATI: + case GL_DRAW_BUFFER10_ATI: + case GL_DRAW_BUFFER11_ATI: + case GL_DRAW_BUFFER12_ATI: + case GL_DRAW_BUFFER13_ATI: + case GL_DRAW_BUFFER14_ATI: + case GL_DRAW_BUFFER15_ATI: + + /* GL_ATI_separate_stencil */ + case GL_STENCIL_BACK_FUNC_ATI: + case GL_STENCIL_BACK_FAIL_ATI: + case GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI: + case GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI: + + /* GL_NV_depth_clamp */ + case GL_DEPTH_CLAMP_NV: + + /* GL_NV_fog_distance */ + case GL_FOG_DISTANCE_MODE_NV: + + /* GL_NV_light_max_exponent */ + case GL_MAX_SHININESS_NV: + case GL_MAX_SPOT_EXPONENT_NV: + + /* GL_NV_multisample_filter_hint */ + case GL_MULTISAMPLE_FILTER_HINT_NV: + + /* GL_NV_point_sprite */ + /* case GL_POINT_SPRITE_NV: */ /* alias */ + case GL_POINT_SPRITE_R_MODE_NV: + + /* GL_NV_primitive_restart */ + case GL_PRIMITIVE_RESTART_NV: + case GL_PRIMITIVE_RESTART_INDEX_NV: + + /* GL_NV_register_combiners */ + case GL_REGISTER_COMBINERS_NV: + case GL_NUM_GENERAL_COMBINERS_NV: + case GL_COLOR_SUM_CLAMP_NV: + case GL_MAX_GENERAL_COMBINERS_NV: + + /* GL_NV_register_combiners2 */ + case GL_PER_STAGE_CONSTANTS_NV: + + /* GL_NV_texture_rectangle */ + case GL_TEXTURE_RECTANGLE_NV: + case GL_TEXTURE_BINDING_RECTANGLE_NV: + case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV: + return 1; + + /* GL_EXT_depth_bounds_test */ + case GL_DEPTH_BOUNDS_EXT: + return 2; + + /* GL_EXT_secondary_color / GL 1.4 */ + case GL_CURRENT_SECONDARY_COLOR: + + /* GL_NV_register_combiners */ + case GL_CONSTANT_COLOR0_NV: + case GL_CONSTANT_COLOR1_NV: + return 4; + + /* GL_ARB_vertex_blend */ + /* case GL_MODELVIEW0_ARB: */ /* alias */ + /* case GL_MODELVIEW1_ARB: */ /* alias */ + case GL_MODELVIEW2_ARB: + case GL_MODELVIEW3_ARB: + case GL_MODELVIEW4_ARB: + case GL_MODELVIEW5_ARB: + case GL_MODELVIEW6_ARB: + case GL_MODELVIEW7_ARB: + case GL_MODELVIEW8_ARB: + case GL_MODELVIEW9_ARB: + case GL_MODELVIEW10_ARB: + case GL_MODELVIEW11_ARB: + case GL_MODELVIEW12_ARB: + case GL_MODELVIEW13_ARB: + case GL_MODELVIEW14_ARB: + case GL_MODELVIEW15_ARB: + case GL_MODELVIEW16_ARB: + case GL_MODELVIEW17_ARB: + case GL_MODELVIEW18_ARB: + case GL_MODELVIEW19_ARB: + case GL_MODELVIEW20_ARB: + case GL_MODELVIEW21_ARB: + case GL_MODELVIEW22_ARB: + case GL_MODELVIEW23_ARB: + case GL_MODELVIEW24_ARB: + case GL_MODELVIEW25_ARB: + case GL_MODELVIEW26_ARB: + case GL_MODELVIEW27_ARB: + case GL_MODELVIEW28_ARB: + case GL_MODELVIEW29_ARB: + case GL_MODELVIEW30_ARB: + case GL_MODELVIEW31_ARB: + + /* GL_EXT_vertex_weighting */ + /* case GL_MODELVIEW0_MATRIX_EXT: */ /* alias */ + case GL_MODELVIEW1_MATRIX_EXT: + return 32; + + /* GL_ARB_texture_comrpession / GL 1.3 */ + case GL_COMPRESSED_TEXTURE_FORMATS: { + GLint temp; + + glGetIntegerv( GL_NUM_COMPRESSED_TEXTURE_FORMATS, & temp ); + return temp; + } + default: return -1; } @@ -885,7 +1129,15 @@ GLint __glGetTexLevelParameterfv_size(GLenum pname) case GL_TEXTURE_ALPHA_SIZE: case GL_TEXTURE_LUMINANCE_SIZE: case GL_TEXTURE_INTENSITY_SIZE: + + /* GL_ARB_texture_compression / GL 1.3 */ + case GL_TEXTURE_COMPRESSED_IMAGE_SIZE: + case GL_TEXTURE_COMPRESSED: + + /* GL_ARB_depth_texture / GL 1.4 */ + case GL_TEXTURE_DEPTH_SIZE: return 1; + default: return -1; } diff --git a/hw/xfree86/dixmods/glxmodule.c b/hw/xfree86/dixmods/glxmodule.c index eb8e54f26..d03ce6464 100644 --- a/hw/xfree86/dixmods/glxmodule.c +++ b/hw/xfree86/dixmods/glxmodule.c @@ -776,7 +776,6 @@ static const char *glcoreSymbols[] = { "__glXFogfvReqSize", "__glXFogivReqSize", "__glXForceCurrent", - "__glXFormatGLModes", "__glXFree", "__glXFreeBuffers", "__glXFreeContext", diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c index b08379099..446259287 100644 --- a/hw/xfree86/dri/dri.c +++ b/hw/xfree86/dri/dri.c @@ -113,11 +113,14 @@ Bool DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) { DRIScreenPrivPtr pDRIPriv; - drmContextPtr reserved; + drm_context_t * reserved; int reserved_count; int i, fd, drmWasAvailable; Bool xineramaInCore = FALSE; int err = 0; + char *openbusid; + drmVersionPtr drmlibv; + int drmlibmajor, drmlibminor, drmdimajor, drmdiminor; if (DRIGeneration != serverGeneration) { if ((DRIScreenPrivIndex = AllocateScreenPrivateIndex()) < 0) @@ -148,8 +151,31 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) drmWasAvailable = drmAvailable(); + /* Check the DRM lib version. + * drmGetLibVersion was not supported in version 1.0, so check for + * symbol first to avoid possible crash or hang. + */ + drmlibmajor = 1; + drmlibminor = 0; + if (xf86LoaderCheckSymbol("drmGetLibVersion")) { + drmlibv = drmGetLibVersion(-1); + if (drmlibv != NULL) { + drmlibmajor = drmlibv->version_major; + drmlibminor = drmlibv->version_minor; + drmFreeVersion(drmlibv); + } + } + + /* Check if the libdrm can handle falling back to loading based on name + * if a busid string is passed. + */ + if (drmlibmajor == 1 && drmlibminor >= 2) + openbusid = pDRIInfo->busIdString; + else + openbusid = NULL; + /* Note that drmOpen will try to load the kernel module, if needed. */ - fd = drmOpen(pDRIInfo->drmDriverName, NULL ); + fd = drmOpen(pDRIInfo->drmDriverName, openbusid); if (fd < 0) { /* failed to open DRM */ pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; @@ -184,7 +210,40 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) pDRIPriv->grabbedDRILock = FALSE; pDRIPriv->drmSIGIOHandlerInstalled = FALSE; - if ((err = drmSetBusid(pDRIPriv->drmFD, pDRIPriv->pDriverInfo->busIdString)) < 0) { + if (drmlibmajor == 1 && drmlibminor >= 2) { + drmSetVersion sv; + + /* Get the interface version, asking for 1.1. */ + sv.drm_di_major = 1; + sv.drm_di_minor = 1; + sv.drm_dd_major = -1; + err = drmSetInterfaceVersion(pDRIPriv->drmFD, &sv); + if (err == 0) { + drmdimajor = sv.drm_di_major; + drmdiminor = sv.drm_di_minor; + } else { + /* failure, so set it to 1.0.0. */ + drmdimajor = 1; + drmdiminor = 0; + } + } + else { + /* We can't check the DI DRM interface version, so set it to 1.0.0. */ + drmdimajor = 1; + drmdiminor = 0; + } + DRIDrvMsg(pScreen->myNum, X_INFO, + "[drm] DRM interface version %d.%d\n", drmdimajor, drmdiminor); + + /* If the interface minor number is 1.1, then we've opened a DRM device + * that already had the busid set through drmOpen. + */ + if (drmdimajor == 1 && drmdiminor >= 1) + err = 0; + else + err = drmSetBusid(pDRIPriv->drmFD, pDRIPriv->pDriverInfo->busIdString); + + if (err < 0) { pDRIPriv->directRenderingSupport = FALSE; pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; drmClose(pDRIPriv->drmFD); @@ -235,7 +294,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) pDRIPriv->hSAREA, pDRIPriv->pSAREA); if (drmAddMap( pDRIPriv->drmFD, - (drmHandle)pDRIPriv->pDriverInfo->frameBufferPhysicalAddress, + (drm_handle_t)pDRIPriv->pDriverInfo->frameBufferPhysicalAddress, pDRIPriv->pDriverInfo->frameBufferSize, DRM_FRAME_BUFFER, 0, @@ -424,7 +483,7 @@ DRICloseScreen(ScreenPtr pScreen) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRIInfoPtr pDRIInfo; - drmContextPtr reserved; + drm_context_t * reserved; int reserved_count; if (pDRIPriv && pDRIPriv->directRenderingSupport) { @@ -575,7 +634,7 @@ DRIQueryDirectRenderingCapable(ScreenPtr pScreen, Bool* isCapable) } Bool -DRIOpenConnection(ScreenPtr pScreen, drmHandlePtr hSAREA, char **busIdString) +DRIOpenConnection(ScreenPtr pScreen, drm_handle_t * hSAREA, char **busIdString) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -586,7 +645,7 @@ DRIOpenConnection(ScreenPtr pScreen, drmHandlePtr hSAREA, char **busIdString) } Bool -DRIAuthConnection(ScreenPtr pScreen, drmMagic magic) +DRIAuthConnection(ScreenPtr pScreen, drm_magic_t magic) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -620,18 +679,18 @@ DRIGetClientDriverName(ScreenPtr pScreen, /* DRICreateContextPriv and DRICreateContextPrivFromHandle are helper functions that layer on drmCreateContext and drmAddContextTag. - DRICreateContextPriv always creates a kernel drmContext and then calls + DRICreateContextPriv always creates a kernel drm_context_t and then calls DRICreateContextPrivFromHandle to create a DRIContextPriv structure for - DRI tracking. For the SIGIO handler, the drmContext is associated with + DRI tracking. For the SIGIO handler, the drm_context_t is associated with DRIContextPrivPtr. Any special flags are stored in the DRIContextPriv area and are passed to the kernel (if necessary). DRICreateContextPriv returns a pointer to newly allocated - DRIContextPriv, and returns the kernel drmContext in pHWContext. */ + DRIContextPriv, and returns the kernel drm_context_t in pHWContext. */ DRIContextPrivPtr DRICreateContextPriv(ScreenPtr pScreen, - drmContextPtr pHWContext, + drm_context_t * pHWContext, DRIContextFlags flags) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -645,7 +704,7 @@ DRICreateContextPriv(ScreenPtr pScreen, DRIContextPrivPtr DRICreateContextPrivFromHandle(ScreenPtr pScreen, - drmContext hHWContext, + drm_context_t hHWContext, DRIContextFlags flags) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -721,7 +780,7 @@ DRICreateDummyContext(ScreenPtr pScreen, Bool needCtxPriv) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); __GLXscreenInfo *pGLXScreen = &__glXActiveScreens[pScreen->myNum]; - __GLXvisualConfig *pGLXVis = pGLXScreen->pGlxVisual; + __GLcontextModes *modes = pGLXScreen->modes; void **pVisualConfigPriv = pGLXScreen->pVisualPriv; DRIContextPrivPtr pDRIContextPriv; void *contextStore; @@ -734,7 +793,7 @@ DRICreateDummyContext(ScreenPtr pScreen, Bool needCtxPriv) for (visNum = 0; visNum < pScreen->numVisuals; visNum++, visual++) { - if (pGLXVis->vid == visual->vid) + if (modes->visualID == visual->vid) break; } if (visNum == pScreen->numVisuals) return FALSE; @@ -781,15 +840,14 @@ DRIDestroyDummyContext(ScreenPtr pScreen, Bool hasCtxPriv) Bool DRICreateContext(ScreenPtr pScreen, VisualPtr visual, - XID context, drmContextPtr pHWContext) + XID context, drm_context_t * pHWContext) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); __GLXscreenInfo *pGLXScreen = &__glXActiveScreens[pScreen->myNum]; - __GLXvisualConfig *pGLXVis = pGLXScreen->pGlxVisual; + __GLcontextModes *modes = pGLXScreen->modes; void **pVisualConfigPriv = pGLXScreen->pVisualPriv; DRIContextPrivPtr pDRIContextPriv; void *contextStore; - int visNum; if (pDRIPriv->createDummyCtx && !pDRIPriv->dummyCtxPriv) { if (!DRICreateDummyContext(pScreen, pDRIPriv->createDummyCtxPriv)) { @@ -800,12 +858,13 @@ DRICreateContext(ScreenPtr pScreen, VisualPtr visual, } /* Find the GLX visual associated with the one requested */ - for (visNum = 0; - visNum < pGLXScreen->numVisuals; - visNum++, pGLXVis++, pVisualConfigPriv++) - if (pGLXVis->vid == visual->vid) + for (modes = pGLXScreen->modes; modes != NULL; modes = modes->next) { + if (modes->visualID == visual->vid) break; - if (visNum == pGLXScreen->numVisuals) { + pVisualConfigPriv++; + } + + if (modes == NULL) { /* No matching GLX visual found */ return FALSE; } @@ -928,7 +987,7 @@ DRITransitionTo2d(ScreenPtr pScreen) Bool DRICreateDrawable(ScreenPtr pScreen, Drawable id, - DrawablePtr pDrawable, drmDrawablePtr hHWDrawable) + DrawablePtr pDrawable, drm_drawable_t * hHWDrawable) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRIDrawablePrivPtr pDRIDrawablePriv; @@ -945,7 +1004,7 @@ DRICreateDrawable(ScreenPtr pScreen, Drawable id, return FALSE; } - /* Only create a drmDrawable once */ + /* Only create a drm_drawable_t once */ if (drmCreateDrawable(pDRIPriv->drmFD, hHWDrawable)) { xfree(pDRIDrawablePriv); return FALSE; @@ -1065,11 +1124,11 @@ DRIGetDrawableInfo(ScreenPtr pScreen, int* W, int* H, int* numClipRects, - XF86DRIClipRectPtr* pClipRects, + drm_clip_rect_t ** pClipRects, int* backX, int* backY, int* numBackClipRects, - XF86DRIClipRectPtr* pBackClipRects) + drm_clip_rect_t ** pBackClipRects) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRIDrawablePrivPtr pDRIDrawablePriv, pOldDrawPriv; @@ -1165,7 +1224,7 @@ DRIGetDrawableInfo(ScreenPtr pScreen, *W = (int)(pWin->drawable.width); *H = (int)(pWin->drawable.height); *numClipRects = REGION_NUM_RECTS(&pWin->clipList); - *pClipRects = (XF86DRIClipRectPtr)REGION_RECTS(&pWin->clipList); + *pClipRects = (drm_clip_rect_t *)REGION_RECTS(&pWin->clipList); if (!*numClipRects && pDRIPriv->fullscreen) { /* use fake full-screen clip rect */ @@ -1191,8 +1250,8 @@ DRIGetDrawableInfo(ScreenPtr pScreen, if (x0 < 0) x0 = 0; if (y0 < 0) y0 = 0; - if (x1 > pScreen->width-1) x1 = pScreen->width-1; - if (y1 > pScreen->height-1) y1 = pScreen->height-1; + if (x1 > pScreen->width) x1 = pScreen->width; + if (y1 > pScreen->height) y1 = pScreen->height; pDRIPriv->private_buffer_rect.x1 = x0; pDRIPriv->private_buffer_rect.y1 = y0; @@ -1222,7 +1281,7 @@ DRIGetDrawableInfo(ScreenPtr pScreen, Bool DRIGetDeviceInfo(ScreenPtr pScreen, - drmHandlePtr hFrameBuffer, + drm_handle_t * hFrameBuffer, int* fbOrigin, int* fbSize, int* fbStride, @@ -1870,7 +1929,7 @@ DRIGetSAREAPrivate(ScreenPtr pScreen) return (void *)(((char*)pDRIPriv->pSAREA)+sizeof(XF86DRISAREARec)); } -drmContext +drm_context_t DRIGetContext(ScreenPtr pScreen) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -1967,7 +2026,7 @@ DRIOpenFullScreen(ScreenPtr pScreen, DrawablePtr pDrawable) DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; WindowPtr pWin = (WindowPtr)pDrawable; - XF86DRIClipRectPtr pClipRects = (void *)REGION_RECTS(&pWin->clipList); + drm_clip_rect_t * pClipRects = (void *)REGION_RECTS(&pWin->clipList); _DRIAdjustFrame(pScrn, pDRIPriv, pScrn->frameX0, pScrn->frameY0); @@ -2115,3 +2174,21 @@ DRIMoveBuffersHelper( } else *xdir = 1; } + +char * +DRICreatePCIBusID(pciVideoPtr PciInfo) +{ + char *busID; + int domain; + PCITAG tag; + + busID = xalloc(20); + if (busID == NULL) + return NULL; + + tag = pciTag(PciInfo->bus, PciInfo->device, PciInfo->func); + domain = xf86GetPciDomain(tag); + snprintf(busID, 20, "pci:%04x:%02x:%02x.%d", domain, PciInfo->bus, + PciInfo->device, PciInfo->func); + return busID; +} diff --git a/hw/xfree86/dri/dri.h b/hw/xfree86/dri/dri.h index 80602d3dd..8a4462bb8 100644 --- a/hw/xfree86/dri/dri.h +++ b/hw/xfree86/dri/dri.h @@ -105,11 +105,11 @@ typedef struct { */ Bool (*CreateContext)(ScreenPtr pScreen, VisualPtr visual, - drmContext hHWContext, + drm_context_t hHWContext, void* pVisualConfigPriv, DRIContextType context); void (*DestroyContext)(ScreenPtr pScreen, - drmContext hHWContext, + drm_context_t hHWContext, DRIContextType context); void (*SwapContext)(ScreenPtr pScreen, DRISyncType syncType, @@ -175,10 +175,10 @@ extern Bool DRIQueryDirectRenderingCapable(ScreenPtr pScreen, Bool *isCapable); extern Bool DRIOpenConnection(ScreenPtr pScreen, - drmHandlePtr hSAREA, + drm_handle_t * hSAREA, char **busIdString); -extern Bool DRIAuthConnection(ScreenPtr pScreen, drmMagic magic); +extern Bool DRIAuthConnection(ScreenPtr pScreen, drm_magic_t magic); extern Bool DRICloseConnection(ScreenPtr pScreen); @@ -191,7 +191,7 @@ extern Bool DRIGetClientDriverName(ScreenPtr pScreen, extern Bool DRICreateContext(ScreenPtr pScreen, VisualPtr visual, XID context, - drmContextPtr pHWContext); + drm_context_t * pHWContext); extern Bool DRIDestroyContext(ScreenPtr pScreen, XID context); @@ -200,7 +200,7 @@ extern Bool DRIContextPrivDelete(pointer pResource, XID id); extern Bool DRICreateDrawable(ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable, - drmDrawablePtr hHWDrawable); + drm_drawable_t * hHWDrawable); extern Bool DRIDestroyDrawable(ScreenPtr pScreen, Drawable id, @@ -218,14 +218,14 @@ extern Bool DRIGetDrawableInfo(ScreenPtr pScreen, int* W, int* H, int* numClipRects, - XF86DRIClipRectPtr* pClipRects, + drm_clip_rect_t ** pClipRects, int* backX, int* backY, int* numBackClipRects, - XF86DRIClipRectPtr* pBackClipRects); + drm_clip_rect_t ** pBackClipRects); extern Bool DRIGetDeviceInfo(ScreenPtr pScreen, - drmHandlePtr hFrameBuffer, + drm_handle_t * hFrameBuffer, int* fbOrigin, int* fbSize, int* fbStride, @@ -298,16 +298,16 @@ extern unsigned int DRIGetDrawableStamp(ScreenPtr pScreen, CARD32 drawable_index); extern DRIContextPrivPtr DRICreateContextPriv(ScreenPtr pScreen, - drmContextPtr pHWContext, + drm_context_t * pHWContext, DRIContextFlags flags); extern DRIContextPrivPtr DRICreateContextPrivFromHandle(ScreenPtr pScreen, - drmContext hHWContext, + drm_context_t hHWContext, DRIContextFlags flags); extern Bool DRIDestroyContextPriv(DRIContextPrivPtr pDRIContextPriv); -extern drmContext DRIGetContext(ScreenPtr pScreen); +extern drm_context_t DRIGetContext(ScreenPtr pScreen); extern void DRIQueryVersion(int *majorVersion, int *minorVersion, @@ -325,6 +325,8 @@ extern void DRIMoveBuffersHelper(ScreenPtr pScreen, int *ydir, RegionPtr reg); +extern char *DRICreatePCIBusID(pciVideoPtr PciInfo); + #define _DRI_H_ #endif diff --git a/hw/xfree86/dri/dristruct.h b/hw/xfree86/dri/dristruct.h index e733ac210..268a2a655 100644 --- a/hw/xfree86/dri/dristruct.h +++ b/hw/xfree86/dri/dristruct.h @@ -50,7 +50,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. typedef struct _DRIDrawablePrivRec { - drmDrawable hwDrawable; + drm_drawable_t hwDrawable; int drawableIndex; ScreenPtr pScreen; int refCount; @@ -58,7 +58,7 @@ typedef struct _DRIDrawablePrivRec struct _DRIContextPrivRec { - drmContext hwContext; + drm_context_t hwContext; ScreenPtr pScreen; Bool valid3D; DRIContextFlags flags; @@ -78,19 +78,19 @@ typedef struct _DRIScreenPrivRec { Bool directRenderingSupport; int drmFD; /* File descriptor for /dev/video/? */ - drmHandle hSAREA; /* Handle to SAREA, for mapping */ + drm_handle_t hSAREA; /* Handle to SAREA, for mapping */ XF86DRISAREAPtr pSAREA; /* Mapped pointer to SAREA */ - drmHandle hFrameBuffer; /* Handle to framebuffer, for mapping */ - drmContext myContext; /* DDX Driver's context */ + drm_handle_t hFrameBuffer; /* Handle to framebuffer, for mapping */ + drm_context_t myContext; /* DDX Driver's context */ DRIContextPrivPtr myContextPriv;/* Pointer to server's private area */ DRIContextPrivPtr lastPartial3DContext; /* last one partially saved */ void** hiddenContextStore; /* hidden X context */ void** partial3DContextStore; /* parital 3D context */ DRIInfoPtr pDriverInfo; int nrWindows; - XF86DRIClipRectRec private_buffer_rect; /* management of private buffers */ + drm_clip_rect_t private_buffer_rect; /* management of private buffers */ DrawablePtr fullscreen; /* pointer to fullscreen drawable */ - XF86DRIClipRectRec fullscreen_rect; /* fake rect for fullscreen mode */ + drm_clip_rect_t fullscreen_rect; /* fake rect for fullscreen mode */ DRIWrappedFuncsRec wrap; DrawablePtr DRIDrawables[SAREA_MAX_DRAWABLES]; DRIContextPrivPtr dummyCtxPriv; /* Pointer to dummy context */ diff --git a/hw/xfree86/dri/sarea.h b/hw/xfree86/dri/sarea.h index a79477d78..77c16e0ef 100644 --- a/hw/xfree86/dri/sarea.h +++ b/hw/xfree86/dri/sarea.h @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/Xserver/GL/dri/sarea.h,v 1.11 2002/10/30 12:52:03 alanh Exp $ */ /** * \file sarea.h * SAREA definitions. @@ -87,7 +88,7 @@ typedef struct _XF86DRISAREA { drmLock drawable_lock; XF86DRISAREADrawableRec drawableTable[SAREA_MAX_DRAWABLES]; XF86DRISAREAFrameRec frame; - drmContext dummy_context; + drm_context_t dummy_context; } XF86DRISAREARec, *XF86DRISAREAPtr; #endif diff --git a/hw/xfree86/dri/xf86dri.c b/hw/xfree86/dri/xf86dri.c index 7920b217d..1be253a42 100644 --- a/hw/xfree86/dri/xf86dri.c +++ b/hw/xfree86/dri/xf86dri.c @@ -184,7 +184,7 @@ ProcXF86DRIOpenConnection( ) { xXF86DRIOpenConnectionReply rep; - drmHandle hSAREA; + drm_handle_t hSAREA; char* busIdString; REQUEST(xXF86DRIOpenConnectionReq); @@ -340,7 +340,7 @@ ProcXF86DRICreateContext( if (!DRICreateContext( pScreen, visual, stuff->context, - (drmContextPtr)&rep.hHWContext)) { + (drm_context_t *)&rep.hHWContext)) { return BadValue; } @@ -397,7 +397,7 @@ ProcXF86DRICreateDrawable( if (!DRICreateDrawable( screenInfo.screens[stuff->screen], (Drawable)stuff->drawable, pDrawable, - (drmDrawablePtr)&rep.hHWDrawable)) { + (drm_drawable_t *)&rep.hHWDrawable)) { return BadValue; } @@ -442,8 +442,8 @@ ProcXF86DRIGetDrawableInfo( xXF86DRIGetDrawableInfoReply rep; DrawablePtr pDrawable; int X, Y, W, H; - XF86DRIClipRectPtr pClipRects; - XF86DRIClipRectPtr pBackClipRects; + drm_clip_rect_t * pClipRects; + drm_clip_rect_t * pBackClipRects; int backX, backY; REQUEST(xXF86DRIGetDrawableInfoReq); @@ -492,10 +492,10 @@ ProcXF86DRIGetDrawableInfo( rep.backY = backY; if (rep.numBackClipRects) - rep.length += sizeof(XF86DRIClipRectRec) * rep.numBackClipRects; + rep.length += sizeof(drm_clip_rect_t) * rep.numBackClipRects; if (rep.numClipRects) - rep.length += sizeof(XF86DRIClipRectRec) * rep.numClipRects; + rep.length += sizeof(drm_clip_rect_t) * rep.numClipRects; rep.length = ((rep.length + 3) & ~3) >> 2; @@ -503,13 +503,13 @@ ProcXF86DRIGetDrawableInfo( if (rep.numClipRects) { WriteToClient(client, - sizeof(XF86DRIClipRectRec) * rep.numClipRects, + sizeof(drm_clip_rect_t) * rep.numClipRects, (char *)pClipRects); } if (rep.numBackClipRects) { WriteToClient(client, - sizeof(XF86DRIClipRectRec) * rep.numBackClipRects, + sizeof(drm_clip_rect_t) * rep.numBackClipRects, (char *)pBackClipRects); } @@ -522,7 +522,7 @@ ProcXF86DRIGetDeviceInfo( ) { xXF86DRIGetDeviceInfoReply rep; - drmHandle hFrameBuffer; + drm_handle_t hFrameBuffer; void *pDevPrivate; REQUEST(xXF86DRIGetDeviceInfoReq); diff --git a/hw/xfree86/os-support/xf86_libc.h b/hw/xfree86/os-support/xf86_libc.h index a1d0fca08..1ac0b3930 100644 --- a/hw/xfree86/os-support/xf86_libc.h +++ b/hw/xfree86/os-support/xf86_libc.h @@ -45,6 +45,7 @@ #define XF86_LIBC_H 1 #include "Xfuncs.h" +#include <stddef.h> /* * The first set of definitions are required both for modules and |