Please do not reply to this email: if you want to comment on the bug, go to    
       
the URL shown below and enter yourcomments there.     
   
https://bugs.freedesktop.org/show_bug.cgi?id=9272          
     
           Summary: glXDestroyContext causes fatal error when sharing
                    display lists (dri)
           Product: Mesa
           Version: 6.4
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: critical
          Priority: P2
         Component: GLX
        AssignedTo: mesa3d-dev@lists.sourceforge.net
        ReportedBy: [EMAIL PROTECTED]


Using direct rendering create a window then create a subwindow which shares
display lists with the first window. As long as nothing is drawn into the
windows everything is fine. However, drawing anything then destroying the
windows and deleting the contexts causes the following error:

X Error of failed request:  BadValue (integer parameter out of range for 
operation)
  Major opcode of failed request:  143 (XFree86-DRI)
  Minor opcode of Vertex3f: 1
  Value in failed request:  0x1400004
  Serial number of failed request:  61
  Current serial number in output stream:  61

I also sometimes see this message while drawing:

Vertex3f: 1

If only one context (either) is deleted everything is fine. I'm using the r200
dri driver.

Here is a short example I put together to test this outside of my real app as
perhaps I'm doing something wrong:

#include <stdio.h>
#include <X11/Xlib.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glx.h>

GLXContext main_gc = NULL, gc1 = NULL, gc2 = NULL;
Window win1, win2;
Display *disp;
int screen;

void Create_Window() {
   static int count = 0;
   char *nm = "Hi";
   Colormap cmap;
   int vi_attr[] = {GLX_RGBA, GLX_DOUBLEBUFFER, GLX_RED_SIZE, 1,
                    GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, None};
   unsigned long mask = 0;
   XClassHint *chint;
   XColor xclr;
   XSetWindowAttributes attr;
   XSizeHints *shint;
   XTextProperty wname;
   XVisualInfo *vi;
   XWMHints *whint;

   vi = glXChooseVisual(disp, screen, vi_attr);
   if (count) {
      if ((gc2 = glXCreateContext(disp, vi, main_gc, GL_TRUE)) == NULL) {
         puts("cannot create context");
         return;
      }
   }
   else {
      if ((gc1 = glXCreateContext(disp, vi, main_gc, GL_TRUE)) == NULL) {
         puts("cannot create context");
         return;
      }
      main_gc = gc1;
   }
   cmap = XCreateColormap(disp, RootWindow(disp, screen), vi->visual,
                          AllocNone);
   attr.colormap = cmap;
   xclr.red = 65535;
   xclr.green = 65535;
   xclr.blue = 65535;
   XAllocColor(disp, cmap, &xclr);
   attr.border_pixel = xclr.pixel;
   attr.event_mask = ExposureMask | StructureNotifyMask | ButtonPressMask;
   mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
   if (count) 
      win2 = XCreateWindow(disp, win1, 10, 10, 10, 10, 1, vi->depth,
                           InputOutput, vi->visual, mask, &attr);
   else
      win1 = XCreateWindow(disp, RootWindow(disp, screen), 10, 10, 200, 200,
                           2, vi->depth, InputOutput, vi->visual, mask, &attr);
   XStringListToTextProperty(&nm, 1, &wname);
   if ((shint = XAllocSizeHints()) != NULL) {
      shint->x = 10;
      shint->y = 10;
      shint->width = 200;
      shint->height = 200;
      shint->base_width = 200;
      shint->base_height = 200;
      shint->win_gravity = NorthWestGravity;
      shint->flags = USSize | USPosition | PWinGravity;
   }
   if ((whint = XAllocWMHints()) != NULL) {
      whint->flags = InputHint | StateHint;
      whint->input = True;
      whint->initial_state = NormalState;
   }
   if ((chint = XAllocClassHint()) != NULL) {
      chint->res_name = nm;
      chint->res_class = nm;
   }
   if (count)
      XSetWMProperties(disp, win2, &wname, &wname, NULL, 0, shint, whint,
                       chint);
   else
      XSetWMProperties(disp, win1, &wname, &wname, NULL, 0, shint, whint,
                       chint);
   XFree(wname.value);
   XFree(shint);
   XFree(whint);
   XFree(chint);
   XFree(vi);
   if (count)
      XMapWindow(disp, win2);
   else
      XMapWindow(disp, win1);
   count++;
}

int main() {
   bool alive = true;
   XEvent event;

   if ((disp = XOpenDisplay("")) == NULL) {
      puts("cannot open display");
      return(0);
   }
   screen = DefaultScreen(disp);

   Create_Window();

   while(alive) {
      XNextEvent(disp, &event);
      switch(event.type) {
      case ButtonPress:
         if (gc2)
            alive = false;
         else
            Create_Window();
         break;
      case ConfigureNotify:
         break;
      case Expose:
         if (event.xexpose.count != 0) break;
         glXMakeCurrent(disp, win1, gc1);
         glMatrixMode(GL_PROJECTION);
         glLoadIdentity();
         glViewport(0, 0, 200, 200);
         glOrtho(0, 200, 0, 200, -1, 1);
         glClearColor(0.0, 0.0, 0.0, 0.0);
         glClear(GL_COLOR_BUFFER_BIT);
         glMatrixMode(GL_MODELVIEW);
         glLoadIdentity();
         glColor3f(1.0, 1.0, 1.0);
         glBegin(GL_QUADS);
           glVertex2f(10.0, 10.0);
           glVertex2f(30.0, 10.0);
           glVertex2f(30.0, 30.0);
           glVertex2f(10.0, 30.0);
         glEnd();
         glXSwapBuffers(disp, win1);
         break;
      case MapNotify:
         break;
      default: ;
      };
   }
   XDestroyWindow(disp, win2);
   glXDestroyContext(disp, gc2);
   XDestroyWindow(disp, win1);
   glXDestroyContext(disp, gc1);
   return(0);
}          
     
     
--           
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email         
     
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to