fix(linux): enable lowlatency mode for AMD (#3088)
This commit is contained in:
parent
ddd67ce01d
commit
bf92fda969
5 changed files with 100 additions and 0 deletions
|
|
@ -612,6 +612,23 @@ namespace platf {
|
|||
void
|
||||
restart();
|
||||
|
||||
/**
|
||||
* @brief Set an environment variable.
|
||||
* @param name The name of the environment variable.
|
||||
* @param value The value to set the environment variable to.
|
||||
* @return 0 on success, non-zero on failure.
|
||||
*/
|
||||
int
|
||||
set_env(const std::string &name, const std::string &value);
|
||||
|
||||
/**
|
||||
* @brief Unset an environment variable.
|
||||
* @param name The name of the environment variable.
|
||||
* @return 0 on success, non-zero on failure.
|
||||
*/
|
||||
int
|
||||
unset_env(const std::string &name);
|
||||
|
||||
struct buffer_descriptor_t {
|
||||
const char *buffer;
|
||||
size_t size;
|
||||
|
|
|
|||
|
|
@ -326,6 +326,16 @@ namespace platf {
|
|||
lifetime::exit_sunshine(0, true);
|
||||
}
|
||||
|
||||
int
|
||||
set_env(const std::string &name, const std::string &value) {
|
||||
return setenv(name.c_str(), value.c_str(), 1);
|
||||
}
|
||||
|
||||
int
|
||||
unset_env(const std::string &name) {
|
||||
return unsetenv(name.c_str());
|
||||
}
|
||||
|
||||
bool
|
||||
request_process_group_exit(std::uintptr_t native_handle) {
|
||||
if (kill(-((pid_t) native_handle), SIGTERM) == 0 || errno == ESRCH) {
|
||||
|
|
@ -913,6 +923,10 @@ namespace platf {
|
|||
|
||||
std::unique_ptr<deinit_t>
|
||||
init() {
|
||||
// enable low latency mode for AMD
|
||||
// https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30039
|
||||
set_env("AMD_DEBUG", "lowlatency");
|
||||
|
||||
// These are allowed to fail.
|
||||
gbm::init();
|
||||
|
||||
|
|
|
|||
|
|
@ -253,6 +253,16 @@ namespace platf {
|
|||
lifetime::exit_sunshine(0, true);
|
||||
}
|
||||
|
||||
int
|
||||
set_env(const std::string &name, const std::string &value) {
|
||||
return setenv(name.c_str(), value.c_str(), 1);
|
||||
}
|
||||
|
||||
int
|
||||
unset_env(const std::string &name) {
|
||||
return unsetenv(name.c_str());
|
||||
}
|
||||
|
||||
bool
|
||||
request_process_group_exit(std::uintptr_t native_handle) {
|
||||
if (killpg((pid_t) native_handle, SIGTERM) == 0 || errno == ESRCH) {
|
||||
|
|
|
|||
|
|
@ -1313,6 +1313,16 @@ namespace platf {
|
|||
lifetime::exit_sunshine(0, true);
|
||||
}
|
||||
|
||||
int
|
||||
set_env(const std::string &name, const std::string &value) {
|
||||
return _putenv_s(name.c_str(), value.c_str());
|
||||
}
|
||||
|
||||
int
|
||||
unset_env(const std::string &name) {
|
||||
return _putenv_s(name.c_str(), "");
|
||||
}
|
||||
|
||||
struct enum_wnd_context_t {
|
||||
std::set<DWORD> process_ids;
|
||||
bool requested_exit;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue