Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: OpenGL bug? Nvidia driver bug? SFML bug? My fault?  (Read 48408 times)

0 Members and 1 Guest are viewing this topic.

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
OpenGL bug? Nvidia driver bug? SFML bug? My fault?
« Reply #15 on: July 19, 2009, 12:24:15 am »
Just wanted to ask if there's any update on this issue, yet.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
OpenGL bug? Nvidia driver bug? SFML bug? My fault?
« Reply #16 on: July 19, 2009, 10:36:03 am »
No, sorry. It doesn't seem to be related to a recent modification: I tried an old revision and the bug is still there. I'm confused because I'm sure that it was working after I updated my graphics driver (the first things I tried were the P-Buffer implementation and post-effects).

So:
- it's not the driver (although it works with the free one)
- it's not SFML 2
- it's not a recent modification

But it worked a few days ago...
Laurent Gomila - SFML developer

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
OpenGL bug? Nvidia driver bug? SFML bug? My fault?
« Reply #17 on: July 19, 2009, 12:29:56 pm »
Did you do a system upgrade, maybe? The only thing I remember that changed on my machine the last days are some packages. Too bad I don't remember which ones that were.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
OpenGL bug? Nvidia driver bug? SFML bug? My fault?
« Reply #18 on: July 19, 2009, 01:14:53 pm »
If I remember correctly, there was a new version of the kernel (2.6.30).
Laurent Gomila - SFML developer

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
OpenGL bug? Nvidia driver bug? SFML bug? My fault?
« Reply #19 on: July 19, 2009, 01:28:29 pm »
I'm still on 2.6.26, so that doesn't cause the failure. But I also got a new updated kernel version (from 2.6.26-1 to 2.6.26-2). I really don't have any clue why that happens. :/

Edit: Your minimal example also crashed on a friend's machine running ArchLinux, kernel 2.6.30 with an *Intel graphics card*. So we can really exclude the driver to be failing, I think.
Edit: I'm always getting "GLXBadContextTag" error messages, so it may be something related to context switching. The proper sourcecode for that part can be read here: https://dev.mobileread.com/svn/iliados/upstream/xserver/GL/glx/glxext.c

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
OpenGL bug? Nvidia driver bug? SFML bug? My fault?
« Reply #20 on: July 20, 2009, 08:18:31 am »
I've tried with another computer: same system, same kernel, same updates, same nVidia driver, same revision of SFML, and it works perfectly.

I'm so confused :shock:
Laurent Gomila - SFML developer

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
OpenGL bug? Nvidia driver bug? SFML bug? My fault?
« Reply #21 on: July 20, 2009, 10:21:04 am »
That's indeed strange. I also don't have a clue what crashes where. And since it's an irregular crash, it's hard to find the line of code causing it.

What I'm wondering about is that nobody else has reported that bug, yet. Would be nice if some more developers with Linux systems could take the minimal example, compile it and test out.

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
OpenGL bug? Nvidia driver bug? SFML bug? My fault?
« Reply #22 on: July 21, 2009, 12:16:14 am »
I was able to isolate the bug, finally!

WORKING source:
Code: [Select]
#include <SFML/Graphics.hpp>

void ThreadFunc( void *arg ) {
sf::Context  context;
}

int main() {
sf::RenderWindow  window( sf::VideoMode( 800, 600, 32 ), "Context test" );
sf::Thread        thread( ThreadFunc, 0 );
sf::Event         event;

thread.Launch();

while( window.IsOpened() ) {
//window.GetEvent( event );

window.Clear();
window.Display();
}

thread.Wait();
return 0;
}


Compile that and you won't get any failures. Now, uncomment the line "window.GetEvent( event )" and start again: crashes.

A friend of mine pointed me to this page: http://www.linuxquestions.org/questions/programming-9/xnextevent-select-409355/ . I think it's interesting that threading with X seems to be a mess. An Xlib resource can be only used once at a time, so maybe there lies the problem.

I really hope this can be solved. I'd do it myself, but I highly suck at X programming.

Edit:
By the way, this is a backtrace I was able to get:
Code: [Select]
#12 0x00007fc8d6edfd88 in XRRGetScreenInfo () from /usr/lib/libXrandr.so.2
#13 0x00007fc8d847248a in sf::priv::VideoModeSupport::GetDesktopVideoMode () from /usr/lib/libsfml-window.so.2.0
#14 0x00007fc8d846d8a9 in sf::VideoMode::GetDesktopMode () from /usr/lib/libsfml-window.so.2.0
#15 0x00007fc8d84717af in sf::priv::ContextGLX::ContextGLX () from /usr/lib/libsfml-window.so.2.0
#16 0x00007fc8d846d0da in sf::priv::ContextGL::New () from /usr/lib/libsfml-window.so.2.0
#17 0x00007fc8d846cd19 in sf::Context::Context () from /usr/lib/libsfml-window.so.2.0
#18 0x000000000040108f in ThreadFunc (arg=0x0) at context.cpp:4


Could it be possible that by using GetEvent() and creating the Context the screen you fetch in GetDesktopVideoMode() is used twice?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
OpenGL bug? Nvidia driver bug? SFML bug? My fault?
« Reply #23 on: July 21, 2009, 08:47:34 am »
Well, like I said it now happens with every SFML program, even the SDK's samples where there's no threading and no use of sf::Context.

However if there's a bug related to Xlib not being thread friendly, there is a quick fix I was planning to do this week ;)
Laurent Gomila - SFML developer

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
OpenGL bug? Nvidia driver bug? SFML bug? My fault?
« Reply #24 on: July 21, 2009, 11:42:09 am »
That'd be absolutely great. Hopefully that will fix all that disturbing behaviour. I'll keep an eye on the SVN log. ;)

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
OpenGL bug? Nvidia driver bug? SFML bug? My fault?
« Reply #25 on: July 21, 2009, 02:16:02 pm »
Quote
Well, like I said it now happens with every SFML program, even the SDK's samples where there's no threading and no use of sf::Context.

I just checked that, and no crashes happen at all with all sample applications. I've tested the latest trunk as well as SFML2 samples.

The only error I still get is when constructing sf::Context when there's an event loop running. If I remove one of both, the proper application runs fine (like specified in my example code above).

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
OpenGL bug? Nvidia driver bug? SFML bug? My fault?
« Reply #26 on: July 22, 2009, 01:43:02 pm »
Are there any news on this issue? ;) Don't get me wrong, I don't want to disturb you, I'm just curious about it. A "Shut up, I'm working on it" would be fine, too! ;)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
OpenGL bug? Nvidia driver bug? SFML bug? My fault?
« Reply #27 on: July 22, 2009, 01:57:53 pm »
It's ok, you can ask as often as you want ;)

I did a new dist-upgrade at home, there were new xserver-xorg updates, and... it still doesn't work at all (I mean, even the samples in 1.5). So this one seems to be related to my system only.

Regarding the fix for Xlib and multi-threading, I haven't had time to do it yet. I'll keep you informed as soon as I do it, so that you can test it and see if that solves the problem.
Laurent Gomila - SFML developer

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
OpenGL bug? Nvidia driver bug? SFML bug? My fault?
« Reply #28 on: July 22, 2009, 02:07:53 pm »
Thank you very much for the reply. Yeah, the bug happening with the samples seems to be system-related (but it's also strange).

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
OpenGL bug? Nvidia driver bug? SFML bug? My fault?
« Reply #29 on: July 24, 2009, 02:39:08 pm »
I've finally solved the problem on my machine: as the proprietary nvidia drivers are broken on the official repositories, I had to compile it myself; unfortunately I forgot to recompile it when I upgraded to the new kernel version, that's why everything was failing (I found it after realizing that even glxgears was failing to create an OpenGL context :D).

So now I'll be able to work seriously on your issue, and on the fix I told you about ;)
Laurent Gomila - SFML developer