Moved RandR gamma probe to init.

This commit is contained in:
Camilla Berglund 2014-08-18 12:58:02 +02:00
parent 59d1aa52f2
commit a5281df501
2 changed files with 17 additions and 24 deletions

View File

@ -475,6 +475,8 @@ static GLboolean initExtensions(void)
if (_glfw.x11.randr.available)
{
XRRScreenResources* sr;
if (!XRRQueryVersion(_glfw.x11.display,
&_glfw.x11.randr.versionMajor,
&_glfw.x11.randr.versionMinor))
@ -490,6 +492,21 @@ static GLboolean initExtensions(void)
{
_glfw.x11.randr.available = GL_FALSE;
}
sr = XRRGetScreenResources(_glfw.x11.display, _glfw.x11.root);
if (!sr->ncrtc || !XRRGetCrtcGammaSize(_glfw.x11.display, sr->crtcs[0]))
{
// This is either a headless system or an older Nvidia binary driver
// with broken gamma support
// Flag it as useless and fall back to Xf86VidMode gamma, if
// available
_glfwInputError(GLFW_PLATFORM_ERROR,
"X11: RandR gamma ramp support seems broken");
_glfw.x11.randr.gammaBroken = GL_TRUE;
}
XRRFreeScreenResources(sr);
}
if (XQueryExtension(_glfw.x11.display,
@ -701,7 +718,6 @@ int _glfwPlatformInit(void)
_glfwInitTimer();
_glfwInitJoysticks();
_glfwInitGammaRamp();
return GL_TRUE;
}

View File

@ -95,29 +95,6 @@ static GLFWvidmode vidmodeFromModeInfo(const XRRModeInfo* mi,
////// GLFW internal API //////
//////////////////////////////////////////////////////////////////////////
// Detect gamma ramp support
//
void _glfwInitGammaRamp(void)
{
if (_glfw.x11.randr.available)
{
XRRScreenResources* sr = XRRGetScreenResources(_glfw.x11.display,
_glfw.x11.root);
if (!sr->ncrtc || !XRRGetCrtcGammaSize(_glfw.x11.display, sr->crtcs[0]))
{
// This is either a headless system or an older Nvidia binary driver
// with broken gamma support
// Flag it as useless and fall back to Xf86VidMode, if available
_glfwInputError(GLFW_PLATFORM_ERROR,
"X11: RandR gamma ramp support seems broken");
_glfw.x11.randr.gammaBroken = GL_TRUE;
}
XRRFreeScreenResources(sr);
}
}
// Set the current video mode for the specified monitor
//
GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)