Although FreeBSD doesn't have Game Mode like Windows, it is possible to create here something very similar, which allows achieving better performance in games. And not only in games. ;) Below I present my observations and propositions in this topic. Of course, everything here is subjective, and you should check it with a bit of salt. :) As I'm using Nvidia cards, the most of the advices will work best on that cards. Perhaps over time this post will be extended or changed. There will be definitely information about changes here.
Suggestions presented below are related to FreeBSD itself, like the system's configuration, selection of software to install or how to run games. These settings have impact not only on an executed game but affect the entire system. They also can have the biggest impact on a game's performance.
Definitely X server. In the moment of writing of the article, X server is the best solution for players. Most games, especially commercial ones are available mostly on Windows. And other platforms usually are treated as bonus. It means, these games will be run through Wine. Support for Wayland is in early stage of development, so such game will use XWayland to work. And this will cause serious performance drops (depends on hardware) in games. Also, most of windows managers for Wayland isn't good optimized for games, what causes additional issues. And about poor Nvidia support for Wayland I even don't want to write. ;)
Currently, on the list of FreeBSD packages there are 3 versions of Wine: stable, development and version from Valve. I definitely recommend using the last, wine-proton. Not only more games work with it, additionally this version has added various fixes which make that wine-proton is much more efficient than standard versions of Wine. wine-proton is also more active maintained, it has some patches specific for FreeBSD.
Generally, the option allows setting how often the CPU scheduler switch between various tasks, assigning or taking a CPU's cores to a task. If we want to make tasks less frequently interrupted, we set it to a high value. A low value will cause more often interruptions. From my experience and observations, during playing games, it is worth to set this option even on 0 (zero), forcing almost constant switching between tasks. From the other side, during using FreeBSD as a daily desktop, it is better to set it very high, for example 224. The maximum value is 250. Setting the option to 0 can give even 30% boost to games' performance as not only higher FPS but also a game can load fast or work more smoothly. From the second side with that setting it is almost impossible to use the system in daily work. If we try to watch YouTube or listen to Spotify, the quality of sound or video will be simply tragic. It will be because of the game will take almost the whole time of CPU. Additionally, I noticed higher RAM usage by games (around 10-15% more) when this option is set to zero. That's why it is good to change this setting before starting a game and restore it after finishing a game. This option probably most resembles the Game Mode from Windows. :)
Initially I thought that giving a game a high priority, like on Windows systems, would improve performance. Of course, on FreeBSD such a solution can only be done via the renice command. After all, we don't want to run our game as the root. :) The result of the experiment was quite surprising: a drop in game performance. :o Out of curiosity I decided to do the opposite, lower a game priority. The result: a small gain in performance and a slight elimination of issues related to setting kern.sched.preempt_thresh to zero. To tell the truth, I'm not sure what causes such a dependency. Perhaps the fact that graphics in the X server are handled differently than in Wayland or Windows systems. In any case, it is worth testing the game with nice settings between 2 and 5. Higher values cause visible drops in performance. Lower ones have no effect on a game.
The following tips have only been tested on Nvidia cards. They may not work, work differently, or even be unavailable on AMD or Intel cards. Integrated cards are a joke, not graphics cards. :P All settings work as environment variables, some of these settings can even be added permanently to the system to improve performance. All variables names related to Nvidia cards start with a double underscore.
Using multiple threads for OpenGL/Vulkan. In theory, this setting should help achieve better performance in games. In practice, it's usually the other way around. :) Especially under heavy CPU load, this setting can significantly affect the gaming experience. That's why I recommend disabling it for each game. export __GL_THREADED_OPTIMIZATIONS=0. To enable it again, set its value to 1.
Another option worth turning off. Synchronizing FPS in the game with the screen refresh rate. Usually, turning this option on is asking for trouble. :) There may be delays with input (keyboard, mouse), low game smoothness or even game freezes. The reason is that most games have only one loop in which all operations are performed. This means that such a limitation, which should only affect graphics, affects the entire game. Therefore, the best solution is export __GL_SYNC_TO_VBLANK=0
Antialiasing mode. Usually a much better solution than setting it globally is to set it inside each game separately. That's why it's a good idea to disable this option completely: export __GL_FSAA_MODE=0
This option is very useful in games that use shaders very intensively, such as Warframe or Overwatch. It disables the disk space limit for precompiled shaders. Thanks to this, the system does not delete them when they reach a certain size. In the case of games that use shaders intensively, this can have a significant impact on performance, and certainly on a game's loading times. That is why we enable this option: export __GL_SHADER_DISK_CACHE_SKIP_CLEANUP=1
By default, the Nvidia card works in adaptive mode when it comes to performance. It switches to a higher or lower mode depending on the demand. Unfortunately, this mechanism does not always work correctly. Therefore, it is a good idea to manually set it to maximum performance before starting the game, by executing the command: nvidia-settings -a '[gpu:0]/GPUPowerMizerMode=1'. [gpu:0] is the number of our Nvidia card, when there is only one card installed, it will be zero.
As with Nvidia cards, these settings come in the form of environment variables. Again, it's worth setting some of them as global, as they can help with performance with any Windows game.
This variable sets the level of logs that Wine prints when the game runs. It is a good idea to disable logs completely. This can give a performance boost even on the newest graphics cards and CPU's. Not to mention significant savings in disk space. My log record was almost at the level of a Facebook's web server's logs - about 5 Mb of logs per minute. :) That is why it is a good idea to have this setting globally as: export WINEDEBUG=-all. No logs.
Installing it is mandatory. :) It significantly improves performance in games and in older games based on DirectX 9 or lower it achieve even higher performance than in the case of Windows systems. :) You can do it manually, by downloading from project page or using the winetricks program: winetricks dxvk. There is one setting related to DXVK worth mentioning: DXVK_LOG_LEVEL. Similar to WINEDEBUG, it affects the level of logs printed by DXVK. It is also worth disabling this option to achieve slightly better performance in games: export DXVK_LOG_LEVEL=none
This setting only works with wine-proton. It allows us to use special shared memory by Wine. This can lead to significant performance gains in Windows games. Therefore, I recommend enabling this option: export STAGING_SHARED_MEMORY=1
I guess that's all on this topic for now. Of course, there are more things which can be configured or modified. But this post starts to be a bit long. :) Feel free to contact me with any comments or suggestions regarding this topic.
If you want to see how this information can be used, I invite you to visit my project gameboost. I use it to run most games, usually only slightly modifying the script.