Bug 2795 - Bug in sdl_glimp.c, causing GLX failures
Status: RESOLVED DUPLICATE of bug 2796
Alias: None
Product: Tremulous
Classification: Unclassified
Component: Video
Version: unspecified
Hardware: PC Linux
: P2 major
Assignee: Tim Angus
QA Contact:
URL:
Depends on:
Blocks:
 
Reported: 2006-07-26 17:37 EDT by Phil Bordelon
Modified: 2006-07-28 04:20:00 EDT
0 users

See Also:


Attachments
One-line fix for GLX crash in sdl_glimp.c (323 bytes, patch)
2006-07-26 17:39 EDT, Phil Bordelon

Description Phil Bordelon 2006-07-26 17:37:35 EDT
Moving from 1.1.0 to trunk breaks Tremulous on my work machine.  I get this error:

   Sys_Error: GLimp_Init() - could not load OpenGL subsystem

Yes, yes, I know this is usually a bad GL subsystem ... but 1.1.0 works perfectly.

I did some bisecting with SVN, and tracked it down to r778, the import of ioq3 r775.  Further testing tracked it down to (sensibly) src/unix/sdl_glimp.c.

Turns out the removal of one line:

===
@@ -626,7 +651,6 @@
         tstencilbits = 0;
     }

-    sdlcolorbits = 4;
     if (tcolorbits == 24)
         sdlcolorbits = 8;
===

was causing it to crap out.  Now, yes, I realize that sdlcolorbits is being initialized at the top of the function, so that line should be irrelevant.  But if I compile with it back in the program the game starts up ... otherwise it doesn't.

I'm going to try running trunk/ at home to see if it exhibits the same behaviour, but that said, this is a trivial one-line fix which, while theoretically redundant, fixes a problem without causing any harm.  Applying it would be nice.  (It should probably go upstream too.)
Comment 1 Phil Bordelon 2006-07-26 17:39:02 EDT
Created attachment 983 [details]
One-line fix for GLX crash in sdl_glimp.c

Here is the fix I mentioned.  Utterly trivial, should be unnecessary, but hey.
It does what it needs to do.
Comment 2 Phil Bordelon 2006-07-26 18:31:56 EDT
Ah ha!  Turns out this is NOT a miscompilation by GCC.  The problem is that the section of code here is run in a loop ... which should be trying both 4bpc and 8bpc on each iteration.  But because it's only set to 4 once, at the top, it ends up always trying 8bpc afterwards, missing potential GLX visual depths.  Oops!

This is definitely also an upstream bug, so I'm going to submit it there as well.
Comment 3 Tim Angus 2006-07-26 18:35:18 EDT
Please submit this ONLY on upstream, any fixes there will get merged down eventually.
Comment 4 Phil Bordelon 2006-07-26 20:08:44 EDT
I didn't know this was an upstream bug originally, but now that I do, it's filed there:
   https://bugzilla.icculus.org/show_bug.cgi?id=2796

Feel free to close this as RESO/WONT.
Comment 5 Tim Angus 2006-07-28 04:20:00 EDT

*** This bug has been marked as a duplicate of 2796 ***