From def560ee2febd3a10ac483827e30407bb4dab972 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 11 Jan 2025 23:02:43 -0600 Subject: [PATCH] Revert "feat(ddprobe): allow to manually specify gpu preference (#3521)" This reverts commit 6a233cbcbfe1475d88bbedd03b848df205f2b268. --- docs/configuration.md | 31 ------------------ src/config.cpp | 2 -- src/config.h | 1 - src/platform/windows/display_base.cpp | 32 ++++++++----------- src_assets/common/assets/web/config.html | 1 - .../assets/web/configs/tabs/AudioVideo.vue | 12 ------- .../tabs/audiovideo/DisplayDeviceOptions.vue | 2 +- .../assets/web/public/assets/locale/en.json | 2 -- 8 files changed, 15 insertions(+), 68 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index fb36e1593d6..9a08d0c2bd3 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -848,37 +848,6 @@ editing the `conf` file in a text editor. Use the examples as reference. -### gpu_preference - - - - - - - - - - - - - - -
Description - 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). - @note{Applies to Windows only.} -
Default@code{} - -1 - @endcode
Example@code{} - 2 - @endcode
- ### output_name diff --git a/src/config.cpp b/src/config.cpp index 25a2f51eb58..40bbde61e1d 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -468,7 +468,6 @@ namespace config { {}, // capture {}, // encoder {}, // adapter_name - -1, // gpu_preference {}, // output_name { @@ -1122,7 +1121,6 @@ namespace config { string_f(vars, "capture", video.capture); string_f(vars, "encoder", video.encoder); string_f(vars, "adapter_name", video.adapter_name); - int_f(vars, "gpu_preference", video.gpu_preference); string_f(vars, "output_name", video.output_name); generic_f(vars, "dd_configuration_option", video.dd.configuration_option, dd::config_option_from_view); diff --git a/src/config.h b/src/config.h index c8fea38c9f0..e429f0a9918 100644 --- a/src/config.h +++ b/src/config.h @@ -77,7 +77,6 @@ namespace config { std::string capture; std::string encoder; std::string adapter_name; - int gpu_preference; std::string output_name; struct dd_t { diff --git a/src/platform/windows/display_base.cpp b/src/platform/windows/display_base.cpp index b52c3c3b041..3239c68b00c 100644 --- a/src/platform/windows/display_base.cpp +++ b/src/platform/windows/display_base.cpp @@ -386,7 +386,12 @@ namespace platf::dxgi { // would have been raised first if it wasn't. if (result == S_OK || result == E_ACCESSDENIED) { // We found a working GPU preference, so set ourselves to use that. - return set_gpu_preference_on_self(i); + if (set_gpu_preference_on_self(i)) { + return true; + } + else { + return false; + } } } @@ -413,25 +418,16 @@ namespace platf::dxgi { return true; } - // If the GPU preference was manually specified, we can skip the probe. - if (config::video.gpu_preference >= 0) { - if (set_gpu_preference_on_self(config::video.gpu_preference)) { - set_gpu_preference = true; - return true; - } + // 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; } - 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 (validate_and_test_gpu_preference(display_name, false)) { - set_gpu_preference = true; - return true; - } + // If no valid configuration was found, try again with verify_frame_capture == false + if (validate_and_test_gpu_preference(display_name, false)) { + set_gpu_preference = true; + return true; } // If neither worked, return false diff --git a/src_assets/common/assets/web/config.html b/src_assets/common/assets/web/config.html index e6f4f2f7362..d5ada9469e3 100644 --- a/src_assets/common/assets/web/config.html +++ b/src_assets/common/assets/web/config.html @@ -167,7 +167,6 @@

{{ $t('config.configuration') }}

"virtual_sink": "", "install_steam_audio_drivers": "enabled", "adapter_name": "", - "gpu_preference": -1, "output_name": "", "dd_configuration_option": "verify_only", "dd_resolution_option": "auto", diff --git a/src_assets/common/assets/web/configs/tabs/AudioVideo.vue b/src_assets/common/assets/web/configs/tabs/AudioVideo.vue index cfd7e373e02..6791a9c60db 100644 --- a/src_assets/common/assets/web/configs/tabs/AudioVideo.vue +++ b/src_assets/common/assets/web/configs/tabs/AudioVideo.vue @@ -68,18 +68,6 @@ const config = ref(props.config) :config="config" /> - - - - {{ $t('config.dd_config_revert_delay') }} -
{{ $t('config.dd_config_revert_delay_desc') }} diff --git a/src_assets/common/assets/web/public/assets/locale/en.json b/src_assets/common/assets/web/public/assets/locale/en.json index 3786a6824a4..57b8846eca8 100644 --- a/src_assets/common/assets/web/public/assets/locale/en.json +++ b/src_assets/common/assets/web/public/assets/locale/en.json @@ -199,8 +199,6 @@ "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.", "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_desc": "The file where current apps of Sunshine are stored.", "file_state": "State File",