Bug#554962: Segmentation fault in glGetError

View: New views
5 Messages — Rating Filter:   Alert me  

Bug#554962: Segmentation fault in glGetError

by Xavier Glattard :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Package: libgl1-mesa-glx
Version: 7.6-1_i386

I'm playing with OpenGL and GNUstep (from svn) and write a small app
based on glxgears. I just update Mesa from stable to testing. My app
runs fine with stable packages; with testing packages, I get:

xavier@mdvx-2:~/src/Gears$ openapp ./Gears
2009-11-07 15:40:48.829 Gears[12139] XShm pixmaps not supported by X server.
2009-11-07 15:40:48.829 Gears[12139] Falling back to normal XImage: s
(will be slower).
Erreur de segmentation


xavier@mdvx-2:~/src/Gears$ debugapp ./Gears
[Thread debugging using libthread_db enabled]
[New Thread 0xb711a6e0 (LWP 12275)]
2009-11-07 15:40:59.802 Gears[12275] XShm pixmaps not supported by X server.
2009-11-07 15:40:59.803 Gears[12275] Falling back to normal XImage: s
(will be slower).

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb711a6e0 (LWP 12275)]
0xb7f1d546 in glGetError () at ../../../src/mesa/x86/glapi_x86.S:415
415     ../../../src/mesa/x86/glapi_x86.S: No such file or directory.
         in ../../../src/mesa/x86/glapi_x86.S
Current language:  auto; currently asm
(gdb) bt
#0  0xb7f1d546 in glGetError () at ../../../src/mesa/x86/glapi_x86.S:415
#1  0xb6f47eeb in -[XGGLPixelFormat drawableForWindow:] (self=0x8cc61b0,
     _cmd=0xb6f67b00, xwindowid=27263009) at XGGLFormat.m:320
#2  0xb6f4a2d6 in -[XGGLContext setView:] (self=0x8cc7aa8, _cmd=0xb7e3c088,
     view=0x8cc4840) at XGGLContext.m:516
#3  0xb7c99999 in -[NSOpenGLView openGLContext] (self=0x8cc4840,
     _cmd=0xb7e3c0e8) at NSOpenGLView.m:140
#4  0xb7c997b1 in -[NSOpenGLView update] (self=0x8cc4840, _cmd=0xb7e3c108)
     at NSOpenGLView.m:208
#5  0xb7c99e3e in -[NSOpenGLView _viewDidMoveToWindow] (self=0x8cc4840,
     _cmd=0xb7e7c3e8) at NSOpenGLView.m:270
#6  0xb7d275ff in -[NSView addSubview:positioned:relativeTo:]
(self=0x8c86a78,
     _cmd=0xb7e7c4e8, aView=0x8cc4840, place=NSWindowAbove, otherView=0x0)
     at NSView.m:758
#7  0xb7d2380f in -[NSView addSubview:] (self=0x8c86a78, _cmd=0x8054710,
     aView=0x8cc4840) at NSView.m:696
#8  0x0804c176 in -[GearsWindow
initWithContentRect:styleMask:backing:defer:]
     () at GearsWindow.m:243
#9  0x0804c4f4 in -[GearsWindow initWithBacking:] (self=0x8c873c8,
     _cmd=0x80530e0, bufferingType=NSBackingStoreBuffered) at
GearsWindow.m:282
#10 0x0804a167 in -[GearsMain createWindowWithBacking:] (self=0x8b20578,
     _cmd=0x80530f8, backing=NSBackingStoreBuffered) at GearsMain.m:94
#11 0x0804a200 in -[GearsMain applicationDidFinishLaunching:]
(self=0x8b20578,
---Type <return> to continue, or q <return> to quit---q

The original glxgear runs fine.


The GNUstep code (in XGGLPixelFormat.m) is:

- (GLXWindow) drawableForWindow: (Window)xwindowid
{
   GLint error;
   GLXWindow win;
   MAKE_DISPLAY(dpy);

   if (GSglxMinorVersion(dpy) >= 3)
     {
       win = glXCreateWindow(dpy, configurations.fbconfig[0],
                              xwindowid, NULL);
     }
   else
     {
       win = xwindowid;
     }

   error = glGetError();
   if ( error != GL_NO_ERROR )
       NSDebugMLLog( @"GLX", @"Can not create GL window for pixel format
%@ - Errror %u",
                             self, error );
   return win;
}


Some gl info:

xavier@mdvx-2:~/src/Gears$ glxinfo
name of display: :0.0
display: :0  screen: 0
direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.2
server glx extensions:
(...)
client glx vendor string: SGI
client glx version string: 1.4
client glx extensions:
(...)
GLX version: 1.2
GLX extensions:
(...)
OpenGL vendor string: DRI R300 Project
OpenGL renderer string: Mesa DRI R300 (RV350 4E50) 20090101 AGP 4x
x86/MMX/SSE2 TCL
OpenGL version string: 1.4 Mesa 7.6
OpenGL extensions:
(...)

Thank !

Xavier






--
To UNSUBSCRIBE, email to debian-bugs-dist-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Bug#554962: Segmentation fault in glGetError

by Michel Dänzer-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, 2009-11-07 at 16:12 +0100, Xavier Glattard wrote:

> Package: libgl1-mesa-glx
> Version: 7.6-1_i386
>
> I'm playing with OpenGL and GNUstep (from svn) and write a small app
> based on glxgears. I just update Mesa from stable to testing. My app
> runs fine with stable packages; with testing packages, I get:
>
> xavier@mdvx-2:~/src/Gears$ openapp ./Gears
> 2009-11-07 15:40:48.829 Gears[12139] XShm pixmaps not supported by X server.
> 2009-11-07 15:40:48.829 Gears[12139] Falling back to normal XImage: s
> (will be slower).
> Erreur de segmentation
>
>
> xavier@mdvx-2:~/src/Gears$ debugapp ./Gears
> [Thread debugging using libthread_db enabled]
> [New Thread 0xb711a6e0 (LWP 12275)]
> 2009-11-07 15:40:59.802 Gears[12275] XShm pixmaps not supported by X server.
> 2009-11-07 15:40:59.803 Gears[12275] Falling back to normal XImage: s
> (will be slower).
>
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0xb711a6e0 (LWP 12275)]
> 0xb7f1d546 in glGetError () at ../../../src/mesa/x86/glapi_x86.S:415
> 415     ../../../src/mesa/x86/glapi_x86.S: No such file or directory.
>          in ../../../src/mesa/x86/glapi_x86.S
> Current language:  auto; currently asm
> (gdb) bt
> #0  0xb7f1d546 in glGetError () at ../../../src/mesa/x86/glapi_x86.S:415
> #1  0xb6f47eeb in -[XGGLPixelFormat drawableForWindow:] (self=0x8cc61b0,
>      _cmd=0xb6f67b00, xwindowid=27263009) at XGGLFormat.m:320
> #2  0xb6f4a2d6 in -[XGGLContext setView:] (self=0x8cc7aa8, _cmd=0xb7e3c088,
>      view=0x8cc4840) at XGGLContext.m:516
> #3  0xb7c99999 in -[NSOpenGLView openGLContext] (self=0x8cc4840,
>      _cmd=0xb7e3c0e8) at NSOpenGLView.m:140
> #4  0xb7c997b1 in -[NSOpenGLView update] (self=0x8cc4840, _cmd=0xb7e3c108)
>      at NSOpenGLView.m:208
> #5  0xb7c99e3e in -[NSOpenGLView _viewDidMoveToWindow] (self=0x8cc4840,
>      _cmd=0xb7e7c3e8) at NSOpenGLView.m:270
> #6  0xb7d275ff in -[NSView addSubview:positioned:relativeTo:]
> (self=0x8c86a78,
>      _cmd=0xb7e7c4e8, aView=0x8cc4840, place=NSWindowAbove, otherView=0x0)
>      at NSView.m:758
> #7  0xb7d2380f in -[NSView addSubview:] (self=0x8c86a78, _cmd=0x8054710,
>      aView=0x8cc4840) at NSView.m:696
> #8  0x0804c176 in -[GearsWindow
> initWithContentRect:styleMask:backing:defer:]
>      () at GearsWindow.m:243
> #9  0x0804c4f4 in -[GearsWindow initWithBacking:] (self=0x8c873c8,
>      _cmd=0x80530e0, bufferingType=NSBackingStoreBuffered) at
> GearsWindow.m:282
> #10 0x0804a167 in -[GearsMain createWindowWithBacking:] (self=0x8b20578,
>      _cmd=0x80530f8, backing=NSBackingStoreBuffered) at GearsMain.m:94
> #11 0x0804a200 in -[GearsMain applicationDidFinishLaunching:]
> (self=0x8b20578,
> ---Type <return> to continue, or q <return> to quit---q
>
> The original glxgear runs fine.
>
>
> The GNUstep code (in XGGLPixelFormat.m) is:
>
> - (GLXWindow) drawableForWindow: (Window)xwindowid
> {
>    GLint error;
>    GLXWindow win;
>    MAKE_DISPLAY(dpy);
>
>    if (GSglxMinorVersion(dpy) >= 3)
>      {
>        win = glXCreateWindow(dpy, configurations.fbconfig[0],
>                               xwindowid, NULL);
>      }
>    else
>      {
>        win = xwindowid;
>      }
>
>    error = glGetError();
>    if ( error != GL_NO_ERROR )
>        NSDebugMLLog( @"GLX", @"Can not create GL window for pixel format
> %@ - Errror %u",
>                              self, error );
>    return win;
> }

This code looks buggy: All GL functions including glGetError require a
(GLX in this case) context to be bound (otherwise IIRC the OpenGL spec
says behaviour is undefined). glGetError() isn't meaningful for GLX
functions like glXCreateWindow() anyway.


--
Earthling Michel Dänzer           |                http://www.vmware.com
Libre software enthusiast         |          Debian, X and DRI developer



--
To UNSUBSCRIBE, email to debian-bugs-dist-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Bug#554962: Segmentation fault in glGetError

by Xavier Glattard :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Michel Dänzer a écrit :
> This code looks buggy: All GL functions including glGetError require a
> (GLX in this case) context to be bound (otherwise IIRC the OpenGL spec
> says behaviour is undefined). glGetError() isn't meaningful for GLX
> functions like glXCreateWindow() anyway.

I agree about the wrong use of glGetError (and try to fix it), but it
should not segfault.

Did you read this ?
   https://bugs.launchpad.net/ubuntu/+source/mesa/+bug/318043
Many points have already been discussed there. See #12 and #13.

Thanks





--
To UNSUBSCRIBE, email to debian-bugs-dist-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Bug#554962: Segmentation fault in glGetError

by Julien Cristau-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Nov 13, 2009 at 10:50:16 +0100, Xavier Glattard wrote:

> Michel Dänzer a écrit :
> >This code looks buggy: All GL functions including glGetError require a
> >(GLX in this case) context to be bound (otherwise IIRC the OpenGL spec
> >says behaviour is undefined). glGetError() isn't meaningful for GLX
> >functions like glXCreateWindow() anyway.
>
> I agree about the wrong use of glGetError (and try to fix it), but
> it should not segfault.
>
"behaviour is undefined" very much includes the possibility of
segfaulting the program, afaict.

Cheers,
Julien



--
To UNSUBSCRIBE, email to debian-bugs-dist-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Bug#554962: Segmentation fault in glGetError

by Xavier Glattard :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Julien Cristau a écrit :
> "behaviour is undefined" very much includes the possibility of
> segfaulting the program, afaict.

You're right: 'no segfaulting' is not an OGL requirement :D







--
To UNSUBSCRIBE, email to debian-bugs-dist-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...