mirror of
https://github.com/thinkonmay/sunshine-sdk.git
synced 2026-01-07 11:37:46 +00:00
feat(ddprobe): allow to manually specify gpu preference (#3521)
This commit is contained in:
parent
9b9767be0c
commit
6a233cbcbf
@ -848,6 +848,37 @@ editing the `conf` file in a text editor. Use the examples as reference.
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
### gpu_preference
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td>Description</td>
|
||||||
|
<td colspan="2">
|
||||||
|
Specify the GPU preference for the Sunshine process.
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
If set to negative number (-1 by default), Sunshine will try to detect the best GPU for the streamed display, but if it fails you will get a black screen.
|
||||||
|
<br>
|
||||||
|
Setting it to 0 will allow Windows to try and select the best GPU.
|
||||||
|
<br>
|
||||||
|
Setting it to 1 and above will prioritize the GPU that matches this number (the number has to be guessed, but it starts at 1 and increases).
|
||||||
|
@note{Applies to Windows only.}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Default</td>
|
||||||
|
<td colspan="2">@code{}
|
||||||
|
-1
|
||||||
|
@endcode</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Example</td>
|
||||||
|
<td colspan="2">@code{}
|
||||||
|
2
|
||||||
|
@endcode</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
### output_name
|
### output_name
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
|
|||||||
@ -436,6 +436,7 @@ namespace config {
|
|||||||
{}, // capture
|
{}, // capture
|
||||||
{}, // encoder
|
{}, // encoder
|
||||||
{}, // adapter_name
|
{}, // adapter_name
|
||||||
|
-1, // gpu_preference
|
||||||
{}, // output_name
|
{}, // output_name
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -1088,6 +1089,7 @@ namespace config {
|
|||||||
string_f(vars, "capture", video.capture);
|
string_f(vars, "capture", video.capture);
|
||||||
string_f(vars, "encoder", video.encoder);
|
string_f(vars, "encoder", video.encoder);
|
||||||
string_f(vars, "adapter_name", video.adapter_name);
|
string_f(vars, "adapter_name", video.adapter_name);
|
||||||
|
int_f(vars, "gpu_preference", video.gpu_preference);
|
||||||
string_f(vars, "output_name", video.output_name);
|
string_f(vars, "output_name", video.output_name);
|
||||||
|
|
||||||
generic_f(vars, "dd_configuration_option", video.dd.configuration_option, dd::config_option_from_view);
|
generic_f(vars, "dd_configuration_option", video.dd.configuration_option, dd::config_option_from_view);
|
||||||
|
|||||||
@ -77,6 +77,7 @@ namespace config {
|
|||||||
std::string capture;
|
std::string capture;
|
||||||
std::string encoder;
|
std::string encoder;
|
||||||
std::string adapter_name;
|
std::string adapter_name;
|
||||||
|
int gpu_preference;
|
||||||
std::string output_name;
|
std::string output_name;
|
||||||
|
|
||||||
struct dd_t {
|
struct dd_t {
|
||||||
|
|||||||
@ -386,12 +386,7 @@ namespace platf::dxgi {
|
|||||||
// would have been raised first if it wasn't.
|
// would have been raised first if it wasn't.
|
||||||
if (result == S_OK || result == E_ACCESSDENIED) {
|
if (result == S_OK || result == E_ACCESSDENIED) {
|
||||||
// We found a working GPU preference, so set ourselves to use that.
|
// We found a working GPU preference, so set ourselves to use that.
|
||||||
if (set_gpu_preference_on_self(i)) {
|
return set_gpu_preference_on_self(i);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -418,16 +413,25 @@ namespace platf::dxgi {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try probing with different GPU preferences and verify_frame_capture flag
|
// If the GPU preference was manually specified, we can skip the probe.
|
||||||
if (validate_and_test_gpu_preference(display_name, true)) {
|
if (config::video.gpu_preference >= 0) {
|
||||||
set_gpu_preference = true;
|
if (set_gpu_preference_on_self(config::video.gpu_preference)) {
|
||||||
return true;
|
set_gpu_preference = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
// Try probing with different GPU preferences and verify_frame_capture flag
|
||||||
|
if (validate_and_test_gpu_preference(display_name, true)) {
|
||||||
|
set_gpu_preference = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// If no valid configuration was found, try again with verify_frame_capture == false
|
// If no valid configuration was found, try again with verify_frame_capture == false
|
||||||
if (validate_and_test_gpu_preference(display_name, false)) {
|
if (validate_and_test_gpu_preference(display_name, false)) {
|
||||||
set_gpu_preference = true;
|
set_gpu_preference = true;
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If neither worked, return false
|
// If neither worked, return false
|
||||||
|
|||||||
@ -169,6 +169,7 @@
|
|||||||
"virtual_sink": "",
|
"virtual_sink": "",
|
||||||
"install_steam_audio_drivers": "enabled",
|
"install_steam_audio_drivers": "enabled",
|
||||||
"adapter_name": "",
|
"adapter_name": "",
|
||||||
|
"gpu_preference": -1,
|
||||||
"output_name": "",
|
"output_name": "",
|
||||||
"dd_configuration_option": "verify_only",
|
"dd_configuration_option": "verify_only",
|
||||||
"dd_resolution_option": "auto",
|
"dd_resolution_option": "auto",
|
||||||
|
|||||||
@ -69,6 +69,18 @@ const config = ref(props.config)
|
|||||||
:config="config"
|
:config="config"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<PlatformLayout :platform="platform">
|
||||||
|
<template #windows>
|
||||||
|
<!-- GPU Preference -->
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="gpu_preference" class="form-label">{{ $t('config.gpu_preference') }}</label>
|
||||||
|
<input type="number" class="form-control" id="gpu_preference" placeholder="-1" min="-1"
|
||||||
|
v-model="config.gpu_preference" />
|
||||||
|
<div class="form-text">{{ $t('config.gpu_preference_desc') }}</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</PlatformLayout>
|
||||||
|
|
||||||
<DisplayOutputSelector
|
<DisplayOutputSelector
|
||||||
:platform="platform"
|
:platform="platform"
|
||||||
:config="config"
|
:config="config"
|
||||||
|
|||||||
@ -108,7 +108,7 @@ const config = ref(props.config)
|
|||||||
<label for="dd_config_revert_delay" class="form-label">
|
<label for="dd_config_revert_delay" class="form-label">
|
||||||
{{ $t('config.dd_config_revert_delay') }}
|
{{ $t('config.dd_config_revert_delay') }}
|
||||||
</label>
|
</label>
|
||||||
<input type="text" class="form-control" id="dd_config_revert_delay" placeholder="3000"
|
<input type="number" class="form-control" id="dd_config_revert_delay" placeholder="3000" min="0"
|
||||||
v-model="config.dd_config_revert_delay" />
|
v-model="config.dd_config_revert_delay" />
|
||||||
<div class="form-text">
|
<div class="form-text">
|
||||||
{{ $t('config.dd_config_revert_delay_desc') }}
|
{{ $t('config.dd_config_revert_delay_desc') }}
|
||||||
|
|||||||
@ -186,6 +186,8 @@
|
|||||||
"fec_percentage": "FEC Percentage",
|
"fec_percentage": "FEC Percentage",
|
||||||
"fec_percentage_desc": "Percentage of error correcting packets per data packet in each video frame. Higher values can correct for more network packet loss, but at the cost of increasing bandwidth usage.",
|
"fec_percentage_desc": "Percentage of error correcting packets per data packet in each video frame. Higher values can correct for more network packet loss, but at the cost of increasing bandwidth usage.",
|
||||||
"ffmpeg_auto": "auto -- let ffmpeg decide (default)",
|
"ffmpeg_auto": "auto -- let ffmpeg decide (default)",
|
||||||
|
"gpu_preference": "GPU Preference",
|
||||||
|
"gpu_preference_desc": "Specify the GPU preference for the Sunshine process. If set to negative number (-1 by default), Sunshine will try to detect the best GPU for the streamed display, but if it fails you will get a black screen. Setting it to 0 will allow Windows to try and select the best GPU. Setting it to 1 and above will prioritize the GPU that matches this number (the number has to be guessed, but it starts at 1 and increases).",
|
||||||
"file_apps": "Apps File",
|
"file_apps": "Apps File",
|
||||||
"file_apps_desc": "The file where current apps of Sunshine are stored.",
|
"file_apps_desc": "The file where current apps of Sunshine are stored.",
|
||||||
"file_state": "State File",
|
"file_state": "State File",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user