Log available swap functions, possible fix for DRI2SwapInterval

This commit is contained in:
Charles J. Cliffe 2015-02-10 18:28:35 -05:00
parent a1d1c9e1d9
commit e4c942c714
2 changed files with 20 additions and 8 deletions

View File

@ -180,7 +180,7 @@ void SDRThread::threadMain() {
if (new_freq < sampleRate / 2) {
new_freq = sampleRate / 2;
}
std::cout << "Set frequency: " << new_freq << std::endl;
// std::cout << "Set frequency: " << new_freq << std::endl;
break;
case SDRThreadCommand::SDR_THREAD_CMD_SET_OFFSET:
offset_changed = true;

View File

@ -34,7 +34,7 @@ void initGLExtensions() {
const GLubyte *extensions = glGetString(GL_EXTENSIONS);
std::cout << "Supported GL Extensions: " << extensions << std::endl;
std::cout << std::endl << "Supported GL Extensions: " << std::endl << extensions << std::endl << std::endl;
int interval = 2;
@ -57,28 +57,40 @@ void initGLExtensions() {
#ifdef __linux__
dlopen("libglx.so",RTLD_LAZY);
void (*glxSwapIntervalEXTFunc) (Display *dpy, GLXDrawable drawable, int interval);
int (*glxSwapIntervalMESAFunc)(unsigned int interval);
int (*glxSwapIntervalSGIFunc) (int interval);
void (*DRI2SwapIntervalFunc) (Display *dpy, XID drawable, int interval);
void (*glxSwapIntervalEXTFunc) (Display *dpy, GLXDrawable drawable, int interval) = 0;
int (*glxSwapIntervalMESAFunc)(unsigned int interval) = 0;
int (*glxSwapIntervalSGIFunc) (int interval) = 0;
void (*DRI2SwapIntervalFunc) (Display *dpy, XID drawable, int interval) = 0;
glxSwapIntervalEXTFunc = (void (*) (Display *dpy, GLXDrawable drawable, int interval)) dlsym(RTLD_DEFAULT,"glXSwapIntervalEXT");
glxSwapIntervalMESAFunc = (int (*)(unsigned int interval)) dlsym(RTLD_DEFAULT,"glXSwapIntervalMESA");
glxSwapIntervalSGIFunc = (int (*) (int interval)) dlsym(RTLD_DEFAULT,"glXSwapIntervalSGI");
DRI2SwapIntervalFunc = (void (*) (Display *dpy, XID drawable, int interval)) dlsym(RTLD_DEFAULT,"DRI2SwapInterval");
std::cout << "Available vertical sync SwapInterval functions: " << std::endl;
std::cout << "\tglxSwapIntervalEXT: " << ((glxSwapIntervalEXTFunc != 0)?"Yes":"No") << std::endl;
std::cout << "\tDRI2SwapInterval: " << ((DRI2SwapIntervalFunc != 0)?"Yes":"No") << std::endl;
std::cout << "\tglxSwapIntervalMESA: " << ((glxSwapIntervalMESAFunc != 0)?"Yes":"No") << std::endl;
std::cout << "\tglxSwapIntervalSGI: " << ((glxSwapIntervalSGIFunc != 0)?"Yes":"No") << std::endl;
if (glxSwapIntervalEXTFunc) {
Display *dpy = glXGetCurrentDisplay();
GLXDrawable drawable = glXGetCurrentDrawable();
glxSwapIntervalEXTFunc(dpy, drawable, interval);
} else if (DRI2SwapInterval) {
std::cout << "Using glxSwapIntervalEXT." << std::endl << std::endl;
} else if (DRI2SwapIntervalFunc) {
Display *dpy = glXGetCurrentDisplay();
GLXDrawable drawable = glXGetCurrentDrawable();
DRI2SwapInterval(dpy, drawable, interval);
DRI2SwapIntervalFunc(dpy, drawable, interval);
std::cout << "Using DRI2SwapInterval." << std::endl << std::endl;
} else if (glxSwapIntervalMESAFunc) {
glxSwapIntervalMESAFunc(interval);
std::cout << "Using glxSwapIntervalMESA." << std::endl << std::endl;
} else if (glxSwapIntervalSGIFunc) {
glxSwapIntervalSGIFunc(interval);
std::cout << "Using glxSwapIntervalSGI." << std::endl << std::endl;
} else {
std::cout << "No vertical sync swap interval functions available." << std::endl;
}
#endif