File tree Expand file tree Collapse file tree
GPU/GPUTracking/display/frontend Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -226,6 +226,11 @@ void GPUDisplayFrontend::applyInitialWindowState()
226226 }
227227}
228228
229+ bool GPUDisplayFrontend::vsyncEnabled () const
230+ {
231+ return mDisplay ->cfgR ().drawQualityVSync ;
232+ }
233+
229234int32_t & GPUDisplayFrontend::drawTextFontSize ()
230235{
231236 return mDisplay ->drawTextFontSize ();
Original file line number Diff line number Diff line change @@ -155,6 +155,7 @@ class GPUDisplayFrontend : public GPUDisplayFrontendInterface
155155 int32_t InitDisplay (bool initFailure = false ); // Callback to initialize the GL Display (to be called in StartDisplay)
156156 void ExitDisplay (); // Callback to clean up the GL Display
157157 int32_t & drawTextFontSize ();
158+ bool vsyncEnabled () const ; // VSync setting (drawQualityVSync)
158159 void setWindowState (bool fullScreen, bool maximized); // Sync the settings if the window manager changed the window state
159160 void focusLost (); // Release all keys and mouse buttons when the window loses focus, since the release events go to another window
160161 void applyInitialWindowState (); // Switch to fullscreen / maximize at startup according to the settings
Original file line number Diff line number Diff line change 2121#include < cstring>
2222#include < GL/freeglut.h>
2323#include < unistd.h>
24+ #ifdef GPUCA_BUILD_EVENT_DISPLAY_X11
25+ #include < GL/glx.h>
26+ #include < GL/glxext.h>
27+ #endif
2428
2529#include < pthread.h>
2630using namespace o2 ::gpu;
@@ -264,6 +268,7 @@ int32_t GPUDisplayFrontendGlut::FrontendMain()
264268 glutPassiveMotionFunc (mouseMoveFunc);
265269 glutMouseWheelFunc (mMouseWheelFunc );
266270 applyInitialWindowState ();
271+ SetVSync (vsyncEnabled ());
267272
268273 {
269274 std::lock_guard lock (mExitStateMutex );
@@ -308,4 +313,12 @@ void GPUDisplayFrontendGlut::SwitchFullscreen(bool set)
308313}
309314
310315void GPUDisplayFrontendGlut::ToggleMaximized (bool set) {}
311- void GPUDisplayFrontendGlut::SetVSync (bool enable) {}
316+ void GPUDisplayFrontendGlut::SetVSync (bool enable) // GLUT has no swap interval API, set it via GLX directly (no-op if freeglut does not use GLX)
317+ {
318+ #ifdef GPUCA_BUILD_EVENT_DISPLAY_X11
319+ auto swapInterval = (PFNGLXSWAPINTERVALEXTPROC )glXGetProcAddressARB ((const GLubyte*)" glXSwapIntervalEXT" );
320+ if (swapInterval && glXGetCurrentDisplay ()) {
321+ swapInterval (glXGetCurrentDisplay (), glXGetCurrentDrawable (), enable);
322+ }
323+ #endif
324+ }
You can’t perform that action at this time.
0 commit comments