We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2897 - SDL reports it 'Can't find matching GLX visual' when requesting an sRGB capable framebuffer
Summary: SDL reports it 'Can't find matching GLX visual' when requesting an sRGB capab...
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.1
Hardware: x86_64 Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords: triage-2.0.4
Depends on:
Blocks:
 
Reported: 2015-03-02 10:06 UTC by manwiuxas
Modified: 2015-04-06 04:15 UTC (History)
0 users

See Also:


Attachments
reproduction case (310 bytes, text/plain)
2015-04-06 01:14 UTC, Ryan C. Gordon
Details

Note You need to log in before you can comment on or make changes to this bug.
Description manwiuxas 2015-03-02 10:06:30 UTC
I'm using Ubuntu Gnome 14.10, with Nvidia 550 TI and proprietary drivers.

Whenever I request SDL_GL_SetAttribute(SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, 1), I get "Can't find matching GLX visual" message on trying to create the window.

Thing is, that I DO get an sRGB capable OpenGL framebuffer on the machine, even if I don't explicitly request it.

I've also tested it on Windows and got an sRGB framebuffer there regardless of the state of SDL_GL_FRAMEBUFFER_SRGB_CAPABLE flag.

This bug impairs creation of cross-platform projects that require sRGB for proper display of color.
Comment 1 Ryan C. Gordon 2015-03-04 06:09:12 UTC
I remember hearing something about this. We'll look at this for 2.0.4.

--ryan.
Comment 2 Ryan C. Gordon 2015-04-06 01:14:42 UTC
Created attachment 2106 [details]
reproduction case


This program fails to make a GL context on X11 with Nvidia's proprietary drivers (prints "(nil)") It works on Intel's open source drivers, at least on this machine (prints a valid pointer address for the GL context).

--ryan.
Comment 3 Ryan C. Gordon 2015-04-06 03:42:25 UTC
Hmm, the Nvidia drivers don't like when you choose a visual with:

    attribs[i++] = GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB;

...it instead wants...

    attribs[i++] = GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB;
    attribs[i++] = True;

(which appears to be incorrect, according to the GLX specification.)

Mesa seems to allow this, though, so I guess we'll just force that True item for now.

--ryan.
Comment 4 Ryan C. Gordon 2015-04-06 04:08:04 UTC
(In reply to Ryan C. Gordon from comment #3)
> Hmm, the Nvidia drivers don't like when you choose a visual with:
> 
>     attribs[i++] = GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB;
> 
> ...it instead wants...
> 
>     attribs[i++] = GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB;
>     attribs[i++] = True;
> 
> (which appears to be incorrect, according to the GLX specification.)

Uh, wait, Mesa wants the same thing, maybe it was just more forgiving about picking a visual, or some other cosmic force stepped in.

    http://cgit.freedesktop.org/mesa/mesa/tree/src/glx/glxext.c?id=5e59f895c468c1ac497ad925b8bddd7f227c89a2#n548

It's not clear to me where it says this attribute needs a "True" specified; other boolean items in the Mesa implementation don't do this (look for FETCH_OR_SET).

I'm confused. But at least the fix is easy now!

--ryan.
Comment 5 Ryan C. Gordon 2015-04-06 04:15:51 UTC
Oh well, this should be fixed now in http://hg.libsdl.org/SDL/rev/f5b468964b0b

--ryan.