Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • mesa mesa
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 2,699
    • Issues 2,699
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 911
    • Merge requests 911
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Mesa
  • mesamesa
  • Issues
  • #48
Closed
Open
Created Sep 18, 2019 by Bugzilla Migration User@bugzilla-migration

glXDestroyContext causes fatal error when sharing display lists (dri)

Submitted by dna..@..pe.net

Assigned to mes..@..op.org

Link to original bug (#9272)

Description

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); }

Version: 6.4

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking