Dieter Nützel wrote:
Am Mittwoch, 2. Juli 2003 22:26 schrieb Ian Romanick:

Dieter Nützel wrote:

Some xdemos apps show it, too.
"wincopy" isn't working.

Mesa/xdemos> ./wincopy
glXMakeContextCurrent failed in Redraw()
glXMakeContextCurrent failed in Redraw()
glXMakeContextCurrent failed in Redraw()
[-]

wincopy doesn't work because it's trying to use an unsupported GLX 1.3 call. glXMakeContextCurrent & glXMakeCurrentReadSGI are the functions that I'm trying to add support for. On my system with my patches, wincopy works fairly well. :)

I want Mesa 5.1 (5.2), now ;-)

You won't have to wait that long. SGI_make_current_read will probably be supported for indirect contexts tomorrow. I think I'm going to go ahead and commit all of the device independent parts tomorrow, and commit the device dependent parts as they are fixed.


"manywin" update only the lasted created window in hardware mode (n<=28).
All additional windows (indirect mode) would be updated simultaneously.
Sometimes it locks X after the second try.

Could you try the attached patch? It should fix the problem for both r100 and r200 based cards. I had to hand-edit the patch to remove some other changes from glxcmds.c, so let me know if you have any problems getting it to apply cleanly. Hopefully this will be the *last time* that I have to modify GetDRIDrawable! :)


*This* might very well be related.  I notice that if manywin is run with
'-s' it works fine.  Is there a bug filed, either in the DRI database or
the XFree86 database, for this?

No? --- Not from me. It worked with tdfx...;-)

Okay. I created one in the XFree86 database. It's bug #453.
Index: lib/GL/glx/glxcmds.c
===================================================================
RCS file: /cvsroot/dri/xc/xc/lib/GL/glx/glxcmds.c,v
retrieving revision 1.44
diff -u -d -r1.44 glxcmds.c
--- lib/GL/glx/glxcmds.c        25 Jun 2003 00:39:58 -0000      1.44
+++ lib/GL/glx/glxcmds.c        3 Jul 2003 01:01:33 -0000
@@ -164,31 +164,36 @@
  */
 
 static __DRIdrawable *
-GetDRIDrawable( GLXContext gc, GLXDrawable drawable )
+GetDRIDrawable( Display *dpy, GLXDrawable drawable )
 {
 #ifdef GLX_DIRECT_RENDERING
     __DRIdrawable *pdraw = NULL;
+    __GLXdisplayPrivate *priv = __glXInitialize(dpy);
+    unsigned   i;
+    const unsigned  screen_count = ScreenCount(dpy);
 
-    if ((gc != NULL) && gc->isDirect) {
-       __GLXdisplayPrivate *priv = __glXInitialize(gc->currentDpy);
-       if (priv->driDisplay.private) {
-           __GLXscreenConfigs *psc = &priv->screenConfigs[gc->screen];
+    if (priv->driDisplay.private) {
+       for ( i = 0 ; i < screen_count ; i++ ) {
+           __GLXscreenConfigs *psc = &priv->screenConfigs[i];
 
            if (psc && psc->driScreen.private) {
                /*
                ** getDrawable returning NULL implies that the drawable is
                ** not bound to a direct rendering context.
                */
-               pdraw = (*psc->driScreen.getDrawable)(gc->currentDpy,
+               pdraw = (*psc->driScreen.getDrawable)(dpy,
                                                      drawable,
                                                      psc->driScreen.private);
+               if ( pdraw != NULL ) {
+                   break;
+               }
            }
        }
     }
 
     return pdraw;
 #else
-    (void) gc;
+    (void) dpy;
     return NULL;
 #endif
 }
@@ -694,11 +699,11 @@
 void GLX_PREFIX(glXSwapBuffers)(Display *dpy, GLXDrawable drawable)
 {
     xGLXSwapBuffersReq *req;
-    GLXContext gc = __glXGetCurrentContext();
+    GLXContext gc;
     GLXContextTag tag;
     CARD8 opcode;
 #ifdef GLX_DIRECT_RENDERING
-    __DRIdrawable *pdraw = GetDRIDrawable( gc, drawable );
+    __DRIdrawable *pdraw = GetDRIDrawable( dpy, drawable );
 
     if ( pdraw != NULL ) {
        (*pdraw->swapBuffers)(dpy, pdraw->private);
@@ -715,7 +720,9 @@
     ** 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)) {
+    gc = __glXGetCurrentContext();
+    if ((gc != NULL) && (dpy == gc->currentDpy) && 
+       ((drawable == gc->currentDrawable) || (drawable == gc->currentReadable)) ) {
        tag = gc->currentContextTag;
     } else {
        tag = 0;
@@ -1921,7 +1928,8 @@
 
 #ifdef GLX_DIRECT_RENDERING
    if ( gc->isDirect && __glXExtensionBitIsEnabled( SGI_swap_control_bit ) ) {
-      __DRIdrawable *pdraw = GetDRIDrawable( gc, gc->currentDrawable );
+      __DRIdrawable *pdraw = GetDRIDrawable( gc->currentDpy,
+                                            gc->currentDrawable );
 
       if ( pdraw != NULL ) {
         pdraw->swap_interval = interval;
@@ -1961,7 +1969,8 @@
 {
 #ifdef GLX_DIRECT_RENDERING
    GLXContext gc = __glXGetCurrentContext();
-   __DRIdrawable *pdraw = GetDRIDrawable( gc, gc->currentDrawable );
+   __DRIdrawable *pdraw = GetDRIDrawable( gc->currentDpy,
+                                         gc->currentDrawable );
 
    if ( pdraw == NULL ) {
       return GLX_BAD_CONTEXT;
@@ -1986,7 +1995,8 @@
 {
 #ifdef GLX_DIRECT_RENDERING
    GLXContext gc = __glXGetCurrentContext();
-   __DRIdrawable *pdraw = GetDRIDrawable( gc, gc->currentDrawable );
+   __DRIdrawable *pdraw = GetDRIDrawable( gc->currentDpy,
+                                         gc->currentDrawable );
 
 
    if ( pdraw && __glXExtensionBitIsEnabled( MESA_swap_control_bit ) ) {
@@ -2073,8 +2083,7 @@
 {
    int   status = GLX_BAD_CONTEXT;
 #ifdef GLX_DIRECT_RENDERING
-    GLXContext gc = __glXGetCurrentContext();
-   __DRIdrawable *pdraw = GetDRIDrawable( gc, gc->currentDrawable );
+   __DRIdrawable *pdraw = GetDRIDrawable( dpy, drawable );
 
    if ( (pdraw != NULL ) && (pdraw->queryFrameTracking != NULL)
        && __glXExtensionBitIsEnabled( MESA_swap_frame_usage_bit ) ) {
@@ -2100,8 +2109,7 @@
 {
    int   status = GLX_BAD_CONTEXT;
 #ifdef GLX_DIRECT_RENDERING
-    GLXContext gc = __glXGetCurrentContext();
-   __DRIdrawable *pdraw = GetDRIDrawable( gc, gc->currentDrawable );
+   __DRIdrawable *pdraw = GetDRIDrawable( dpy, drawable );
 
    if ( (pdraw != NULL ) && (pdraw->queryFrameTracking != NULL)
        && __glXExtensionBitIsEnabled( MESA_swap_frame_usage_bit ) ) {
@@ -2160,7 +2168,8 @@
 {
 #ifdef GLX_DIRECT_RENDERING
    GLXContext gc = __glXGetCurrentContext();
-   __DRIdrawable *pdraw = GetDRIDrawable( gc, gc->currentDrawable );
+   __DRIdrawable *pdraw = GetDRIDrawable( gc->currentDpy,
+                                         gc->currentDrawable );
 
    if ( divisor <= 0 || remainder < 0 )
      return GLX_BAD_VALUE;
@@ -2645,8 +2654,7 @@
                                         int64_t divisor, int64_t remainder)
 {
 #ifdef GLX_DIRECT_RENDERING
-   GLXContext gc = __glXGetCurrentContext();
-   __DRIdrawable *pdraw = GetDRIDrawable( gc, gc->currentDrawable );
+   __DRIdrawable *pdraw = GetDRIDrawable( dpy, 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
@@ -2679,8 +2687,7 @@
                                  int64_t *ust, int64_t *msc, int64_t *sbc)
 {
 #ifdef GLX_DIRECT_RENDERING
-   GLXContext gc = __glXGetCurrentContext();
-   __DRIdrawable *pdraw = GetDRIDrawable( gc, gc->currentDrawable );
+   __DRIdrawable *pdraw = GetDRIDrawable( dpy, drawable );
    int  ret;
 
    /* The OML_sync_control spec says these should "generate a GLX_BAD_VALUE
@@ -2720,8 +2727,7 @@
                                  int64_t *ust, int64_t *msc, int64_t *sbc )
 {
 #ifdef GLX_DIRECT_RENDERING
-   GLXContext gc = __glXGetCurrentContext();
-   __DRIdrawable *pdraw = GetDRIDrawable( gc, gc->currentDrawable );
+   __DRIdrawable *pdraw = GetDRIDrawable( dpy, drawable );
    int  ret;
 
    /* The OML_sync_control spec says this should "generate a GLX_BAD_VALUE
Index: lib/GL/mesa/src/drv/r200/r200_ioctl.c
===================================================================
RCS file: /cvsroot/dri/xc/xc/lib/GL/mesa/src/drv/r200/r200_ioctl.c,v
retrieving revision 1.19
diff -u -d -r1.19 r200_ioctl.c
--- lib/GL/mesa/src/drv/r200/r200_ioctl.c       21 May 2003 17:32:08 -0000      1.19
+++ lib/GL/mesa/src/drv/r200/r200_ioctl.c       3 Jul 2003 01:01:33 -0000
@@ -426,11 +426,11 @@
    driWaitForVBlank( dPriv, & rmesa->vbl_seq, rmesa->vblank_flags, & missed_target );
    LOCK_HARDWARE( rmesa );
 
-   nbox = rmesa->dri.drawable->numClipRects; /* must be in locked region */
+   nbox = dPriv->numClipRects; /* must be in locked region */
 
    for ( i = 0 ; i < nbox ; ) {
       GLint nr = MIN2( i + RADEON_NR_SAREA_CLIPRECTS , nbox );
-      XF86DRIClipRectPtr box = rmesa->dri.drawable->pClipRects;
+      XF86DRIClipRectPtr box = dPriv->pClipRects;
       XF86DRIClipRectPtr b = rmesa->sarea->boxes;
       GLint n = 0;
 
Index: lib/GL/mesa/src/drv/radeon/radeon_ioctl.c
===================================================================
RCS file: /cvsroot/dri/xc/xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.c,v
retrieving revision 1.45
diff -u -d -r1.45 radeon_ioctl.c
--- lib/GL/mesa/src/drv/radeon/radeon_ioctl.c   10 Jun 2003 18:50:44 -0000      1.45
+++ lib/GL/mesa/src/drv/radeon/radeon_ioctl.c   3 Jul 2003 01:01:33 -0000
@@ -832,11 +832,11 @@
    driWaitForVBlank( dPriv, & rmesa->vbl_seq, rmesa->vblank_flags, & missed_target );
    LOCK_HARDWARE( rmesa );
 
-   nbox = rmesa->dri.drawable->numClipRects; /* must be in locked region */
+   nbox = dPriv->numClipRects; /* must be in locked region */
 
    for ( i = 0 ; i < nbox ; ) {
       GLint nr = MIN2( i + RADEON_NR_SAREA_CLIPRECTS , nbox );
-      XF86DRIClipRectPtr box = rmesa->dri.drawable->pClipRects;
+      XF86DRIClipRectPtr box = dPriv->pClipRects;
       XF86DRIClipRectPtr b = rmesa->sarea->boxes;
       GLint n = 0;
 

Reply via email to