Support EGL VSync on Wayland.

Add support for `eglSwapInterval()` to enable or disable VSync on
Wayland.

Also add status messages for enabling or disabling VSync, for both EGL
and GLX.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2022-10-21 19:19:28 +00:00
parent c27d384a53
commit ec27885c36
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
3 changed files with 103 additions and 62 deletions

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-10-15 15:34-0700\n" "POT-Creation-Date: 2022-10-21 19:17+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,55 +17,55 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n" "Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: wxvbam.cpp:227 #: wxvbam.cpp:259
msgid "visualboyadvance-m" msgid "visualboyadvance-m"
msgstr "" msgstr ""
#: wxvbam.cpp:448 #: wxvbam.cpp:482
msgid "Could not create main window" msgid "Could not create main window"
msgstr "" msgstr ""
#: wxvbam.cpp:519 #: wxvbam.cpp:553
msgid "Save built-in XRC file and exit" msgid "Save built-in XRC file and exit"
msgstr "" msgstr ""
#: wxvbam.cpp:522 #: wxvbam.cpp:556
msgid "Save built-in vba-over.ini and exit" msgid "Save built-in vba-over.ini and exit"
msgstr "" msgstr ""
#: wxvbam.cpp:525 #: wxvbam.cpp:559
msgid "Print configuration path and exit" msgid "Print configuration path and exit"
msgstr "" msgstr ""
#: wxvbam.cpp:528 #: wxvbam.cpp:562
msgid "Start in full-screen mode" msgid "Start in full-screen mode"
msgstr "" msgstr ""
#: wxvbam.cpp:531 #: wxvbam.cpp:565
msgid "Set a configuration file" msgid "Set a configuration file"
msgstr "" msgstr ""
#: wxvbam.cpp:535 #: wxvbam.cpp:569
msgid "Delete shared link state first, if it exists" msgid "Delete shared link state first, if it exists"
msgstr "" msgstr ""
#: wxvbam.cpp:542 #: wxvbam.cpp:576
msgid "List all settable options and exit" msgid "List all settable options and exit"
msgstr "" msgstr ""
#: wxvbam.cpp:545 #: wxvbam.cpp:579
msgid "ROM file" msgid "ROM file"
msgstr "" msgstr ""
#: wxvbam.cpp:547 #: wxvbam.cpp:581
msgid "<config>=<value>" msgid "<config>=<value>"
msgstr "" msgstr ""
#: wxvbam.cpp:578 #: wxvbam.cpp:612
msgid "Configuration/build error: can't find built-in xrc" msgid "Configuration/build error: can't find built-in xrc"
msgstr "" msgstr ""
#: wxvbam.cpp:586 #: wxvbam.cpp:620
#, c-format #, c-format
msgid "" msgid ""
"Wrote built-in configuration to %s.\n" "Wrote built-in configuration to %s.\n"
@ -74,11 +74,11 @@ msgid ""
"built-in:" "built-in:"
msgstr "" msgstr ""
#: wxvbam.cpp:601 #: wxvbam.cpp:635
msgid "Configuration is read from, in order:" msgid "Configuration is read from, in order:"
msgstr "" msgstr ""
#: wxvbam.cpp:615 #: wxvbam.cpp:649
#, c-format #, c-format
msgid "" msgid ""
"Wrote built-in override file to %s\n" "Wrote built-in override file to %s\n"
@ -86,13 +86,13 @@ msgid ""
"from search path:" "from search path:"
msgstr "" msgstr ""
#: wxvbam.cpp:621 #: wxvbam.cpp:655
msgid "" msgid ""
"\n" "\n"
"\tbuilt-in" "\tbuilt-in"
msgstr "" msgstr ""
#: wxvbam.cpp:636 #: wxvbam.cpp:670
msgid "" msgid ""
"Options set from the command line are saved if any configuration changes are " "Options set from the command line are saved if any configuration changes are "
"made in the user interface.\n" "made in the user interface.\n"
@ -101,17 +101,17 @@ msgid ""
"\n" "\n"
msgstr "" msgstr ""
#: wxvbam.cpp:644 #: wxvbam.cpp:678
msgid "" msgid ""
"The commands available for the Keyboard/* option are:\n" "The commands available for the Keyboard/* option are:\n"
"\n" "\n"
msgstr "" msgstr ""
#: wxvbam.cpp:655 #: wxvbam.cpp:689
msgid "Configuration file not found." msgid "Configuration file not found."
msgstr "" msgstr ""
#: wxvbam.cpp:688 #: wxvbam.cpp:722
msgid "Bad configuration option or multiple ROM files given:\n" msgid "Bad configuration option or multiple ROM files given:\n"
msgstr "" msgstr ""
@ -163,7 +163,7 @@ msgstr ""
msgid "VBA cheat lists (*.clt)|*.clt|CHT cheat lists (*.cht)|*.cht" msgid "VBA cheat lists (*.clt)|*.clt|CHT cheat lists (*.cht)|*.cht"
msgstr "" msgstr ""
#: guiinit.cpp:263 panel.cpp:449 #: guiinit.cpp:263 panel.cpp:453
msgid "Loaded cheats" msgid "Loaded cheats"
msgstr "" msgstr ""
@ -619,7 +619,7 @@ msgstr ""
msgid "Confirm import" msgid "Confirm import"
msgstr "" msgstr ""
#: cmdevents.cpp:910 panel.cpp:392 #: cmdevents.cpp:910 panel.cpp:396
#, c-format #, c-format
msgid "Loaded battery %s" msgid "Loaded battery %s"
msgstr "" msgstr ""
@ -702,7 +702,7 @@ msgstr ""
msgid "Wrote battery %s" msgid "Wrote battery %s"
msgstr "" msgstr ""
#: cmdevents.cpp:1103 panel.cpp:701 #: cmdevents.cpp:1103 panel.cpp:705
#, c-format #, c-format
msgid "Error writing battery %s" msgid "Error writing battery %s"
msgstr "" msgstr ""
@ -808,7 +808,7 @@ msgstr ""
msgid "Using interframe blending: %s" msgid "Using interframe blending: %s"
msgstr "" msgstr ""
#: cmdevents.cpp:2827 panel.cpp:194 panel.cpp:308 #: cmdevents.cpp:2827 panel.cpp:198 panel.cpp:312
msgid "Could not initialize the sound driver!" msgid "Could not initialize the sound driver!"
msgstr "" msgstr ""
@ -941,161 +941,177 @@ msgstr ""
msgid "Error setting up server socket (%d)" msgid "Error setting up server socket (%d)"
msgstr "" msgstr ""
#: panel.cpp:108 #: panel.cpp:112
#, c-format #, c-format
msgid "%s is not a valid ROM file" msgid "%s is not a valid ROM file"
msgstr "" msgstr ""
#: panel.cpp:109 panel.cpp:170 panel.cpp:246 #: panel.cpp:113 panel.cpp:174 panel.cpp:250
msgid "Problem loading file" msgid "Problem loading file"
msgstr "" msgstr ""
#: panel.cpp:169 #: panel.cpp:173
#, c-format #, c-format
msgid "Unable to load Game Boy ROM %s" msgid "Unable to load Game Boy ROM %s"
msgstr "" msgstr ""
#: panel.cpp:206 #: panel.cpp:210
msgid "" msgid ""
"Cannot use GB BIOS file when Colorizer Hack is enabled, disabling GB BIOS " "Cannot use GB BIOS file when Colorizer Hack is enabled, disabling GB BIOS "
"file." "file."
msgstr "" msgstr ""
#: panel.cpp:222 panel.cpp:322 #: panel.cpp:226 panel.cpp:326
#, c-format #, c-format
msgid "Could not load BIOS %s" msgid "Could not load BIOS %s"
msgstr "" msgstr ""
#: panel.cpp:245 #: panel.cpp:249
#, c-format #, c-format
msgid "Unable to load Game Boy Advance ROM %s" msgid "Unable to load Game Boy Advance ROM %s"
msgstr "" msgstr ""
#: panel.cpp:481 #: panel.cpp:485
msgid " player " msgid " player "
msgstr "" msgstr ""
#: panel.cpp:649 #: panel.cpp:653
#, c-format #, c-format
msgid "Loaded state %s" msgid "Loaded state %s"
msgstr "" msgstr ""
#: panel.cpp:649 #: panel.cpp:653
#, c-format #, c-format
msgid "Error loading state %s" msgid "Error loading state %s"
msgstr "" msgstr ""
#: panel.cpp:673 #: panel.cpp:677
#, c-format #, c-format
msgid "Saved state %s" msgid "Saved state %s"
msgstr "" msgstr ""
#: panel.cpp:673 #: panel.cpp:677
#, c-format #, c-format
msgid "Error saving state %s" msgid "Error saving state %s"
msgstr "" msgstr ""
#: panel.cpp:877 #: panel.cpp:882
#, c-format #, c-format
msgid "Fullscreen mode %dx%d-%d@%d not supported; looking for another" msgid "Fullscreen mode %dx%d-%d@%d not supported; looking for another"
msgstr "" msgstr ""
#: panel.cpp:915 #: panel.cpp:920
#, c-format #, c-format
msgid "Fullscreen mode %dx%d-%d@%d not supported" msgid "Fullscreen mode %dx%d-%d@%d not supported"
msgstr "" msgstr ""
#: panel.cpp:920 #: panel.cpp:925
#, c-format #, c-format
msgid "Valid mode: %dx%d-%d@%d" msgid "Valid mode: %dx%d-%d@%d"
msgstr "" msgstr ""
#: panel.cpp:928 #: panel.cpp:933
#, c-format #, c-format
msgid "Chose mode %dx%d-%d@%d" msgid "Chose mode %dx%d-%d@%d"
msgstr "" msgstr ""
#: panel.cpp:932 #: panel.cpp:937
#, c-format #, c-format
msgid "Failed to change mode to %dx%d-%d@%d" msgid "Failed to change mode to %dx%d-%d@%d"
msgstr "" msgstr ""
#: panel.cpp:1020 #: panel.cpp:1025
msgid "Not a valid GBA cartridge" msgid "Not a valid GBA cartridge"
msgstr "" msgstr ""
#: panel.cpp:1184 #: panel.cpp:1189
msgid "No memory for rewinding" msgid "No memory for rewinding"
msgstr "" msgstr ""
#: panel.cpp:1194 #: panel.cpp:1199
msgid "Error writing rewind state" msgid "Error writing rewind state"
msgstr "" msgstr ""
#: panel.cpp:2192 #: panel.cpp:2186
msgid "Enabling EGL VSync."
msgstr ""
#: panel.cpp:2188
msgid "Disabling EGL VSync."
msgstr ""
#: panel.cpp:2195
msgid "Enabling GLX VSync."
msgstr ""
#: panel.cpp:2197
msgid "Disabling GLX VSync."
msgstr ""
#: panel.cpp:2215
msgid "Failed to set glXSwapIntervalEXT" msgid "Failed to set glXSwapIntervalEXT"
msgstr "" msgstr ""
#: panel.cpp:2201 #: panel.cpp:2224
msgid "Failed to set glXSwapIntervalSGI" msgid "Failed to set glXSwapIntervalSGI"
msgstr "" msgstr ""
#: panel.cpp:2210 #: panel.cpp:2233
msgid "Failed to set glXSwapIntervalMESA" msgid "Failed to set glXSwapIntervalMESA"
msgstr "" msgstr ""
#: panel.cpp:2216 #: panel.cpp:2240
msgid "No support for wglGetExtensionsStringEXT" msgid "No support for wglGetExtensionsStringEXT"
msgstr "" msgstr ""
#: panel.cpp:2219 #: panel.cpp:2243
msgid "No support for WGL_EXT_swap_control" msgid "No support for WGL_EXT_swap_control"
msgstr "" msgstr ""
#: panel.cpp:2228 #: panel.cpp:2252
msgid "Failed to set wglSwapIntervalEXT" msgid "Failed to set wglSwapIntervalEXT"
msgstr "" msgstr ""
#: panel.cpp:2234 #: panel.cpp:2258
msgid "No VSYNC available on this platform" msgid "No VSYNC available on this platform"
msgstr "" msgstr ""
#: panel.cpp:2330 #: panel.cpp:2354
msgid "memory allocation error" msgid "memory allocation error"
msgstr "" msgstr ""
#: panel.cpp:2333 #: panel.cpp:2357
msgid "error initializing codec" msgid "error initializing codec"
msgstr "" msgstr ""
#: panel.cpp:2336 #: panel.cpp:2360
msgid "error writing to output file" msgid "error writing to output file"
msgstr "" msgstr ""
#: panel.cpp:2339 #: panel.cpp:2363
msgid "can't guess output format from file name" msgid "can't guess output format from file name"
msgstr "" msgstr ""
#: panel.cpp:2344 #: panel.cpp:2368
msgid "programming error; aborting!" msgid "programming error; aborting!"
msgstr "" msgstr ""
#: panel.cpp:2356 panel.cpp:2385 #: panel.cpp:2380 panel.cpp:2409
#, c-format #, c-format
msgid "Unable to begin recording to %s (%s)" msgid "Unable to begin recording to %s (%s)"
msgstr "" msgstr ""
#: panel.cpp:2413 #: panel.cpp:2437
#, c-format #, c-format
msgid "Error in audio/video recording (%s); aborting" msgid "Error in audio/video recording (%s); aborting"
msgstr "" msgstr ""
#: panel.cpp:2419 #: panel.cpp:2443
#, c-format #, c-format
msgid "Error in audio recording (%s); aborting" msgid "Error in audio recording (%s); aborting"
msgstr "" msgstr ""
#: panel.cpp:2429 #: panel.cpp:2453
#, c-format #, c-format
msgid "Error in video recording (%s); aborting" msgid "Error in video recording (%s); aborting"
msgstr "" msgstr ""

View File

@ -87,6 +87,13 @@ if(NOT WIN32 AND NOT APPLE)
list(APPEND VBAM_LIBS ${X11_Xscreensaver_LIB}) list(APPEND VBAM_LIBS ${X11_Xscreensaver_LIB})
add_definitions(-DHAVE_XSS) add_definitions(-DHAVE_XSS)
endif() endif()
find_library(EGL_LIBRARY EGL)
if(EGL_LIBRARY)
list(APPEND VBAM_LIBS ${EGL_LIBRARY})
add_definitions(-DHAVE_EGL)
endif()
endif() endif()
# Win32 definitions common to all toolchains. # Win32 definitions common to all toolchains.

View File

@ -8,6 +8,10 @@
#define Status int #define Status int
#include <gdk/gdkx.h> #include <gdk/gdkx.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
// For Wayland EGL.
#ifdef HAVE_EGL
#include <EGL/egl.h>
#endif
#ifdef HAVE_XSS #ifdef HAVE_XSS
#include <X11/extensions/scrnsaver.h> #include <X11/extensions/scrnsaver.h>
#endif #endif
@ -2176,8 +2180,22 @@ void GLDrawingPanel::DrawingPanelInit()
glClearColor(0.0, 0.0, 0.0, 1.0); glClearColor(0.0, 0.0, 0.0, 1.0);
// non-portable vsync code // non-portable vsync code
#if defined(__WXGTK__) #if defined(__WXGTK__)
// TODO: Use Wayland EGL equivalent to enable/disable vsync. if (IsItWayland()) {
if (!IsItWayland()) { #ifdef HAVE_EGL
if (vsync)
systemScreenMessage(_("Enabling EGL VSync."));
else
systemScreenMessage(_("Disabling EGL VSync."));
eglSwapInterval(0, vsync);
#endif
}
else {
if (vsync)
systemScreenMessage(_("Enabling GLX VSync."));
else
systemScreenMessage(_("Disabling GLX VSync."));
static PFNGLXSWAPINTERVALEXTPROC glXSwapIntervalEXT = NULL; static PFNGLXSWAPINTERVALEXTPROC glXSwapIntervalEXT = NULL;
static PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI = NULL; static PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI = NULL;
static PFNGLXSWAPINTERVALMESAPROC glXSwapIntervalMESA = NULL; static PFNGLXSWAPINTERVALMESAPROC glXSwapIntervalMESA = NULL;