Here's the latest version of my GLX changes. It includes all the stuff that was in the last version, but all of the client-side support is in place for GLX_SGI_make_current_read. The interesting thing is that, because of the way I refectored glXMakeCurrent, glXMakeCurrentReadSGI, and glXMakeContextCurrent, there's not very much more code in glxext.c (only about 55 lines).

I also fixed a problem with the GLX extension string when the rendering screen was not direct capable (i.e., a remote display).

The problem with HP_occlusion_test persists. :(

I don't plan to do anything else with these changes until *after* I return from vacation. I'll be back on the 23rd of June. I will be around for the #dri-devel chat on the 9th, however.

Please use that week as an opportunity to put the patch through its paces. I know there are few code paths that aren't fully tested. I'd like to commit the patch sometime shortly after I return.
Index: lib/GL/glx/compsize.c
===================================================================
RCS file: /cvsroot/dri/xc/xc/lib/GL/glx/compsize.c,v
retrieving revision 1.6
diff -u -d -r1.6 compsize.c
--- lib/GL/glx/compsize.c       25 Nov 2002 19:57:48 -0000      1.6
+++ lib/GL/glx/compsize.c       6 Jun 2003 21:26:06 -0000
@@ -38,6 +38,139 @@
 
 #include "size.h"
 
+/*
+** Return the number of elements per group of a specified format
+*/
+GLint __glElementsPerGroup(GLenum format, GLenum type) 
+{
+    /*
+    ** To make row length computation valid for image extraction,
+    ** packed pixel types assume elements per group equals one.
+    */
+    switch(type) {
+    case GL_UNSIGNED_BYTE_3_3_2:
+    case GL_UNSIGNED_BYTE_2_3_3_REV:
+    case GL_UNSIGNED_SHORT_5_6_5:
+    case GL_UNSIGNED_SHORT_5_6_5_REV:
+    case GL_UNSIGNED_SHORT_4_4_4_4:
+    case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+    case GL_UNSIGNED_SHORT_5_5_5_1:
+    case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+    case GL_UNSIGNED_SHORT_8_8_APPLE:
+    case GL_UNSIGNED_SHORT_8_8_REV_APPLE:
+    case GL_UNSIGNED_SHORT_15_1_MESA:
+    case GL_UNSIGNED_SHORT_1_15_REV_MESA:
+    case GL_UNSIGNED_INT_8_8_8_8:
+    case GL_UNSIGNED_INT_8_8_8_8_REV:
+    case GL_UNSIGNED_INT_10_10_10_2:
+    case GL_UNSIGNED_INT_2_10_10_10_REV:
+    case GL_UNSIGNED_INT_24_8_NV:
+    case GL_UNSIGNED_INT_24_8_MESA:
+    case GL_UNSIGNED_INT_8_24_REV_MESA:
+      return 1;
+    default:
+      break;
+    }
+
+    switch(format) {
+      case GL_RGB:
+      case GL_BGR:
+       return 3;
+      case GL_422_EXT:
+      case GL_422_REV_EXT:
+      case GL_422_AVERAGE_EXT:
+      case GL_422_REV_AVERAGE_EXT:
+      case GL_LUMINANCE_ALPHA:
+       return 2;
+      case GL_RGBA:
+      case GL_BGRA:
+      case GL_ABGR_EXT:
+       return 4;
+      case GL_COLOR_INDEX:
+      case GL_STENCIL_INDEX:
+      case GL_DEPTH_COMPONENT:
+      case GL_RED:
+      case GL_GREEN:
+      case GL_BLUE:
+      case GL_ALPHA:
+      case GL_LUMINANCE:
+      case GL_INTENSITY:
+       return 1;
+      default:
+       return 0;
+    }
+}
+
+/*
+** Return the number of bytes per element, based on the element type (other
+** than GL_BITMAP).
+*/
+GLint __glBytesPerElement(GLenum type) 
+{
+    switch(type) {
+      case GL_UNSIGNED_SHORT:
+      case GL_SHORT:
+      case GL_UNSIGNED_SHORT_5_6_5:
+      case GL_UNSIGNED_SHORT_5_6_5_REV:
+      case GL_UNSIGNED_SHORT_4_4_4_4:
+      case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+      case GL_UNSIGNED_SHORT_5_5_5_1:
+      case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+      case GL_UNSIGNED_SHORT_8_8_APPLE:
+      case GL_UNSIGNED_SHORT_8_8_REV_APPLE:
+      case GL_UNSIGNED_SHORT_15_1_MESA:
+      case GL_UNSIGNED_SHORT_1_15_REV_MESA:
+       return 2;
+      case GL_UNSIGNED_BYTE:
+      case GL_BYTE:
+      case GL_UNSIGNED_BYTE_3_3_2:
+      case GL_UNSIGNED_BYTE_2_3_3_REV:
+       return 1;
+      case GL_INT:
+      case GL_UNSIGNED_INT:
+      case GL_FLOAT:
+      case GL_UNSIGNED_INT_8_8_8_8:
+      case GL_UNSIGNED_INT_8_8_8_8_REV:
+      case GL_UNSIGNED_INT_10_10_10_2:
+      case GL_UNSIGNED_INT_2_10_10_10_REV:
+      case GL_UNSIGNED_INT_24_8_NV:
+      case GL_UNSIGNED_INT_24_8_MESA:
+      case GL_UNSIGNED_INT_8_24_REV_MESA:
+       return 4;
+      default:
+       return 0;
+    }
+}
+
+/*
+** Compute memory required for internal packed array of data of given type
+** and format.
+*/
+GLint __glImageSize(GLsizei width, GLsizei height, GLsizei depth,
+                   GLenum format, GLenum type) 
+{
+    int bytes_per_row;
+    int components;
+
+    if (width < 0 || height < 0 || depth < 0) {
+       return 0;
+    }
+    /*
+    ** Zero is returned if either format or type are invalid.
+    */
+    components = __glElementsPerGroup(format,type);
+    if (type == GL_BITMAP) {
+       if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) {
+           bytes_per_row = (width + 7) >> 3;
+       } else {
+           return 0;
+       }
+    } else {
+       bytes_per_row = __glBytesPerElement(type) * width;
+    }
+    return bytes_per_row * height * depth * components;
+}
+
 GLint __glFogiv_size(GLenum pname)
 {
     switch (pname) {
@@ -47,6 +180,8 @@
       case GL_FOG_MODE:                return 1;
       case GL_FOG_INDEX:       return 1;
       case GL_FOG_START:       return 1;
+      case GL_FOG_DISTANCE_MODE_NV: return 1;
+      case GL_FOG_OFFSET_VALUE_SGIX: return 1;
       default:
        return 0;
     }
@@ -81,82 +216,7 @@
 
 GLint __glDrawPixels_size(GLenum format, GLenum type, GLsizei w, GLsizei h)
 {
-    GLint elements, esize;
-    
-    switch (format) {
-      case GL_COLOR_INDEX:
-      case GL_STENCIL_INDEX:
-      case GL_DEPTH_COMPONENT:
-       elements = 1;
-       break;
-      case GL_RED:
-      case GL_GREEN:
-      case GL_BLUE:
-      case GL_ALPHA:
-      case GL_LUMINANCE:
-      case GL_INTENSITY:
-       elements = 1;
-       break;
-      case GL_LUMINANCE_ALPHA:
-       elements = 2;
-       break;
-      case GL_RGB:
-      case GL_BGR:
-       elements = 3;
-       break;
-      case GL_RGBA:
-      case GL_BGRA:
-      case GL_ABGR_EXT:
-       elements = 4;
-       break;
-      default:
-       return 0;
-    }
-    switch (type) {
-      case GL_BITMAP:
-       if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) {
-           return (h * ((w+7)/8));
-       } else {
-           return 0;
-       }
-      case GL_BYTE:
-      case GL_UNSIGNED_BYTE:
-       esize = 1;
-       break;
-      case GL_UNSIGNED_BYTE_3_3_2:
-      case GL_UNSIGNED_BYTE_2_3_3_REV:
-       esize = 1;
-       elements = 1;
-       break;
-      case GL_SHORT:
-      case GL_UNSIGNED_SHORT:
-       esize = 2;
-       break;
-      case GL_UNSIGNED_SHORT_5_6_5:
-      case GL_UNSIGNED_SHORT_5_6_5_REV:
-      case GL_UNSIGNED_SHORT_4_4_4_4:
-      case GL_UNSIGNED_SHORT_4_4_4_4_REV:
-      case GL_UNSIGNED_SHORT_5_5_5_1:
-      case GL_UNSIGNED_SHORT_1_5_5_5_REV:
-       esize = 2;
-       elements = 1;
-       break;
-      case GL_INT:
-      case GL_UNSIGNED_INT:
-      case GL_FLOAT:
-       esize = 4;
-       break;
-      case GL_UNSIGNED_INT_8_8_8_8:
-      case GL_UNSIGNED_INT_8_8_8_8_REV:
-      case GL_UNSIGNED_INT_10_10_10_2:
-      case GL_UNSIGNED_INT_2_10_10_10_REV:
-       esize = 4;
-       elements = 1;
-       break;
-      default:
-       return 0;
-    }
-    return (elements * esize * w * h);
+    return __glImageSize( w, h, 1, format, type );
 }
 
 GLint __glBitmap_size(GLsizei w, GLsizei h)
@@ -190,25 +250,45 @@
 GLint __glTexParameterfv_size(GLenum e)
 {
     switch (e) {
+      case GL_TEXTURE_BORDER_COLOR:
+       return 4;
+
       case GL_TEXTURE_WRAP_S:
       case GL_TEXTURE_WRAP_T:
       case GL_TEXTURE_WRAP_R:
       case GL_TEXTURE_MIN_FILTER:
       case GL_TEXTURE_MAG_FILTER:
-       return 1;
-      case GL_TEXTURE_BORDER_COLOR:
-       return 4;
       case GL_TEXTURE_PRIORITY:
-       return 1;
+      case GL_TEXTURE_RESIDENT:
+       
+      /* GL_SGIS_texture_lod / GL_EXT_texture_lod / GL 1.2 */
       case GL_TEXTURE_MIN_LOD:
       case GL_TEXTURE_MAX_LOD:
       case GL_TEXTURE_BASE_LEVEL:
       case GL_TEXTURE_MAX_LEVEL:
+
+      /* GL_SGIX_texture_lod_bias */
+      case GL_TEXTURE_LOD_BIAS_S_SGIX:
+      case GL_TEXTURE_LOD_BIAS_T_SGIX:
+      case GL_TEXTURE_LOD_BIAS_R_SGIX:
+
+      /* GL_ARB_shadow / GL 1.4 */
+      case GL_TEXTURE_COMPARE_MODE:
+      case GL_TEXTURE_COMPARE_FUNC:
+
+      /* GL_SGIX_shadow_ambient / GL_ARB_shadow_ambient */
+      case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB:
+
+      /* GL_SGIX_shadow */
+      case GL_TEXTURE_COMPARE_SGIX:
+      case GL_TEXTURE_COMPARE_OPERATOR_SGIX:
+
+      /* GL_SGIX_texture_coordinate_clamp */
+      case GL_TEXTURE_MAX_CLAMP_S_SGIX:
+      case GL_TEXTURE_MAX_CLAMP_T_SGIX:
+      case GL_TEXTURE_MAX_CLAMP_R_SGIX:
        return 1;
-      case GL_TEXTURE_COMPARE_MODE_ARB: /* GL_ARB_shadow */
-      case GL_TEXTURE_COMPARE_FUNC_ARB: /* GL_ARB_shadow */
-      case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: /* GL_ARB_shadow_ambient */
-       return 1;
+
       default:
        return 0;
     }
@@ -243,7 +323,7 @@
       case GL_OPERAND2_ALPHA_EXT:
       case GL_RGB_SCALE_EXT:
       case GL_ALPHA_SCALE:
-      /* GL_EXT_texture_lod */
+      /* GL_EXT_texture_lod_bias */
       case GL_TEXTURE_LOD_BIAS_EXT:
         return 1;
       default:
@@ -258,245 +338,18 @@
 
 GLint __glTexImage1D_size(GLenum format, GLenum type, GLsizei w)
 {
-    GLint elements, esize;
-
-    if (w < 0) return 0;
-    switch (format) {
-      case GL_COLOR_INDEX:
-       elements = 1;
-       break;
-      case GL_RED:
-      case GL_GREEN:
-      case GL_BLUE:
-      case GL_ALPHA:
-      case GL_LUMINANCE:
-      case GL_INTENSITY:
-      case GL_DEPTH_COMPONENT:
-       elements = 1;
-       break;
-      case GL_LUMINANCE_ALPHA:
-       elements = 2;
-       break;
-      case GL_RGB:
-      case GL_BGR:
-       elements = 3;
-       break;
-      case GL_RGBA:
-      case GL_BGRA:
-      case GL_ABGR_EXT:
-       elements = 4;
-       break;
-      default:
-       return 0;
-    }
-    switch (type) {
-      case GL_BITMAP:
-       if (format == GL_COLOR_INDEX) {
-           return (w+7)/8;
-       } else {
-           return 0;
-       }
-      case GL_BYTE:
-      case GL_UNSIGNED_BYTE:
-       esize = 1;
-       break;
-      case GL_UNSIGNED_BYTE_3_3_2:
-      case GL_UNSIGNED_BYTE_2_3_3_REV:
-       esize = 1;
-       elements = 1;
-       break;
-      case GL_SHORT:
-      case GL_UNSIGNED_SHORT:
-       esize = 2;
-       break;
-      case GL_UNSIGNED_SHORT_5_6_5:
-      case GL_UNSIGNED_SHORT_5_6_5_REV:
-      case GL_UNSIGNED_SHORT_4_4_4_4:
-      case GL_UNSIGNED_SHORT_4_4_4_4_REV:
-      case GL_UNSIGNED_SHORT_5_5_5_1:
-      case GL_UNSIGNED_SHORT_1_5_5_5_REV:
-       esize = 2;
-       elements = 1;
-       break;
-      case GL_INT:
-      case GL_UNSIGNED_INT:
-      case GL_FLOAT:
-       esize = 4;
-       break;
-      case GL_UNSIGNED_INT_8_8_8_8:
-      case GL_UNSIGNED_INT_8_8_8_8_REV:
-      case GL_UNSIGNED_INT_10_10_10_2:
-      case GL_UNSIGNED_INT_2_10_10_10_REV:
-       esize = 4;
-       elements = 1;
-       break;
-      default:
-       return 0;
-    }
-    return (elements * esize * w);
+    return __glImageSize( w, 1, 1, format, type );
 }
 
 GLint __glTexImage2D_size(GLenum format, GLenum type, GLsizei w, GLsizei h)
 {
-    GLint elements, esize;
-
-    if (w < 0) return 0;
-    if (h < 0) return 0;
-    switch (format) {
-      case GL_COLOR_INDEX:
-       elements = 1;
-       break;
-      case GL_RED:
-      case GL_GREEN:
-      case GL_BLUE:
-      case GL_ALPHA:
-      case GL_LUMINANCE:
-      case GL_INTENSITY:
-      case GL_DEPTH_COMPONENT:
-       elements = 1;
-       break;
-      case GL_LUMINANCE_ALPHA:
-       elements = 2;
-       break;
-      case GL_RGB:
-      case GL_BGR:
-       elements = 3;
-       break;
-      case GL_RGBA:
-      case GL_BGRA:
-      case GL_ABGR_EXT:
-       elements = 4;
-       break;
-      default:
-       return 0;
-    }
-    switch (type) {
-      case GL_BITMAP:
-       if (format == GL_COLOR_INDEX) {
-           return (h * ((w+7)/8));
-       } else {
-           return 0;
-       }
-      case GL_BYTE:
-      case GL_UNSIGNED_BYTE:
-       esize = 1;
-       break;
-      case GL_UNSIGNED_BYTE_3_3_2:
-      case GL_UNSIGNED_BYTE_2_3_3_REV:
-       esize = 1;
-       elements = 1;
-       break;
-      case GL_SHORT:
-      case GL_UNSIGNED_SHORT:
-       esize = 2;
-       break;
-      case GL_UNSIGNED_SHORT_5_6_5:
-      case GL_UNSIGNED_SHORT_5_6_5_REV:
-      case GL_UNSIGNED_SHORT_4_4_4_4:
-      case GL_UNSIGNED_SHORT_4_4_4_4_REV:
-      case GL_UNSIGNED_SHORT_5_5_5_1:
-      case GL_UNSIGNED_SHORT_1_5_5_5_REV:
-       esize = 2;
-       elements = 1;
-       break;
-      case GL_INT:
-      case GL_UNSIGNED_INT:
-      case GL_FLOAT:
-       esize = 4;
-       break;
-      case GL_UNSIGNED_INT_8_8_8_8:
-      case GL_UNSIGNED_INT_8_8_8_8_REV:
-      case GL_UNSIGNED_INT_10_10_10_2:
-      case GL_UNSIGNED_INT_2_10_10_10_REV:
-       esize = 4;
-       elements = 1;
-       break;
-      default:
-       return 0;
-    }
-    return (elements * esize * w * h);
+    return __glImageSize( w, h, 1, format, type );
 }
 
 GLint __glTexImage3D_size(GLenum format, GLenum type, GLsizei w, GLsizei h,
                          GLsizei d)
 {
-    GLint elements, esize;
-
-    if (w < 0) return 0;
-    if (h < 0) return 0;
-    if (d < 0) return 0;
-    switch (format) {
-      case GL_COLOR_INDEX:
-       elements = 1;
-       break;
-      case GL_RED:
-      case GL_GREEN:
-      case GL_BLUE:
-      case GL_ALPHA:
-      case GL_LUMINANCE:
-      case GL_INTENSITY:
-       elements = 1;
-       break;
-      case GL_LUMINANCE_ALPHA:
-       elements = 2;
-       break;
-      case GL_RGB:
-      case GL_BGR:
-       elements = 3;
-       break;
-      case GL_RGBA:
-      case GL_BGRA:
-      case GL_ABGR_EXT:
-       elements = 4;
-       break;
-      default:
-       return 0;
-    }
-    switch (type) {
-      case GL_BITMAP:
-       if (format == GL_COLOR_INDEX) {
-           return (d * (h * ((w+7)/8)));
-       } else {
-           return 0;
-       }
-      case GL_BYTE:
-      case GL_UNSIGNED_BYTE:
-       esize = 1;
-       break;
-      case GL_UNSIGNED_BYTE_3_3_2:
-      case GL_UNSIGNED_BYTE_2_3_3_REV:
-       esize = 1;
-       elements = 1;
-       break;
-      case GL_SHORT:
-      case GL_UNSIGNED_SHORT:
-       esize = 2;
-       break;
-      case GL_UNSIGNED_SHORT_5_6_5:
-      case GL_UNSIGNED_SHORT_5_6_5_REV:
-      case GL_UNSIGNED_SHORT_4_4_4_4:
-      case GL_UNSIGNED_SHORT_4_4_4_4_REV:
-      case GL_UNSIGNED_SHORT_5_5_5_1:
-      case GL_UNSIGNED_SHORT_1_5_5_5_REV:
-       esize = 2;
-       elements = 1;
-       break;
-      case GL_INT:
-      case GL_UNSIGNED_INT:
-      case GL_FLOAT:
-       esize = 4;
-       break;
-      case GL_UNSIGNED_INT_8_8_8_8:
-      case GL_UNSIGNED_INT_8_8_8_8_REV:
-      case GL_UNSIGNED_INT_10_10_10_2:
-      case GL_UNSIGNED_INT_2_10_10_10_REV:
-       esize = 4;
-       elements = 1;
-       break;
-      default:
-       return 0;
-    }
-    return (elements * esize * w * h * d);
+    return __glImageSize( w, h, d, format, type );
 }
 
 GLint __glLightfv_size(GLenum pname)
Index: lib/GL/glx/glxclient.h
===================================================================
RCS file: /cvsroot/dri/xc/xc/lib/GL/glx/glxclient.h,v
retrieving revision 1.28
diff -u -d -r1.28 glxclient.h
--- lib/GL/glx/glxclient.h      21 May 2003 17:32:05 -0000      1.28
+++ lib/GL/glx/glxclient.h      6 Jun 2003 21:26:06 -0000
@@ -181,8 +181,6 @@
 
     /*
     ** Method to bind a DRI drawable to a DRI graphics context.
-    ** XXX in the future, also pass a 'read' GLXDrawable for
-    ** glXMakeCurrentReadSGI() and GLX 1.3's glXMakeContextCurrent().
     */
     Bool (*bindContext)(Display *dpy, int scrn, GLXDrawable draw,
                        GLXContext gc);
@@ -199,6 +197,22 @@
     ** screen used to create this context.  Never dereferenced in libGL.
     */
     void *private;
+
+    /*
+    ** Added with internal API version "20030606".
+    **
+    ** Method to bind a DRI drawable to a DRI graphics context.
+    */
+    Bool (*bindContext2)(Display *dpy, int scrn, GLXDrawable draw,
+                        GLXDrawable read, GLXContext gc);
+
+    /*
+    ** Added with internal API version "20030606".
+    **
+    ** Method to unbind a DRI drawable to a DRI graphics context.
+    */
+    Bool (*unbindContext2)(Display *dpy, int scrn, GLXDrawable draw,
+                          GLXDrawable read, GLXContext gc);
 };
 
 /*
@@ -492,7 +506,7 @@
 
     /*
     ** The current drawable for this context.  Will be None if this
-    ** context is not current to any drawable.
+    ** context is not current to any drawable.  currentReadable is below.
     */
     GLXDrawable currentDrawable;
 
@@ -532,6 +546,14 @@
     ** Added with internal API version "20030317".
     */
     GLXFBConfigID  fbconfigID;
+
+    /*
+    ** Added with internal API version "20030606".
+    ** 
+    ** The current read-drawable for this context.  Will be None if this
+    ** context is not current to any drawable.
+    */
+    GLXDrawable currentReadable;
 };
 
 #define __glXSetError(gc,code) \
@@ -693,6 +715,14 @@
 
 /* Return the size, in bytes, of some pixel data */
 extern GLint __glImageSize(GLint, GLint, GLint, GLenum, GLenum);
+
+/* Return the number of elements per group of a specified format*/
+extern GLint __glElementsPerGroup(GLenum format, GLenum type);
+
+/* Return the number of bytes per element, based on the element type (other
+** than GL_BITMAP).
+*/
+extern GLint __glBytesPerElement(GLenum type);
 
 /* Return the k value for a given map target */
 extern GLint __glEvalComputeK(GLenum);
Index: lib/GL/glx/glxcmds.c
===================================================================
RCS file: /cvsroot/dri/xc/xc/lib/GL/glx/glxcmds.c,v
retrieving revision 1.41
diff -u -d -r1.41 glxcmds.c
--- lib/GL/glx/glxcmds.c        21 May 2003 17:32:06 -0000      1.41
+++ lib/GL/glx/glxcmds.c        6 Jun 2003 21:26:07 -0000
@@ -52,6 +52,7 @@
 const char __glXGLClientExtensions[] = 
                        "GL_ARB_depth_texture "
                        "GL_ARB_imaging "
+                       "GL_ARB_multisample "
                        "GL_ARB_multitexture "
                        "GL_ARB_point_parameters "
                        "GL_ARB_shadow "
@@ -72,6 +73,7 @@
                        "GL_EXT_blend_logic_op "
                        "GL_EXT_blend_minmax "
                        "GL_EXT_blend_subtract "
+                       "GL_EXT_clip_volume_hint "
                        "GL_EXT_copy_texture "
                        "GL_EXT_draw_range_elements "
                        "GL_EXT_fog_coord "
@@ -81,28 +83,131 @@
                        "GL_EXT_rescale_normal "
                        "GL_EXT_secondary_color "
                        "GL_EXT_separate_specular_color "
+                       "GL_EXT_shadow_funcs "
                        "GL_EXT_stencil_two_side "
                        "GL_EXT_stencil_wrap "
                        "GL_EXT_subtexture "
                        "GL_EXT_texture "
                        "GL_EXT_texture3D "
+                       "GL_EXT_texture_edge_clamp "
                        "GL_EXT_texture_env_add "
                        "GL_EXT_texture_env_combine "
                        "GL_EXT_texture_env_dot3 "
+                       "GL_EXT_texture_filter_anisotropic "
+                       "GL_EXT_texture_lod "
                        "GL_EXT_texture_lod_bias "
                        "GL_EXT_texture_object "
+                       "GL_EXT_texture_rectangle "
                        "GL_EXT_vertex_array "
+                       "GL_APPLE_packed_pixels "
+                       "GL_APPLE_ycbcr_422 "
+                       "GL_ATI_texture_env_combine3 "
+                       "GL_ATI_texture_float "
+                       "GL_ATI_texture_mirror_once "
+                       "GL_ATIX_texture_env_combine3 "
+                       "GL_HP_convolution_border_modes "
+                       "GL_HP_occlusion_test "
+                       "GL_IBM_cull_vertex "
+                       "GL_IBM_pixel_filter_hint "
+                       "GL_IBM_rasterpos_clip "
+                       "GL_IBM_texture_clamp_nodraw "
                        "GL_IBM_texture_mirrored_repeat "
+                       "GL_MESA_pack_invert "
+                       "GL_MESA_ycbcr_texture "
                        "GL_NV_blend_square "
+                       "GL_NV_copy_depth_to_color "
+                       "GL_NV_depth_clamp "
+                       "GL_NV_fog_distance "
+                       "GL_NV_light_max_exponent "
+                       "GL_NV_multisample_filter_hint "
+                       "GL_NV_texgen_reflection "
+                       "GL_NV_texture_rectangle "
+                       "GL_SGIS_generate_mipmap "
                        "GL_SGIS_multisample "
                        "GL_SGIS_texture_border_clamp "
                        "GL_SGIS_texture_edge_clamp "
-                       "GL_SGIS_generate_mipmap "
+                       "GL_SGIS_texture_lod "
+                       "GL_SGIX_blend_alpha_minmax "
+                       "GL_SGIX_clipmap "
+                       "GL_SGIX_depth_texture "
+                       "GL_SGIX_fog_offset "
+                       "GL_SGIX_shadow "
+                       "GL_SGIX_shadow_ambient "
+                       "GL_SGIX_texture_coordinate_clamp "
+                       "GL_SGIX_texture_lod_bias "
+                       "GL_SGIX_texture_range "
+                       "GL_SGIX_vertex_preclip "
+                       "GL_SGIX_vertex_preclip_hint "
+                       "GL_SGIX_ycrcb "
+                       "GL_SUN_convolution_border_modes "
+                       "GL_SUN_slice_accum "
                        ;
 
 static const char __glXGLXClientVendorName[] = "SGI";
 static const char __glXGLXClientVersion[] = "1.2";
 
+static void * DriverCreateContextWrapper( __GLXscreenConfigs *psc,
+    Display *dpy, XVisualInfo *vis, void *shared, __DRIcontext *ctx,
+    __GLXFBConfig *fbconfig );
+
+static Bool dummyBindContext2( Display *dpy, int scrn,
+    GLXDrawable draw, GLXDrawable read, GLXContext gc );
+
+static Bool dummyUnbindContext2( Display *dpy, int scrn,
+    GLXDrawable draw, GLXDrawable read, GLXContext gc );
+
+/****************************************************************************/
+
+static Bool dummyBindContext2( Display *dpy, int scrn,
+                              GLXDrawable draw, GLXDrawable read,
+                              GLXContext gc )
+{
+    assert( draw == read );
+    return (*gc->driContext.bindContext)( dpy, scrn, draw, gc );
+}
+
+static Bool dummyUnbindContext2( Display *dpy, int scrn,
+                                GLXDrawable draw, GLXDrawable read,
+                                GLXContext gc )
+{
+    assert( draw == read );
+    return (*gc->driContext.unbindContext)( dpy, scrn, draw, gc, GL_FALSE );
+}
+
+
+/****************************************************************************/
+/**
+ * Wrap the call to the driver's \c createContext function.
+ *
+ * The \c createContext function is wrapped because not all drivers support
+ * the "new" \c unbindContext2 and \c bindContext2 interfaces.  libGL should
+ * not have to check to see which functions the driver supports.  Instead,
+ * if either function is not supported it is wrapped.  The wrappers test to
+ * make sure that both drawables are the same and pass control to the old
+ * interface.
+ */
+
+static void * DriverCreateContextWrapper( __GLXscreenConfigs *psc,
+                                         Display *dpy, XVisualInfo *vis, void *shared,
+                           __DRIcontext *ctx, __GLXFBConfig *fbconfig )
+{
+    void * ctx_priv;
+
+    ctx_priv = (*psc->driScreen.createContext)(dpy, vis, shared, ctx,
+                                              fbconfig);
+    if ( ctx_priv != NULL ) {
+       if ( ctx->unbindContext2 == NULL ) {
+           ctx->unbindContext2 = dummyUnbindContext2;
+       }
+
+       if ( ctx->bindContext2 == NULL ) {
+           ctx->bindContext2 = dummyBindContext2;
+       }
+    }
+    
+    return ctx_priv;
+}
+
 /****************************************************************************/
 /**
  * Get the write __DRIdrawable bound to the specificed GLXContext
@@ -114,7 +219,7 @@
  */
 
 static __DRIdrawable *
-GetDRIDrawable( GLXContext gc )
+GetDRIDrawable( GLXContext gc, GLXDrawable drawable )
 {
 #ifdef GLX_DIRECT_RENDERING
     __DRIdrawable *pdraw = NULL;
@@ -130,7 +235,7 @@
                ** not bound to a direct rendering context.
                */
                pdraw = (*psc->driScreen.getDrawable)(gc->currentDpy,
-                                                     gc->currentDrawable,
+                                                     drawable,
                                                      psc->driScreen.private);
            }
        }
@@ -138,6 +243,7 @@
 
     return pdraw;
 #else
+    (void) gc;
     return NULL;
 #endif
 }
@@ -258,8 +364,8 @@
                void *shared = (shareList ?
                                shareList->driContext.private : NULL);
                gc->driContext.private =
-                   (*psc->driScreen.createContext)(dpy, vis, shared,
-                                                   &gc->driContext, NULL);
+                   DriverCreateContextWrapper( psc, dpy, vis, shared,
+                                               &gc->driContext, NULL );
                if (gc->driContext.private) {
                    gc->isDirect = GL_TRUE;
                    gc->screen = vis->screen;
@@ -647,24 +753,11 @@
     GLXContextTag tag;
     CARD8 opcode;
 #ifdef GLX_DIRECT_RENDERING
-    __GLXdisplayPrivate *priv;
-    __DRIdrawable *pdraw;
+    __DRIdrawable *pdraw = GetDRIDrawable( gc, drawable );
 
-    priv = __glXInitialize(dpy);
-    if (priv->driDisplay.private) {
-       __GLXscreenConfigs *psc = &priv->screenConfigs[gc->screen];
-       if (psc && psc->driScreen.private) {
-           /*
-           ** getDrawable returning NULL implies that the drawable is
-           ** not bound to a direct rendering context.
-           */
-           pdraw = (*psc->driScreen.getDrawable)(dpy, drawable,
-                                                 psc->driScreen.private);
-           if (pdraw) {
-               (*pdraw->swapBuffers)(dpy, pdraw->private);
-               return;
-           }
-       }
+    if ( pdraw != NULL ) {
+       (*pdraw->swapBuffers)(dpy, pdraw->private);
+       return;
     }
 #endif
 
@@ -677,7 +770,8 @@
     ** The calling thread may or may not have a current context.  If it
     ** does, send the context tag so the server can do a flush.
     */
-    if ((dpy == gc->currentDpy) && (drawable == gc->currentDrawable)) {
+    if ((dpy == gc->currentDpy) && 
+       ((drawable == gc->currentDrawable) || (drawable == gc->currentReadable)) ) {
        tag = gc->currentContextTag;
     } else {
        tag = 0;
@@ -769,20 +863,22 @@
       case GLX_TRANSPARENT_INDEX_VALUE_EXT:
        *value_return = pConfig->transparentIndex;
        return Success;
-      case GLX_X_VISUAL_TYPE_EXT:
+      case GLX_X_VISUAL_TYPE:
        switch(pConfig->class) {
          case TrueColor:
-           *value_return = GLX_TRUE_COLOR_EXT;   break;
+           *value_return = GLX_TRUE_COLOR;   break;
          case DirectColor:
-           *value_return = GLX_DIRECT_COLOR_EXT; break;
+           *value_return = GLX_DIRECT_COLOR; break;
          case PseudoColor:
-           *value_return = GLX_PSEUDO_COLOR_EXT; break;
+           *value_return = GLX_PSEUDO_COLOR; break;
          case StaticColor:
-           *value_return = GLX_STATIC_COLOR_EXT; break;
+           *value_return = GLX_STATIC_COLOR; break;
          case GrayScale:
-           *value_return = GLX_GRAY_SCALE_EXT;   break;
+           *value_return = GLX_GRAY_SCALE;   break;
          case StaticGray:
-           *value_return = GLX_STATIC_GRAY_EXT;  break;
+           *value_return = GLX_STATIC_GRAY;  break;
+         default:
+           *value_return = GLX_NONE;         break;
        }
        return Success;
       case GLX_VISUAL_CAVEAT_EXT:
@@ -1330,7 +1426,15 @@
                                                   screen, GLX_EXTENSIONS);
        }
 
-       psc->effectiveGLXexts = (char *) __glXGetUsableExtensions(psc->serverGLXexts);
+#ifdef GLX_DIRECT_RENDERING
+       psc->effectiveGLXexts = (char *) __glXGetUsableExtensions(psc->serverGLXexts,
+                                                                 
(priv->driDisplay.private != NULL),
+                                                                 priv->minorVersion);
+#else
+       psc->effectiveGLXexts = (char *) __glXGetUsableExtensions(psc->serverGLXexts,
+                                                                 GL_FALSE,
+                                                                 priv->minorVersion);
+#endif
     }
 
     return psc->effectiveGLXexts;
@@ -1638,9 +1742,8 @@
            void *shared = (shareList ?
                            shareList->driContext.private : NULL);
            gc->driContext.private =
-               (*psc->driScreen.createContext)(dpy, NULL, shared,
-                                               &gc->driContext,
-                                               fbconfig);
+               DriverCreateContextWrapper( psc, dpy, NULL, shared,
+                                           &gc->driContext, fbconfig );
            if (gc->driContext.private) {
                gc->isDirect = GL_TRUE;
                gc->screen = fbconfig->screen;
@@ -1720,10 +1823,10 @@
 }
 
 
-GLXDrawable glXGetCurrentReadDrawable(void)
+GLXDrawable GLX_PREFIX(glXGetCurrentReadDrawable)(void)
 {
     GLXContext gc = __glXGetCurrentContext();
-    return gc->currentDrawable;
+    return gc->currentReadable;
 }
 
 
@@ -1796,16 +1899,6 @@
 }
 
 
-Bool GLX_PREFIX(glXMakeContextCurrent)(Display *dpy, GLXDrawable draw, GLXDrawable 
read, GLXContext ctx)
-{
-    (void) dpy;
-    (void) draw;
-    (void) read;
-    (void) ctx;
-    return 0;
-}
-
-
 int GLX_PREFIX(glXQueryContext)(Display *dpy, GLXContext ctx, int attribute, int 
*value)
 {
     (void) dpy;
@@ -1833,6 +1926,7 @@
 }
 
 
+#if 0
 /*
 ** GLX_SGI_make_current_read
 */
@@ -1844,11 +1938,12 @@
    (void) ctx;
    return False;
 }
+#endif
 
 GLXDrawable glXGetCurrentReadDrawableSGI(void)
 {
     GLXContext gc = __glXGetCurrentContext();
-    return gc->currentDrawable;
+    return gc->currentReadable;
 }
 
 
@@ -1873,7 +1968,7 @@
 
 #ifdef GLX_DIRECT_RENDERING
    if ( gc->isDirect && __glXExtensionBitIsEnabled( SGI_swap_control_bit ) ) {
-      __DRIdrawable *pdraw = GetDRIDrawable( gc );
+      __DRIdrawable *pdraw = GetDRIDrawable( gc, gc->currentDrawable );
 
       if ( pdraw != NULL ) {
         pdraw->swap_interval = interval;
@@ -1913,7 +2008,7 @@
 {
 #ifdef GLX_DIRECT_RENDERING
    GLXContext gc = __glXGetCurrentContext();
-   __DRIdrawable *pdraw = GetDRIDrawable( gc );
+   __DRIdrawable *pdraw = GetDRIDrawable( gc, gc->currentDrawable );
 
    if ( pdraw == NULL ) {
       return GLX_BAD_CONTEXT;
@@ -1938,7 +2033,7 @@
 {
 #ifdef GLX_DIRECT_RENDERING
    GLXContext gc = __glXGetCurrentContext();
-   __DRIdrawable *pdraw = GetDRIDrawable( gc );
+   __DRIdrawable *pdraw = GetDRIDrawable( gc, gc->currentDrawable );
 
 
    if ( pdraw && __glXExtensionBitIsEnabled( MESA_swap_control_bit ) ) {
@@ -2026,7 +2121,7 @@
    int   status = GLX_BAD_CONTEXT;
 #ifdef GLX_DIRECT_RENDERING
     GLXContext gc = __glXGetCurrentContext();
-   __DRIdrawable *pdraw = GetDRIDrawable( gc );
+   __DRIdrawable *pdraw = GetDRIDrawable( gc, drawable );
 
    if ( (pdraw != NULL ) && (pdraw->queryFrameTracking != NULL)
        && __glXExtensionBitIsEnabled( MESA_swap_frame_usage_bit ) ) {
@@ -2053,7 +2148,7 @@
    int   status = GLX_BAD_CONTEXT;
 #ifdef GLX_DIRECT_RENDERING
     GLXContext gc = __glXGetCurrentContext();
-   __DRIdrawable *pdraw = GetDRIDrawable( gc );
+   __DRIdrawable *pdraw = GetDRIDrawable( gc, drawable );
 
    if ( (pdraw != NULL ) && (pdraw->queryFrameTracking != NULL)
        && __glXExtensionBitIsEnabled( MESA_swap_frame_usage_bit ) ) {
@@ -2112,7 +2207,7 @@
 {
 #ifdef GLX_DIRECT_RENDERING
    GLXContext gc = __glXGetCurrentContext();
-   __DRIdrawable *pdraw = GetDRIDrawable( gc );
+   __DRIdrawable *pdraw = GetDRIDrawable( gc, gc->currentDrawable );
 
    if ( divisor <= 0 || remainder < 0 )
      return GLX_BAD_VALUE;
@@ -2237,9 +2332,8 @@
                void *shared = (shareList ?
                                shareList->driContext.private : NULL);
                gc->driContext.private =
-                   (*psc->driScreen.createContext)(dpy, NULL, shared,
-                                                   &gc->driContext,
-                                                   fbconfig);
+               DriverCreateContextWrapper( psc, dpy, NULL, shared,
+                                           &gc->driContext, fbconfig );
                if (gc->driContext.private) {
                    gc->isDirect = GL_TRUE;
                    gc->screen = fbconfig->screen;
@@ -2598,7 +2692,7 @@
 {
 #ifdef GLX_DIRECT_RENDERING
    GLXContext gc = __glXGetCurrentContext();
-   __DRIdrawable *pdraw = GetDRIDrawable( gc );
+   __DRIdrawable *pdraw = GetDRIDrawable( gc, drawable );
 
    /* The OML_sync_control spec says these should "generate a GLX_BAD_VALUE
     * error", but it also says "It [glXSwapBuffersMscOML] will return a value
@@ -2632,7 +2726,7 @@
 {
 #ifdef GLX_DIRECT_RENDERING
    GLXContext gc = __glXGetCurrentContext();
-   __DRIdrawable *pdraw = GetDRIDrawable( gc );
+   __DRIdrawable *pdraw = GetDRIDrawable( gc, drawable );
    int  ret;
 
    /* The OML_sync_control spec says these should "generate a GLX_BAD_VALUE
@@ -2673,7 +2767,7 @@
 {
 #ifdef GLX_DIRECT_RENDERING
    GLXContext gc = __glXGetCurrentContext();
-   __DRIdrawable *pdraw = GetDRIDrawable( gc );
+   __DRIdrawable *pdraw = GetDRIDrawable( gc, drawable );
    int  ret;
 
    /* The OML_sync_control spec says this should "generate a GLX_BAD_VALUE
@@ -3159,8 +3253,9 @@
      *            GLX_MESA_swap_frame_usage, GLX_OML_swap_method,
      *            GLX_{ARB,SGIS}_multisample, and
      *            GLX_SGIX_visual_select_group.
+     * 20030606 - Added support for GLX_SGI_make_current_read.
      */
-    return 20030317;
+    return 20030606;
 }
 
 
Index: lib/GL/glx/glxext.c
===================================================================
RCS file: /cvsroot/dri/xc/xc/lib/GL/glx/glxext.c,v
retrieving revision 1.28
diff -u -d -r1.28 glxext.c
--- lib/GL/glx/glxext.c 13 May 2003 13:48:21 -0000      1.28
+++ lib/GL/glx/glxext.c 6 Jun 2003 21:26:07 -0000
@@ -674,12 +674,6 @@
            fb_req->reqType = priv->majorOpcode;
            fb_req->glxCode = X_GLXGetFBConfigs;
            fb_req->screen = i;
-           if (_XReply(dpy, (xReply*) &reply, 0, False)) {
-               /* Something is busted. Punt. */
-               UnlockDisplay(dpy);
-               FreeScreenConfigs(priv);
-               return GL_FALSE;
-           }
            break;
            
            case 2:
@@ -690,12 +684,6 @@
            sgi_req->glxCode = X_GLXVendorPrivateWithReply;
            sgi_req->vendorCode = X_GLXvop_GetFBConfigsSGIX;
            sgi_req->screen = i;
-           if (_XReply(dpy, (xReply*) &reply, 0, False)) {
-               /* Something is busted. Punt. */
-               UnlockDisplay(dpy);
-               FreeScreenConfigs(priv);
-               return GL_FALSE;
-           }
            break;
 
            case 3:
@@ -703,15 +691,16 @@
            req->reqType = priv->majorOpcode;
            req->glxCode = X_GLXGetVisualConfigs;
            req->screen = i;
-           if (!_XReply(dpy, (xReply*) &reply, 0, False)) {
-               /* Something is busted. Punt. */
-               UnlockDisplay(dpy);
-               FreeScreenConfigs(priv);
-               return GL_FALSE;
-           }
            break;
        }
 
+       if (!_XReply(dpy, (xReply*) &reply, 0, False)) {
+           /* Something is busted. Punt. */
+           UnlockDisplay(dpy);
+           FreeScreenConfigs(priv);
+           return GL_FALSE;
+       }
+
        UnlockDisplay(dpy);
        if (!reply.numVisuals) {
            /* This screen does not support GL rendering */
@@ -745,9 +734,11 @@
        }
 
        /* Allocate memory for the properties, if needed */
-       prop_size = (supported_request == 3)
-           ? nprops * __GLX_SIZE_INT32
-           : nprops * __GLX_SIZE_INT32 * 2;
+       if ( supported_request != 3 ) {
+           nprops *= 2;
+       }
+
+       prop_size = nprops * __GLX_SIZE_INT32;
 
        if (prop_size <= sizeof(buf)) {
            props = buf;
@@ -1091,17 +1082,81 @@
 
 /************************************************************************/
 
+static Bool SendMakeCurrentRequest( Display *dpy, CARD8 opcode,
+    GLXContextID gc, GLXContextTag old_gc, GLXDrawable draw, GLXDrawable read,
+    xGLXMakeCurrentReply * reply );
+
+static Bool SendMakeCurrentRequest( Display *dpy, CARD8 opcode,
+                                   GLXContextID gc_id, GLXContextTag gc_tag,
+                                   GLXDrawable draw, GLXDrawable read,
+                                   xGLXMakeCurrentReply * reply )
+{
+    opcode = __glXSetupForCommand(dpy);
+    if (!opcode) {
+       return GL_FALSE;
+    }
+
+    LockDisplay(dpy);
+    if ( draw == read ) {
+       xGLXMakeCurrentReq *req;
+
+       GetReq(GLXMakeCurrent,req);
+       req->reqType = opcode;
+       req->glxCode = X_GLXMakeCurrent;
+       req->drawable = draw;
+       req->context = gc_id;
+       req->oldContextTag = gc_tag;
+    }
+    else {
+       __GLXdisplayPrivate *priv = __glXInitialize(dpy);
+
+       /* If the server can support the GLX 1.3 version, we should
+        * perfer that.  Not only that, some servers support GLX 1.3 but
+        * not the SGI extension.
+        */
+
+       if ( (priv->majorVersion > 1) || (priv->minorVersion >= 3) ) {
+           xGLXMakeContextCurrentReq *req;
+
+           GetReq(GLXMakeContextCurrent,req);
+           req->reqType = opcode;
+           req->glxCode = X_GLXMakeContextCurrent;
+           req->drawable = draw;
+           req->readdrawable = read;
+           req->context = gc_id;
+           req->oldContextTag = gc_tag;
+       }
+       else {
+           xGLXVendorPrivateWithReplyReq *vpreq;
+           xGLXMakeCurrentReadSGIReq *req;
+
+           GetReqExtra(GLXVendorPrivateWithReply,
+                       
sz_xGLXMakeCurrentReadSGIReq-sz_xGLXVendorPrivateWithReplyReq,vpreq);
+           req = (xGLXMakeCurrentReadSGIReq *)vpreq;
+           req->reqType = opcode;
+           req->glxCode = X_GLXVendorPrivateWithReply;
+           req->vendorCode = X_GLXvop_MakeCurrentReadSGI;
+           req->drawable = draw;
+           req->readable = read;
+           req->context = gc_id;
+           req->oldContextTag = gc_tag;
+       }
+    }
+
+    return _XReply(dpy, (xReply*) reply, 0, False);
+}
+
+
 /*
 ** Make a particular context current.
 ** NOTE: this is in this file so that it can access dummyContext.
 */
-Bool GLX_PREFIX(glXMakeCurrent)(Display *dpy, GLXDrawable draw, GLXContext gc)
+Bool MakeContextCurrent(Display *dpy, GLXDrawable draw, GLXDrawable read,
+                       GLXContext gc)
 {
-    xGLXMakeCurrentReq *req;
     xGLXMakeCurrentReply reply;
     GLXContext oldGC;
     CARD8 opcode, oldOpcode;
-    Display *dpyTmp;
     Bool sentRequestToOldDpy = False;
     Bool bindReturnValue = True;
 
@@ -1109,6 +1164,7 @@
     if (!opcode) {
        return GL_FALSE;
     }
+
     /*
     ** Make sure that the new context has a nonzero ID.  In the request,
     ** a zero context ID is used only to mean that we bind to no current
@@ -1119,6 +1175,11 @@
     }
 
     oldGC = __glXGetCurrentContext();
+    oldOpcode = (gc == oldGC) ? opcode : __glXSetupForCommand(dpy);
+    if (!oldOpcode) {
+       return GL_FALSE;
+    }
+
     if ((dpy != oldGC->currentDpy || (gc && gc->isDirect)) &&
        !oldGC->isDirect && oldGC != &dummyContext) {
        /*
@@ -1129,35 +1190,15 @@
        ** unbind the previous context.
        */
        sentRequestToOldDpy = True;
-       dpyTmp = dpy;
-
-       if (dpy != oldGC->currentDpy) {
-           /*
-           ** The GetReq macro uses "dpy", so we have to save and
-           ** restore later.
-           */
-           dpy = oldGC->currentDpy;
-           oldOpcode = __glXSetupForCommand(dpy);
-           if (!oldOpcode) {
-               return GL_FALSE;
-           }
-       } else {
-           oldOpcode = opcode;
-       }
-       LockDisplay(dpy);
-       GetReq(GLXMakeCurrent,req);
-       req->reqType = oldOpcode;
-       req->glxCode = X_GLXMakeCurrent;
-       req->drawable = None;
-       req->context = None;
-       req->oldContextTag = oldGC->currentContextTag;
-       if (!_XReply(dpy, (xReply*) &reply, 0, False)) {
+       if ( ! SendMakeCurrentRequest( oldGC->currentDpy, oldOpcode, None,
+                                      oldGC->currentContextTag, None, None,
+                                      &reply ) ) {
            /* The make current failed.  Just return GL_FALSE. */
            UnlockDisplay(dpy);
            SyncHandle();
            return GL_FALSE;
        }
-       dpy = dpyTmp;
+
        oldGC->currentContextTag = 0;
     }
     
@@ -1165,13 +1206,11 @@
     /* Unbind the old direct rendering context */
     if (oldGC->isDirect) {
        if (oldGC->driContext.private) {
-           int will_rebind = (gc && gc->isDirect
-                              && draw == oldGC->currentDrawable);
-           if (!(*oldGC->driContext.unbindContext)(oldGC->currentDpy,
-                                                   oldGC->screen,
-                                                   oldGC->currentDrawable,
-                                                   oldGC,
-                                                   will_rebind)) {
+           if (!(*oldGC->driContext.unbindContext2)(oldGC->currentDpy,
+                                                    oldGC->screen,
+                                                    oldGC->currentDrawable,
+                                                    oldGC->currentReadable,
+                                                    oldGC)) {
                /* The make current failed.  Just return GL_FALSE. */
                return GL_FALSE;
            }
@@ -1183,21 +1222,18 @@
     if (gc && gc->isDirect) {
        if (gc->driContext.private) {
            bindReturnValue =
-               (*gc->driContext.bindContext)(dpy, gc->screen, draw, gc);
+               (*gc->driContext.bindContext2)(dpy, gc->screen, draw, read, gc);
        }
     } else {
 #endif
         _glapi_check_multithread();
        /* Send a glXMakeCurrent request to bind the new context. */
        LockDisplay(dpy);
-       GetReq(GLXMakeCurrent,req);
-       req->reqType = opcode;
-       req->glxCode = X_GLXMakeCurrent;
-       req->drawable = draw;
-       req->context = gc ? gc->xid : None;
-       req->oldContextTag = oldGC->currentContextTag;
-       bindReturnValue = _XReply(dpy, (xReply*) &reply, 0, False);
-        UnlockDisplay(dpy);
+
+       bindReturnValue = SendMakeCurrentRequest( dpy, opcode, 
+                                                 gc ? gc->xid : None,
+                                                 oldGC->currentContextTag,
+                                                 draw, read, &reply );
 #ifdef GLX_DIRECT_RENDERING
     }
 #endif
@@ -1213,10 +1249,11 @@
        /* If the old context was direct rendering, then re-bind to it. */
        if (oldGC->isDirect) {
            if (oldGC->driContext.private) {
-               if (!(*oldGC->driContext.bindContext)(oldGC->currentDpy,
-                                                     oldGC->screen,
-                                                     oldGC->currentDrawable,
-                                                     oldGC)) {
+               if (!(*oldGC->driContext.bindContext2)(oldGC->currentDpy,
+                                                      oldGC->screen,
+                                                      oldGC->currentDrawable,
+                                                      oldGC->currentReadable,
+                                                      oldGC)) {
                    /*
                    ** The request failed; this cannot happen with the
                    ** current API.  If in the future the API is
@@ -1237,20 +1274,10 @@
        ** drawable.
        */
        if (sentRequestToOldDpy) {
-           if (dpy != oldGC->currentDpy) {
-               dpy = oldGC->currentDpy;
-               oldOpcode = __glXSetupForCommand(dpy);
-           } else {
-               oldOpcode = opcode;
-           }
-           LockDisplay(dpy);
-           GetReq(GLXMakeCurrent,req);
-           req->reqType = oldOpcode;
-           req->glxCode = X_GLXMakeCurrent;
-           req->drawable = oldGC->currentDrawable;
-           req->context = oldGC->xid;
-           req->oldContextTag = 0;
-           if (!_XReply(dpy, (xReply*) &reply, 0, False)) {
+           if ( !SendMakeCurrentRequest( oldGC->currentDpy, oldOpcode,
+                                         oldGC->xid, 0, 
+                                         oldGC->currentDrawable,
+                                         oldGC->currentReadable, &reply ) ) {
                UnlockDisplay(dpy);
                SyncHandle();
                /*
@@ -1280,11 +1307,13 @@
        ** NULL and not the dummy.
        */
        gc->currentDrawable = draw;
+       gc->currentReadable = read;
     } else {
        if (oldGC != &dummyContext) {
            /* Old current context is no longer current to anybody */
            oldGC->currentDpy = 0;
            oldGC->currentDrawable = None;
+           oldGC->currentReadable = None;
            oldGC->currentContextTag = 0;
 
            if (oldGC->xid == None) {
@@ -1322,6 +1351,7 @@
 #endif
            gc->currentDpy = dpy;
            gc->currentDrawable = draw;
+           gc->currentReadable = read;
 #ifdef GLX_DIRECT_RENDERING
            if (gc->isDirect) reply.contextTag = -1;
 #endif
@@ -1336,6 +1366,23 @@
     __glXUnlock();
     return GL_TRUE;
 }
+
+
+Bool GLX_PREFIX(glXMakeCurrent)(Display *dpy, GLXDrawable draw, GLXContext gc)
+{
+    return MakeContextCurrent( dpy, draw, draw, gc );
+}
+
+Bool GLX_PREFIX(glXMakeCurrentReadSGI)(Display *dpy, GLXDrawable draw, GLXDrawable 
read, GLXContext gc)
+{
+    return MakeContextCurrent( dpy, draw, read, gc );
+}
+
+Bool GLX_PREFIX(glXMakeContextCurrent)(Display *dpy, GLXDrawable draw, GLXDrawable 
read, GLXContext gc)
+{
+    return MakeContextCurrent( dpy, draw, read, gc );
+}
+
 
 #ifdef DEBUG
 void __glXDumpDrawBuffer(__GLXcontext *ctx)
Index: lib/GL/glx/glxextensions.c
===================================================================
RCS file: /cvsroot/dri/xc/xc/lib/GL/glx/glxextensions.c,v
retrieving revision 1.3
diff -u -d -r1.3 glxextensions.c
--- lib/GL/glx/glxextensions.c  3 May 2003 05:19:30 -0000       1.3
+++ lib/GL/glx/glxextensions.c  6 Jun 2003 21:26:07 -0000
@@ -98,7 +98,7 @@
    { GLX(OML_swap_method),             VER(0,0), Y, N, N, N },
    { GLX(OML_sync_control),            VER(0,0), Y, N, N, Y },
    { GLX(SGI_cushion),                 VER(0,0), N, N, N, N },
-   { GLX(SGI_make_current_read),       VER(1,3), N, N, N, N },
+   { GLX(SGI_make_current_read),       VER(1,3), Y, N, N, N },
    { GLX(SGI_swap_control),            VER(0,0), Y, N, N, N },
    { GLX(SGI_video_sync),              VER(0,0), Y, N, N, Y },
    { GLX(SGIS_blended_overlay),        VER(0,0), N, N, N, N },
@@ -448,10 +448,16 @@
 /**
  * Get the list of application usable extensions.
  * 
+ * \param server_string              GLX extension string supplied by 
+ *                                   the X-server
+ * \param display_is_direct_capable  True if the display is capable of
+ *                                   direct rendering.
  * \returns A pointer to the string.
  */
 char *
-__glXGetUsableExtensions( const char * server_string )
+__glXGetUsableExtensions( const char * server_string,
+                         GLboolean display_is_direct_capable,
+                         int minor_version )
 {
    unsigned char server_support[8];
    unsigned char usable[8];
@@ -460,15 +466,35 @@
    __glXExtensionsCtr();
    __glXProcessServerString( server_string, server_support );
 
+
+   /* This is a hack.  Some servers support GLX 1.3 but don't export
+    * SGI_make_current_read.  This libGL supports SGI_make_current_read but
+    * doesn't have full GLX 1.3 support.  Until GLX 1.3 is fully supported
+    * this hack is done to export the functionality to applications.
+    */
+
+   if ( minor_version >= 3 ) {
+      SET_BIT( server_support, SGI_make_current_read_bit );
+   }
+
+
    /* An extension is supported if the client-side (i.e., libGL) supports
     * it and the "server" supports it.  In this case that means that either
     * the true server supports it or it is only for direct-rendering and
     * the direct rendering driver supports it.
     */
-   for ( i = 0 ; i < 8 ; i++ ) {
-      usable[i] = (client_support[i] & client_only[i])
-         | (client_support[i] & (direct_support[i] & server_support[i]))
-         | (client_support[i] & (direct_support[i] & direct_only[i]));
+   if ( display_is_direct_capable ) {
+      for ( i = 0 ; i < 8 ; i++ ) {
+        usable[i] = (client_support[i] & client_only[i])
+            | (client_support[i] & (direct_support[i] & server_support[i]))
+            | (client_support[i] & (direct_support[i] & direct_only[i]));
+      }
+   }
+   else {
+      for ( i = 0 ; i < 8 ; i++ ) {
+        usable[i] = (client_support[i] & client_only[i])
+            | (client_support[i] & server_support[i]);
+      }
    }
 
    return __glXGetStringFromTable( usable );
Index: lib/GL/glx/glxextensions.h
===================================================================
RCS file: /cvsroot/dri/xc/xc/lib/GL/glx/glxextensions.h,v
retrieving revision 1.2
diff -u -d -r1.2 glxextensions.h
--- lib/GL/glx/glxextensions.h  30 Apr 2003 01:50:35 -0000      1.2
+++ lib/GL/glx/glxextensions.h  6 Jun 2003 21:26:07 -0000
@@ -71,7 +71,8 @@
 
 extern GLboolean __glXExtensionBitIsEnabled( unsigned bit );
 extern const char * __glXGetClientExtensions( void );
-extern char * __glXGetUsableExtensions( const char * server_string );
+extern char * __glXGetUsableExtensions( const char * server_string,
+    GLboolean display_is_direct_capable, int server_minor_version );
 extern void __glXAddExtension( GLboolean enabled, const char * name,
     GLboolean client_side );
 extern void __glXEnableExtension( const char * name, GLboolean force_client );
Index: lib/GL/glx/pixel.c
===================================================================
RCS file: /cvsroot/dri/xc/xc/lib/GL/glx/pixel.c,v
retrieving revision 1.10
diff -u -d -r1.10 pixel.c
--- lib/GL/glx/pixel.c  25 Mar 2003 12:53:44 -0000      1.10
+++ lib/GL/glx/pixel.c  6 Jun 2003 21:26:07 -0000
@@ -79,120 +79,6 @@
     0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff,
 };
 
-/*
-** Return the number of elements per group of a specified format
-*/
-static GLint ElementsPerGroup(GLenum format, GLenum type) 
-{
-    /*
-    ** To make row length computation valid for image extraction,
-    ** packed pixel types assume elements per group equals one.
-    */
-    switch(type) {
-    case GL_UNSIGNED_BYTE_3_3_2:
-    case GL_UNSIGNED_BYTE_2_3_3_REV:
-    case GL_UNSIGNED_SHORT_5_6_5:
-    case GL_UNSIGNED_SHORT_5_6_5_REV:
-    case GL_UNSIGNED_SHORT_4_4_4_4:
-    case GL_UNSIGNED_SHORT_4_4_4_4_REV:
-    case GL_UNSIGNED_SHORT_5_5_5_1:
-    case GL_UNSIGNED_SHORT_1_5_5_5_REV:
-    case GL_UNSIGNED_INT_8_8_8_8:
-    case GL_UNSIGNED_INT_8_8_8_8_REV:
-    case GL_UNSIGNED_INT_10_10_10_2:
-    case GL_UNSIGNED_INT_2_10_10_10_REV:
-      return 1;
-    default:
-      break;
-    }
-
-    switch(format) {
-      case GL_RGB:
-      case GL_BGR:
-       return 3;
-      case GL_LUMINANCE_ALPHA:
-       return 2;
-      case GL_RGBA:
-      case GL_BGRA:
-      case GL_ABGR_EXT:
-       return 4;
-      case GL_COLOR_INDEX:
-      case GL_STENCIL_INDEX:
-      case GL_DEPTH_COMPONENT:
-      case GL_RED:
-      case GL_GREEN:
-      case GL_BLUE:
-      case GL_ALPHA:
-      case GL_LUMINANCE:
-      case GL_INTENSITY:
-       return 1;
-      default:
-       return 0;
-    }
-}
-
-/*
-** Return the number of bytes per element, based on the element type (other
-** than GL_BITMAP).
-*/
-static GLint BytesPerElement(GLenum type) 
-{
-    switch(type) {
-      case GL_UNSIGNED_SHORT:
-      case GL_SHORT:
-      case GL_UNSIGNED_SHORT_5_6_5:
-      case GL_UNSIGNED_SHORT_5_6_5_REV:
-      case GL_UNSIGNED_SHORT_4_4_4_4:
-      case GL_UNSIGNED_SHORT_4_4_4_4_REV:
-      case GL_UNSIGNED_SHORT_5_5_5_1:
-      case GL_UNSIGNED_SHORT_1_5_5_5_REV:
-       return 2;
-      case GL_UNSIGNED_BYTE:
-      case GL_BYTE:
-      case GL_UNSIGNED_BYTE_3_3_2:
-      case GL_UNSIGNED_BYTE_2_3_3_REV:
-       return 1;
-      case GL_INT:
-      case GL_UNSIGNED_INT:
-      case GL_FLOAT:
-      case GL_UNSIGNED_INT_8_8_8_8:
-      case GL_UNSIGNED_INT_8_8_8_8_REV:
-      case GL_UNSIGNED_INT_10_10_10_2:
-      case GL_UNSIGNED_INT_2_10_10_10_REV:
-       return 4;
-      default:
-       return 0;
-    }
-}
-
-/*
-** Compute memory required for internal packed array of data of given type
-** and format.
-*/
-GLint __glImageSize(GLsizei width, GLsizei height, GLsizei depth,
-                   GLenum format, GLenum type) 
-{
-    int bytes_per_row;
-    int components;
-
-    if (width < 0 || height < 0 || depth < 0) {
-       return 0;
-    }
-    /*
-    ** Zero is returned if either format or type are invalid.
-    */
-    components = ElementsPerGroup(format,type);
-    if (type == GL_BITMAP) {
-       if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) {
-           bytes_per_row = (width + 7) >> 3;
-       } else {
-           return 0;
-       }
-    } else {
-       bytes_per_row = BytesPerElement(type) * width;
-    }
-    return bytes_per_row * height * depth * components;
-}
 
 /*
 ** Copy bitmap data from clients packed memory applying unpacking modes as the
@@ -218,7 +104,7 @@
     } else {
        groupsPerRow = width;
     }
-    components = ElementsPerGroup(format,GL_BITMAP);
+    components = __glElementsPerGroup(format,GL_BITMAP);
     rowSize = (groupsPerRow * components + 7) >> 3;
     padding = (rowSize % alignment);
     if (padding) {
@@ -294,7 +180,7 @@
     if (type == GL_BITMAP) {
        FillBitmap(gc, width, height, format, userdata, newimage);
     } else {
-       components = ElementsPerGroup(format,type);
+       components = __glElementsPerGroup(format,type);
        if (rowLength > 0) {
            groupsPerRow = rowLength;
        } else {
@@ -306,7 +192,7 @@
            rowsPerImage = height;
        }
 
-       elementSize = BytesPerElement(type);
+       elementSize = __glBytesPerElement(type);
        groupSize = elementSize * components;
        if (elementSize == 1) swapBytes = 0;
 
@@ -409,7 +295,7 @@
     GLint writeMask, i;
     GLubyte writeByte;
 
-    components = ElementsPerGroup(format,GL_BITMAP);
+    components = __glElementsPerGroup(format,GL_BITMAP);
     if (rowLength > 0) {
        groupsPerRow = rowLength;
     } else {
@@ -522,7 +408,7 @@
     if (type == GL_BITMAP) {
        EmptyBitmap(gc, width, height, format, sourceImage, userdata);
     } else {
-       components = ElementsPerGroup(format,type);
+       components = __glElementsPerGroup(format,type);
        if (rowLength > 0) {
            groupsPerRow = rowLength;
        } else {
@@ -533,7 +419,7 @@
        } else {
            rowsPerImage = height;
        }
-       elementSize = BytesPerElement(type);
+       elementSize = __glBytesPerElement(type);
        groupSize = elementSize * components;
        rowSize = groupsPerRow * groupSize;
        padding = (rowSize % alignment);
Index: lib/GL/glx/render2.c
===================================================================
RCS file: /cvsroot/dri/xc/xc/lib/GL/glx/render2.c,v
retrieving revision 1.5
diff -u -d -r1.5 render2.c
--- lib/GL/glx/render2.c        30 Apr 2003 01:50:36 -0000      1.5
+++ lib/GL/glx/render2.c        6 Jun 2003 21:26:07 -0000
@@ -426,28 +426,6 @@
     __GLX_LOAD_VARIABLES();
     if (!gc->currentDpy) return;
 
-    switch (cap) {
-#if 0
-      case GL_VERTEX_ARRAY_EXT:
-         gc->state.vertArray.vertex.enable = GL_TRUE;
-         return;
-      case GL_NORMAL_ARRAY_EXT:
-         gc->state.vertArray.normal.enable = GL_TRUE;
-         return;
-      case GL_COLOR_ARRAY_EXT:
-         gc->state.vertArray.color.enable = GL_TRUE;
-         return;
-      case GL_INDEX_ARRAY_EXT:
-         gc->state.vertArray.index.enable = GL_TRUE;
-         return;
-      case GL_TEXTURE_COORD_ARRAY_EXT:
-         gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].enable = 
GL_TRUE;
-         return;
-      case GL_EDGE_FLAG_ARRAY_EXT:
-         gc->state.vertArray.edgeFlag.enable = GL_TRUE;
-         return;
-#endif
-    }
     __GLX_BEGIN(X_GLrop_Enable,8);
     __GLX_PUT_LONG(4,cap);
     __GLX_END(8);
@@ -460,28 +438,6 @@
     __GLX_LOAD_VARIABLES();
     if (!gc->currentDpy) return;
 
-    switch (cap) {
-#if 0
-      case GL_VERTEX_ARRAY_EXT:
-         gc->state.vertArray.vertex.enable = GL_FALSE;
-         return;
-      case GL_NORMAL_ARRAY_EXT:
-         gc->state.vertArray.normal.enable = GL_FALSE;
-         return;
-      case GL_COLOR_ARRAY_EXT:
-         gc->state.vertArray.color.enable = GL_FALSE;
-         return;
-      case GL_INDEX_ARRAY_EXT:
-         gc->state.vertArray.index.enable = GL_FALSE;
-         return;
-      case GL_TEXTURE_COORD_ARRAY_EXT:
-         gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].enable = 
GL_FALSE;
-         return;
-      case GL_EDGE_FLAG_ARRAY_EXT:
-         gc->state.vertArray.edgeFlag.enable = GL_FALSE;
-         return;
-#endif
-    }
     __GLX_BEGIN(X_GLrop_Disable,8);
     __GLX_PUT_LONG(4,cap);
     __GLX_END(8);
Index: lib/GL/dri/dri_util.c
===================================================================
RCS file: /cvsroot/dri/xc/xc/lib/GL/dri/dri_util.c,v
retrieving revision 1.14
diff -u -d -r1.14 dri_util.c
--- lib/GL/dri/dri_util.c       26 May 2003 22:10:49 -0000      1.14
+++ lib/GL/dri/dri_util.c       6 Jun 2003 21:26:10 -0000
@@ -259,9 +259,9 @@
  * 
  * \param dpy the display handle.
  * \param scrn the screen number.
- * \param draw drawable.
+ * \param draw Current drawing drawable.
+ * \param draw Current reading drawable.
  * \param gc context.
- * \param will_rebind not used.
  *
  * \return GL_TRUE on success, or GL_FALSE on failure.
  * 
@@ -270,25 +270,27 @@
  * __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 null. 
+ * While casting the opaque private pointers associated with the parameters
+ * into their respective real types it also assures they are not null. 
  */
-static Bool driUnbindContext(Display *dpy, int scrn,
-                             GLXDrawable draw, GLXContext gc,
-                             int will_rebind)
+static Bool driUnbindContext2(Display *dpy, int scrn,
+                             GLXDrawable draw, GLXDrawable read,
+                             GLXContext gc)
 {
     __DRIscreen *pDRIScreen;
     __DRIdrawable *pdraw;
+    __DRIdrawable *pread;
     __DRIcontextPrivate *pcp;
     __DRIscreenPrivate *psp;
     __DRIdrawablePrivate *pdp;
+    __DRIdrawablePrivate *prp;
 
     /*
     ** Assume error checking is done properly in glXMakeCurrent before
-    ** calling driUnbindContext.
+    ** calling driUnbindContext2.
     */
 
-    if (gc == NULL || draw == None) {
+    if (gc == NULL || draw == None || read == None) {
        /* ERROR!!! */
        return GL_FALSE;
     }
@@ -310,25 +312,37 @@
     }
     pdp = (__DRIdrawablePrivate *)pdraw->private;
 
-                               /* Don't leave fullscreen mode if the
-                                   drawable will be rebound in the next
-                                   step -- this avoids a protocol
-                                   request. */
-    if (!will_rebind && psp->fullscreen) {
-       psp->DriverAPI.CloseFullScreen(pcp);
-       XF86DRICloseFullScreen(dpy, scrn, draw);
-       psp->fullscreen = NULL;
+    pread = __driFindDrawable(psp->drawHash, read);
+    if (!pread) {
+       /* ERROR!!! */
+       return GL_FALSE;
     }
+    prp = (__DRIdrawablePrivate *)pread->private;
+
 
     /* Let driver unbind drawable from context */
     (*psp->DriverAPI.UnbindContext)(pcp);
 
+
     if (pdp->refcount == 0) {
        /* ERROR!!! */
        return GL_FALSE;
-    } else if (--pdp->refcount == 0) {
+    }
+
+    pdp->refcount--;
+
+    if (prp != pdp) {
+        if (prp->refcount == 0) {
+           /* ERROR!!! */
+           return GL_FALSE;
+       }
+
+       prp->refcount--;
+    }
+
 #if 0
-       /*
+    if (pdp->refcount == 0) {  
+        /*
        ** NOT_DONE: When a drawable is unbound from one direct
        ** rendering context and then bound to another, we do not want
        ** to destroy the drawable data structure each time only to
@@ -351,8 +365,8 @@
        __driRemoveDrawable(psp->drawHash, pdraw);
        (*pdraw->destroyDrawable)(dpy, pdraw->private);
        Xfree(pdraw);
-#endif
     }
+#endif
 
     /* XXX this is disabled so that if we call SwapBuffers on an unbound
      * window we can determine the last context bound to the window and
@@ -384,8 +398,6 @@
     __DRIdrawablePrivate *prp;
     __DRIscreenPrivate *psp;
     __DRIcontextPrivate *pcp;
-    static Bool envchecked      = False;
-    static Bool checkfullscreen = False;
 
     /*
     ** Assume error checking is done properly in glXMakeCurrent before
@@ -490,75 +502,19 @@
     /* Call device-specific MakeCurrent */
     (*psp->DriverAPI.MakeCurrent)(pcp, pdp, prp);
 
-    /* Check for the potential to enter an automatic full-screen mode.
-       This may need to be moved up. */
-    if (!envchecked) {
-       checkfullscreen = driFeatureOn("LIBGL_DRI_AUTOFULLSCREEN");
-       envchecked = GL_TRUE;
-    }
-    if (checkfullscreen && pdp->numClipRects == 1) {
-       /* If there is valid information in the SAREA, we can use it to
-       avoid a protocol request.  The only time when the SAREA
-       information won't be valid will be initially, so in the worst
-       case, we'll make one protocol request that we could have
-       avoided. */
-       int try = 1;
-       int clw = pdp->pClipRects[0].x2 - pdp->pClipRects[0].x1;
-       int clh = pdp->pClipRects[0].y2 - pdp->pClipRects[0].y1;
-
-#if 0
-                               /* Useful client-side debugging message */
-       fprintf(stderr,
-               "********************************************\n"
-               "********************************************\n"
-               "********************************************\n"
-               "%d @ %d,%d,%d,%d\n"
-               "frame %d,%d,%d,%d\n"
-               "win   %d,%d,%d,%d\n"
-               "fs = %p pdp = %p sarea = %d\n"
-               "********************************************\n"
-               "********************************************\n"
-               "********************************************\n",
-               pdp->numClipRects,
-               pdp->pClipRects[0].x1,
-               pdp->pClipRects[0].y1,
-               pdp->pClipRects[0].x2,
-               pdp->pClipRects[0].y2,
-               psp->pSAREA->frame.x,
-               psp->pSAREA->frame.y,
-               psp->pSAREA->frame.width,
-               psp->pSAREA->frame.height,
-               pdp->x, pdp->y, pdp->w, pdp->h,
-               psp->fullscreen, pdp, psp->pSAREA->frame.fullscreen);
-#endif
-
-
-       if (pdp->x != pdp->pClipRects[0].x1
-           || pdp->y != pdp->pClipRects[0].y1
-           || pdp->w != clw
-           || pdp->h != clh) try = 0;
+    return GL_TRUE;
+}
 
-       if (try && psp->pSAREA->frame.width && psp->pSAREA->frame.height) {
-           if (pdp->x != psp->pSAREA->frame.x
-               || pdp->y != psp->pSAREA->frame.y
-               || pdp->w != psp->pSAREA->frame.width
-               || pdp->h != psp->pSAREA->frame.height) try = 0;
-       }
 
-       if (try) {
-           if (psp->fullscreen && !psp->pSAREA->frame.fullscreen) {
-                               /* Server has closed fullscreen mode */
-               __driUtilMessage("server closed fullscreen mode\n");
-               psp->fullscreen = NULL;
-           }
-           if (XF86DRIOpenFullScreen(dpy, scrn, draw)) {
-               psp->fullscreen = pdp;
-               psp->DriverAPI.OpenFullScreen(pcp);
-           }
-       }
-    }
-
-    return GL_TRUE;
+/*
+ * Simply call bind with the same GLXDrawable for the read and draw buffers.
+ */
+static Bool driUnbindContext(Display *dpy, int scrn,
+                             GLXDrawable draw, GLXContext gc,
+                             int will_rebind)
+{
+   (void) will_rebind;
+   return driUnbindContext2( dpy, scrn, draw, draw, gc );
 }
 
 
Index: programs/Xserver/GL/glx/glxscreens.c
===================================================================
RCS file: /cvsroot/dri/xc/xc/programs/Xserver/GL/glx/glxscreens.c,v
retrieving revision 1.11
diff -u -d -r1.11 glxscreens.c
--- programs/Xserver/GL/glx/glxscreens.c        30 Apr 2003 01:50:58 -0000      1.11
+++ programs/Xserver/GL/glx/glxscreens.c        6 Jun 2003 21:26:13 -0000
@@ -69,6 +69,7 @@
                        "GL_EXT_blend_logic_op "
                        "GL_EXT_blend_minmax "
                        "GL_EXT_blend_subtract "
+                       "GL_EXT_clip_volume_hint "
                        "GL_EXT_copy_texture "
                        "GL_EXT_draw_range_elements "
                        "GL_EXT_fog_coord "
@@ -78,22 +79,38 @@
                        "GL_EXT_rescale_normal "
                        "GL_EXT_secondary_color "
                        "GL_EXT_separate_specular_color "
+                       "GL_EXT_shadow_funcs "
                        "GL_EXT_stencil_two_side "
                        "GL_EXT_stencil_wrap "
                        "GL_EXT_subtexture "
                        "GL_EXT_texture "
                        "GL_EXT_texture3D "
+                       "GL_EXT_texture_edge_clamp "
                        "GL_EXT_texture_env_add "
                        "GL_EXT_texture_env_combine "
                        "GL_EXT_texture_env_dot3 "
+                       "GL_EXT_texture_lod "
                        "GL_EXT_texture_lod_bias "
                        "GL_EXT_texture_object "
+                       "GL_EXT_texture_rectangle "
                        "GL_EXT_vertex_array "
+                       "GL_APPLE_packed_pixels "
+                       "GL_ATI_texture_mirror_once "
+                       "GL_ATI_texture_env_combine3 "
+                       "GL_HP_occlusion_test "
                        "GL_IBM_texture_mirrored_repeat "
+                       "GL_MESA_pack_invert "
+                       "GL_MESA_ycbcr_texture "
                        "GL_NV_blend_square "
+                       "GL_NV_texgen_reflection "
+                       "GL_NV_texture_rectangle "
+                       "GL_SGIS_generate_mipmap "
                        "GL_SGIS_texture_border_clamp "
                        "GL_SGIS_texture_edge_clamp "
-                       "GL_SGIS_generate_mipmap "
+                       "GL_SGIS_texture_lod "
+                       "GL_SGIX_depth_texture "
+                       "GL_SGIX_shadow "
+                       "GL_SGIX_shadow_ambient "
                        ;
 
 /*
Index: programs/Xserver/GL/glx/rensize.c
===================================================================
RCS file: /cvsroot/dri/xc/xc/programs/Xserver/GL/glx/rensize.c,v
retrieving revision 1.7
diff -u -d -r1.7 rensize.c
--- programs/Xserver/GL/glx/rensize.c   25 Nov 2002 19:58:40 -0000      1.7
+++ programs/Xserver/GL/glx/rensize.c   6 Jun 2003 21:26:13 -0000
@@ -267,109 +267,8 @@
 int __glXImageSize( GLenum format, GLenum type, GLsizei w, GLsizei h,
               GLint rowLength, GLint skipRows, GLint alignment )
 {
-    GLint bytesPerElement, elementsPerGroup, groupsPerRow;
-    GLint groupSize, rowSize, padding;
-
-    if (w < 0 || h < 0 ||
-       (type == GL_BITMAP &&
-        (format != GL_COLOR_INDEX && format != GL_STENCIL_INDEX))) {
-       return -1;
-    }
-    if (w==0 || h==0) return 0;
-
-    if (type == GL_BITMAP) {
-       if (rowLength > 0) {
-           groupsPerRow = rowLength;
-       } else {
-           groupsPerRow = w;
-       }
-       rowSize = (groupsPerRow + 7) >> 3;
-       padding = (rowSize % alignment);
-       if (padding) {
-           rowSize += alignment - padding;
-       }
-       return ((h + skipRows) * rowSize);
-    } else {
-       switch(format) {
-         case GL_COLOR_INDEX:
-         case GL_STENCIL_INDEX:
-         case GL_DEPTH_COMPONENT:
-           elementsPerGroup = 1;
-           break;
-         case GL_RED:
-         case GL_GREEN:
-         case GL_BLUE:
-         case GL_ALPHA:
-         case GL_LUMINANCE:
-         case GL_INTENSITY:
-           elementsPerGroup = 1;
-           break;
-         case GL_LUMINANCE_ALPHA:
-           elementsPerGroup = 2;
-           break;
-         case GL_RGB:
-         case GL_BGR:
-           elementsPerGroup = 3;
-           break;
-         case GL_RGBA:
-         case GL_BGRA:
-         case GL_ABGR_EXT:
-           elementsPerGroup = 4;
-           break;
-         default:
-           return -1;
-       }
-       switch(type) {
-         case GL_UNSIGNED_BYTE:
-         case GL_BYTE:
-           bytesPerElement = 1;
-           break;
-         case GL_UNSIGNED_BYTE_3_3_2:
-         case GL_UNSIGNED_BYTE_2_3_3_REV:
-           bytesPerElement = 1;            
-           elementsPerGroup = 1;
-           break;
-         case GL_UNSIGNED_SHORT:
-         case GL_SHORT:
-           bytesPerElement = 2;
-           break;
-         case GL_UNSIGNED_SHORT_5_6_5:
-         case GL_UNSIGNED_SHORT_5_6_5_REV:
-         case GL_UNSIGNED_SHORT_4_4_4_4:
-         case GL_UNSIGNED_SHORT_4_4_4_4_REV:
-         case GL_UNSIGNED_SHORT_5_5_5_1:
-         case GL_UNSIGNED_SHORT_1_5_5_5_REV:
-           bytesPerElement = 2;
-           elementsPerGroup = 1;
-           break;
-         case GL_INT:
-         case GL_UNSIGNED_INT:
-         case GL_FLOAT:
-           bytesPerElement = 4;
-           break;
-         case GL_UNSIGNED_INT_8_8_8_8:
-         case GL_UNSIGNED_INT_8_8_8_8_REV:
-         case GL_UNSIGNED_INT_10_10_10_2:
-         case GL_UNSIGNED_INT_2_10_10_10_REV:
-           bytesPerElement = 4;
-           elementsPerGroup = 1;
-           break;
-         default:
-           return -1;
-       }
-       groupSize = bytesPerElement * elementsPerGroup;
-       if (rowLength > 0) {
-           groupsPerRow = rowLength;
-       } else {
-           groupsPerRow = w;
-       }
-       rowSize = groupsPerRow * groupSize;
-       padding = (rowSize % alignment);
-       if (padding) {
-           rowSize += alignment - padding;
-       }
-       return ((h + skipRows) * rowSize);
-    }
+    return __glXImage3DSize( format, type, w, h, 1, 0, rowLength,
+                            0, skipRows, alignment );
 }
 
 /* XXX
@@ -406,8 +305,6 @@
          case GL_COLOR_INDEX:
          case GL_STENCIL_INDEX:
          case GL_DEPTH_COMPONENT:
-           elementsPerGroup = 1;
-           break;
          case GL_RED:
          case GL_GREEN:
          case GL_BLUE:
@@ -416,6 +313,13 @@
          case GL_INTENSITY:
            elementsPerGroup = 1;
            break;
+         case GL_422_EXT:
+         case GL_422_REV_EXT:
+         case GL_422_AVERAGE_EXT:
+         case GL_422_REV_AVERAGE_EXT:
+         case GL_DEPTH_STENCIL_NV:
+         case GL_DEPTH_STENCIL_MESA:
+         case GL_YCBCR_MESA:
          case GL_LUMINANCE_ALPHA:
            elementsPerGroup = 2;
            break;
@@ -451,6 +355,10 @@
          case GL_UNSIGNED_SHORT_4_4_4_4_REV:
          case GL_UNSIGNED_SHORT_5_5_5_1:
          case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+         case GL_UNSIGNED_SHORT_8_8_APPLE:
+         case GL_UNSIGNED_SHORT_8_8_REV_APPLE:
+         case GL_UNSIGNED_SHORT_15_1_MESA:
+         case GL_UNSIGNED_SHORT_1_15_REV_MESA:
            bytesPerElement = 2;
            elementsPerGroup = 1;
            break;
@@ -463,6 +371,9 @@
          case GL_UNSIGNED_INT_8_8_8_8_REV:
          case GL_UNSIGNED_INT_10_10_10_2:
          case GL_UNSIGNED_INT_2_10_10_10_REV:
+         case GL_UNSIGNED_INT_24_8_NV:
+         case GL_UNSIGNED_INT_24_8_MESA:
+         case GL_UNSIGNED_INT_8_24_REV_MESA:
            bytesPerElement = 4;
            elementsPerGroup = 1;
            break;
Index: programs/Xserver/GL/glx/singlesize.c
===================================================================
RCS file: /cvsroot/dri/xc/xc/programs/Xserver/GL/glx/singlesize.c,v
retrieving revision 1.6
diff -u -d -r1.6 singlesize.c
--- programs/Xserver/GL/glx/singlesize.c        25 Nov 2002 19:58:41 -0000      1.6
+++ programs/Xserver/GL/glx/singlesize.c        6 Jun 2003 21:26:13 -0000
@@ -46,101 +46,7 @@
 
 GLint __glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h)
 {
-    GLint elements, esize;
-    GLint rowsize, padding;
-
-    if (w < 0 || h < 0) {
-       return -1;
-    }
-    switch (format) {
-      case GL_COLOR_INDEX:
-      case GL_STENCIL_INDEX:
-      case GL_DEPTH_COMPONENT:
-       elements = 1;
-       break;
-      case GL_RED:
-      case GL_GREEN:
-      case GL_BLUE:
-      case GL_ALPHA:
-      case GL_LUMINANCE:
-      case GL_INTENSITY:
-       elements = 1;
-       break;
-      case GL_LUMINANCE_ALPHA:
-       elements = 2;
-       break;
-      case GL_RGB:
-      case GL_BGR:
-       elements = 3;
-       break;
-      case GL_RGBA:
-      case GL_BGRA:
-      case GL_ABGR_EXT:
-       elements = 4;
-       break;
-      default:
-       return -1;
-    }
-    /*
-    ** According to the GLX protocol, each row must be padded to a multiple of
-    ** 4 bytes.  4 bytes also happens to be the default alignment in the pixel
-    ** store modes of the GL.
-    */
-    switch (type) {
-      case GL_BITMAP:
-       if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) {
-          rowsize = ((w * elements)+7)/8;
-          padding = rowsize % 4;
-          if (padding) {
-             rowsize += 4 - padding;
-          }
-          return (rowsize * h);
-       } else {
-          return -1;
-       }
-      case GL_BYTE:
-      case GL_UNSIGNED_BYTE:
-       esize = 1;
-       break;
-      case GL_UNSIGNED_BYTE_3_3_2:
-      case GL_UNSIGNED_BYTE_2_3_3_REV:
-       esize = 1;
-       elements = 1;
-       break;
-      case GL_SHORT:
-      case GL_UNSIGNED_SHORT:
-       esize = 2;
-       break;
-      case GL_UNSIGNED_SHORT_5_6_5:
-      case GL_UNSIGNED_SHORT_5_6_5_REV:
-      case GL_UNSIGNED_SHORT_4_4_4_4:
-      case GL_UNSIGNED_SHORT_4_4_4_4_REV:
-      case GL_UNSIGNED_SHORT_5_5_5_1:
-      case GL_UNSIGNED_SHORT_1_5_5_5_REV:
-       esize = 2;
-       elements = 1;
-       break;
-      case GL_INT:
-      case GL_UNSIGNED_INT:
-      case GL_FLOAT:
-       esize = 4;
-       break;
-      case GL_UNSIGNED_INT_8_8_8_8:
-      case GL_UNSIGNED_INT_8_8_8_8_REV:
-      case GL_UNSIGNED_INT_10_10_10_2:
-      case GL_UNSIGNED_INT_2_10_10_10_REV:
-       esize = 4;
-       elements = 1;
-       break;
-      default:
-       return -1;
-    }
-    rowsize = w * elements * esize;
-    padding = rowsize % 4;
-    if (padding) {
-       rowsize += 4 - padding;
-    }
-    return (rowsize * h);
+    return __glXImage3DSize( format, type, w, h, 1, 0, 0, 0, 0, 4 );
 }
 
 GLint __glGetTexEnvfv_size(GLenum pname)
@@ -207,27 +113,43 @@
 GLint __glGetTexParameterfv_size(GLenum pname)
 {
     switch (pname) {
+      case GL_TEXTURE_BORDER_COLOR:
+       return 4;
+
       case GL_TEXTURE_WRAP_S:
       case GL_TEXTURE_WRAP_T:
       case GL_TEXTURE_WRAP_R:
-       return 1;
       case GL_TEXTURE_MIN_FILTER:
       case GL_TEXTURE_MAG_FILTER:
-       return 1;
-      case GL_TEXTURE_BORDER_COLOR:
-       return 4;
       case GL_TEXTURE_PRIORITY:
-       return 1;
       case GL_TEXTURE_RESIDENT:
-       return 1;
+       
+      /* GL_SGIS_texture_lod / GL_EXT_texture_lod / GL 1.2 */
       case GL_TEXTURE_MIN_LOD:
       case GL_TEXTURE_MAX_LOD:
       case GL_TEXTURE_BASE_LEVEL:
       case GL_TEXTURE_MAX_LEVEL:
-       return 1;
-      case GL_TEXTURE_COMPARE_MODE_ARB: /* GL_ARB_shadow */
-      case GL_TEXTURE_COMPARE_FUNC_ARB: /* GL_ARB_shadow */
-      case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: /* GL_ARB_shadow_ambient */
+
+      /* GL_SGIX_texture_lod_bias */
+      case GL_TEXTURE_LOD_BIAS_S_SGIX:
+      case GL_TEXTURE_LOD_BIAS_T_SGIX:
+      case GL_TEXTURE_LOD_BIAS_R_SGIX:
+
+      /* GL_ARB_shadow / GL 1.4 */
+      case GL_TEXTURE_COMPARE_MODE:
+      case GL_TEXTURE_COMPARE_FUNC:
+
+      /* GL_SGIX_shadow_ambient / GL_ARB_shadow_ambient */
+      case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB:
+
+      /* GL_SGIX_shadow */
+      case GL_TEXTURE_COMPARE_SGIX:
+      case GL_TEXTURE_COMPARE_OPERATOR_SGIX:
+
+      /* GL_SGIX_texture_coordinate_clamp */
+      case GL_TEXTURE_MAX_CLAMP_S_SGIX:
+      case GL_TEXTURE_MAX_CLAMP_T_SGIX:
+      case GL_TEXTURE_MAX_CLAMP_R_SGIX:
        return 1;
 
       default:
@@ -915,6 +837,15 @@
       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;
+      case GL_PACK_INVERT_MESA:
+       return 1;
+      case GL_CULL_VERTEX_IBM:
+       return 1;
+      case GL_RASTER_POSITION_UNCLIPPED_IBM:
+       return 1;
       default:
        return -1;
     }
@@ -968,83 +899,8 @@
 GLint __glGetTexImage_size(GLenum target, GLint level, GLenum format,
                           GLenum type, GLint width, GLint height, GLint depth)
 {
-    GLint elements, esize;
-    GLint padding, rowsize;
-
-    switch (format) {
-      case GL_RGBA:
-      case GL_BGRA:
-      case GL_ABGR_EXT:
-       elements = 4;
-       break;
-      case GL_RGB:
-      case GL_BGR:
-       elements = 3;
-       break;
-      case GL_RED:
-      case GL_GREEN:
-      case GL_BLUE:
-      case GL_ALPHA:
-      case GL_LUMINANCE:
-      case GL_INTENSITY:
-      case GL_DEPTH_COMPONENT:
-       elements = 1;
-       break;
-      case GL_LUMINANCE_ALPHA:
-       elements = 2;
-       break;
-      default:
-       return -1;
-    }
-    switch (type) {
-      case GL_BYTE:
-      case GL_UNSIGNED_BYTE:
-       esize = 1;
-       break;
-      case GL_UNSIGNED_BYTE_3_3_2:
-      case GL_UNSIGNED_BYTE_2_3_3_REV:
-       esize = 1;
-       elements = 1;
-       break;
-      case GL_SHORT:
-      case GL_UNSIGNED_SHORT:
-       esize = 2;
-       break;
-      case GL_UNSIGNED_SHORT_5_6_5:
-      case GL_UNSIGNED_SHORT_5_6_5_REV:
-      case GL_UNSIGNED_SHORT_4_4_4_4:
-      case GL_UNSIGNED_SHORT_4_4_4_4_REV:
-      case GL_UNSIGNED_SHORT_5_5_5_1:
-      case GL_UNSIGNED_SHORT_1_5_5_5_REV:
-       esize = 2;
-       elements = 1;
-       break;
-      case GL_INT:
-      case GL_UNSIGNED_INT:
-      case GL_FLOAT:
-       esize = 4;
-       break;
-      case GL_UNSIGNED_INT_8_8_8_8:
-      case GL_UNSIGNED_INT_8_8_8_8_REV:
-      case GL_UNSIGNED_INT_10_10_10_2:
-      case GL_UNSIGNED_INT_2_10_10_10_REV:
-       esize = 4;
-       elements = 1;
-       break;
-      default:
-       return -1;
-    }
-    /*
-    ** According to the GLX protocol, each row must be padded to a multiple of
-    ** 4 bytes.  4 bytes also happens to be the default alignment in the pixel
-    ** store modes of the GL.
-    */
-    rowsize = width * elements * esize;
-    padding = rowsize % 4;
-    if (padding) {
-       rowsize += 4 - padding;
-    }
-    return (rowsize * height * depth);
+    return __glXImage3DSize( format, type, width, height, depth,
+                            0, 0, 0, 0, 4 );
 }
 
 GLint __glGetConvolutionParameteriv_size(GLenum pname)
Index: programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h
===================================================================
RCS file: /cvsroot/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h,v
retrieving revision 1.28
diff -u -d -r1.28 radeon_reg.h
--- programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h        13 May 2003 21:46:41 
-0000      1.28
+++ programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h        6 Jun 2003 21:26:13 
-0000
@@ -1524,6 +1524,8 @@
 #       define RADEON_STENCIL_FAIL_INC           (3  << 16)
 #       define RADEON_STENCIL_FAIL_DEC           (4  << 16)
 #       define RADEON_STENCIL_FAIL_INVERT        (5  << 16)
+#       define RADEON_STENCIL_FAIL_INC_WRAP      (6  << 16)
+#       define RADEON_STENCIL_FAIL_DEC_WRAP      (7  << 16)
 #       define RADEON_STENCIL_FAIL_MASK          (0x7 << 16)
 #       define RADEON_STENCIL_ZPASS_KEEP         (0  << 20)
 #       define RADEON_STENCIL_ZPASS_ZERO         (1  << 20)
@@ -1531,6 +1533,8 @@
 #       define RADEON_STENCIL_ZPASS_INC          (3  << 20)
 #       define RADEON_STENCIL_ZPASS_DEC          (4  << 20)
 #       define RADEON_STENCIL_ZPASS_INVERT       (5  << 20)
+#       define RADEON_STENCIL_ZPASS_INC_WRAP     (6  << 20)
+#       define RADEON_STENCIL_ZPASS_DEC_WRAP     (7  << 20)
 #       define RADEON_STENCIL_ZPASS_MASK         (0x7 << 20)
 #       define RADEON_STENCIL_ZFAIL_KEEP         (0  << 24)
 #       define RADEON_STENCIL_ZFAIL_ZERO         (1  << 24)
@@ -1538,6 +1542,8 @@
 #       define RADEON_STENCIL_ZFAIL_INC          (3  << 24)
 #       define RADEON_STENCIL_ZFAIL_DEC          (4  << 24)
 #       define RADEON_STENCIL_ZFAIL_INVERT       (5  << 24)
+#       define RADEON_STENCIL_ZFAIL_INC_WRAP     (6  << 24)
+#       define RADEON_STENCIL_ZFAIL_DEC_WRAP     (7  << 24)
 #       define RADEON_STENCIL_ZFAIL_MASK         (0x7 << 24)
 #       define RADEON_Z_COMPRESSION_ENABLE       (1  << 28)
 #       define RADEON_FORCE_Z_DIRTY              (1  << 29)

Reply via email to