Compare commits

...

4 Commits

Author SHA1 Message Date
Er2 8652c2e8a6
Merge a5cf130e2c into 462165da19 2024-04-26 15:44:03 +03:00
Philip Rebohle 462165da19 [util] Add Deck profile for Fallout 4
Should fix the FPS problem on Deck OLED.
2024-04-26 14:34:08 +02:00
Philip Rebohle 3f27a0ee58 [util] Add a way to define app profiles exclusive to Steam Deck 2024-04-26 14:34:08 +02:00
Er2 a5cf130e2c Add FreeBSD support 2024-04-14 11:21:59 +03:00
7 changed files with 77 additions and 14 deletions

View File

@ -131,7 +131,13 @@ else
dxvk_wsi = get_option('dxvk_native_wsi')
if dxvk_wsi == 'sdl2'
lib_sdl2 = cpp.find_library('SDL2')
if platform == 'freebsd'
# kinda hacky
dxvk_include_dirs += ['/usr/local/include']
lib_sdl2 = dependency('SDL2', required: true)
else
lib_sdl2 = cpp.find_library('SDL2', required: true)
endif
compiler_args += ['-DDXVK_WSI_SDL2']
elif dxvk_wsi == 'glfw'
lib_glfw = cpp.find_library('glfw')

View File

@ -25,6 +25,8 @@ shift 2
opt_nopackage=0
opt_devbuild=0
opt_buildid=false
opt_64_only=0
opt_32_only=0
CC=${CC:="gcc"}
CXX=${CXX:="g++"}
@ -41,6 +43,12 @@ while [ $# -gt 0 ]; do
"--build-id")
opt_buildid=true
;;
"--64-only")
opt_64_only=1
;;
"--32-only")
opt_32_only=1
;;
*)
echo "Unrecognized option: $1" >&2
exit 1
@ -81,8 +89,12 @@ function package {
rm -R "dxvk-native-$DXVK_VERSION"
}
build_arch 64 lib
build_arch 32 lib32
if [ $opt_32_only -eq 0 ]; then
build_arch 64 lib
fi
if [ $opt_64_only -eq 0 ]; then
build_arch 32 lib32
fi
if [ $opt_nopackage -eq 0 ]; then
package

View File

@ -13,7 +13,10 @@
namespace dxvk {
const static std::vector<std::pair<const char*, Config>> g_appDefaults = {{
using ProfileList = std::vector<std::pair<const char*, Config>>;
const static ProfileList g_profiles = {{
/* Assassin's Creed Syndicate: amdags issues */
{ R"(\\ACS\.exe$)", {{
{ "dxgi.customVendorId", "10de" },
@ -909,6 +912,28 @@ namespace dxvk {
}};
const static ProfileList g_deckProfiles = {{
/* Fallout 4: Defaults to 45 FPS on OLED, but also breaks above 60 FPS */
{ R"(\\Fallout4\.exe$)", {{
{ "dxgi.syncInterval", "1" },
{ "dxgi.maxFrameRate", "60" },
}} },
}};
const Config* findProfile(const ProfileList& profiles, const std::string& appName) {
auto appConfig = std::find_if(profiles.begin(), profiles.end(),
[&appName] (const std::pair<const char*, Config>& pair) {
std::regex expr(pair.first, std::regex::extended | std::regex::icase);
return std::regex_search(appName, expr);
});
return appConfig != profiles.end()
? &appConfig->second
: nullptr;
}
static bool isWhitespace(char ch) {
return ch == ' ' || ch == '\x9' || ch == '\r';
}
@ -1158,20 +1183,22 @@ namespace dxvk {
Config Config::getAppConfig(const std::string& appName) {
auto appConfig = std::find_if(g_appDefaults.begin(), g_appDefaults.end(),
[&appName] (const std::pair<const char*, Config>& pair) {
std::regex expr(pair.first, std::regex::extended | std::regex::icase);
return std::regex_search(appName, expr);
});
const Config* config = nullptr;
if (appConfig != g_appDefaults.end()) {
if (env::getEnvVar("SteamDeck") == "1")
config = findProfile(g_deckProfiles, appName);
if (!config)
config = findProfile(g_profiles, appName);
if (config) {
// Inform the user that we loaded a default config
Logger::info(str::format("Found built-in config:"));
for (auto& pair : appConfig->second.m_options)
for (auto& pair : config->m_options)
Logger::info(str::format(" ", pair.first, " = ", pair.second));
return appConfig->second;
return *config;
}
return Config();

View File

@ -316,7 +316,11 @@ namespace dxvk {
switch (priority) {
default:
case ThreadPriority::Normal: policy = SCHED_OTHER; break;
#ifndef __linux__
case ThreadPriority::Lowest: policy = SCHED_OTHER; break;
#else
case ThreadPriority::Lowest: policy = SCHED_IDLE; break;
#endif
}
::pthread_setschedparam(this->native_handle(), policy, &param);
}

View File

@ -6,6 +6,9 @@
#ifdef __linux__
#include <unistd.h>
#include <limits.h>
#elif defined(__FreeBSD__)
#include <sys/sysctl.h>
#include <unistd.h>
#endif
#include "util_env.h"
@ -85,6 +88,17 @@ namespace dxvk::env {
size_t count = readlink("/proc/self/exe", exePath.data(), exePath.size());
return std::string(exePath.begin(), exePath.begin() + count);
#elif defined(__FreeBSD__)
int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, getpid()};
std::string exePath(PATH_MAX, '\0');
size_t size = exePath.size();
if (sysctl(mib, 4, exePath.data(), &size, NULL, 0) != 0) {
// throw error here?
return "";
}
return exePath;
#endif
}

View File

@ -1,6 +1,6 @@
#pragma once
#if defined(__linux__)
#if defined(__unix__)
#include <windows.h>
#include <dlfcn.h>

View File

@ -18,4 +18,4 @@ namespace dxvk::wsi {
return displayId < displayCount && displayId >= 0;
}
}
}