Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(display): expose HDR toggle workaround delay to user #3579

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -1154,28 +1154,29 @@ editing the `conf` file in a text editor. Use the examples as reference.
</tr>
</table>

### dd_wa_hdr_toggle
### dd_wa_hdr_toggle_delay

<table>
<tr>
<td>Description</td>
<td colspan="2">
When using virtual display device as for streaming, it might display incorrect (high-contrast) color.
With this option enabled, Sunshine will try to mitigate this issue.
When using virtual display device (VDD) for streaming, it might incorrectly display HDR color. Sunshine can try to mitigate this issue, by turning HDR off and then on again.<br>
If the value is set to 0, the workaround is disabled (default). If the value is between 0 and 3000 milliseconds, Sunshine will turn off HDR, wait for the specified amount of time and then turn HDR on again. The recommended delay time is around 500 milliseconds in most cases.<br>
DO NOT use this workaround unless you actually have issues with HDR as it directly impacts stream start time!
@note{This option works independently of [dd_hdr_option](#dd_hdr_option)}
@note{Applies to Windows only.}
</td>
</tr>
<tr>
<td>Default</td>
<td colspan="2">@code{}
disabled
0
@endcode</td>
</tr>
<tr>
<td>Example</td>
<td colspan="2">@code{}
dd_wa_hdr_toggle = enabled
dd_wa_hdr_toggle_delay = 500
@endcode</td>
</tr>
</table>
Expand Down
6 changes: 5 additions & 1 deletion src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1133,7 +1133,11 @@
}
}
generic_f(vars, "dd_mode_remapping", video.dd.mode_remapping, dd::mode_remapping_from_view);
bool_f(vars, "dd_wa_hdr_toggle", video.dd.wa.hdr_toggle);
{
int value = 0;

Check warning on line 1137 in src/config.cpp

View check run for this annotation

Codecov / codecov/patch

src/config.cpp#L1137

Added line #L1137 was not covered by tests
int_between_f(vars, "dd_wa_hdr_toggle_delay", value, {0, 3000});
video.dd.wa.hdr_toggle_delay = std::chrono::milliseconds {value};
}

int_between_f(vars, "min_fps_factor", video.min_fps_factor, {1, 3});

Expand Down
2 changes: 1 addition & 1 deletion src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ namespace config {

struct dd_t {
struct workarounds_t {
bool hdr_toggle; ///< Specify whether to apply HDR high-contrast color workaround.
std::chrono::milliseconds hdr_toggle_delay; ///< Specify whether to apply HDR high-contrast color workaround and what delay to use.
};

enum class config_option_e {
Expand Down
2 changes: 1 addition & 1 deletion src/display_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ namespace display_device {
std::make_shared<FileSettingsPersistence>(persistence_filepath)
),
WinWorkarounds {
.m_hdr_blank_delay = video_config.dd.wa.hdr_toggle ? std::make_optional(500ms) : std::nullopt
.m_hdr_blank_delay = video_config.dd.wa.hdr_toggle_delay != std::chrono::milliseconds::zero() ? std::make_optional(video_config.dd.wa.hdr_toggle_delay) : std::nullopt
}
);
#else
Expand Down
2 changes: 1 addition & 1 deletion src_assets/common/assets/web/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ <h1 class="my-4">{{ $t('config.configuration') }}</h1>
"dd_hdr_option": "auto",
"dd_config_revert_delay": 3000,
"dd_mode_remapping": {"mixed": [], "resolution_only": [], "refresh_rate_only": []},
"dd_wa_hdr_toggle": "disabled",
"dd_wa_hdr_toggle_delay": 0,
"min_fps_factor": 1,
},
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script setup>
import { ref } from 'vue'
import PlatformLayout from '../../../PlatformLayout.vue'
import Checkbox from "../../../Checkbox.vue";

const props = defineProps({
platform: String,
Expand Down Expand Up @@ -132,11 +131,18 @@ function addRemappingEntry() {
<option value="auto">{{ $t('config.dd_hdr_option_auto') }}</option>
</select>
<!-- HDR toggle -->
<Checkbox id="dd_wa_hdr_toggle"
locale-prefix="config"
v-model="config.dd_wa_hdr_toggle"
default="false"
></Checkbox>
<label for="dd_wa_hdr_toggle_delay" class="form-label">
{{ $t('config.dd_wa_hdr_toggle_delay') }}
</label>
<input type="number" class="form-control" id="dd_wa_hdr_toggle_delay" placeholder="0" min="0" max="3000"
v-model="config.dd_wa_hdr_toggle_delay" />
<div class="form-text">
{{ $t('config.dd_wa_hdr_toggle_delay_desc_1') }}
<br>
{{ $t('config.dd_wa_hdr_toggle_delay_desc_2') }}
<br>
{{ $t('config.dd_wa_hdr_toggle_delay_desc_3') }}
</div>
</div>

<!-- Config revert delay -->
Expand Down
6 changes: 4 additions & 2 deletions src_assets/common/assets/web/public/assets/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,10 @@
"dd_resolution_option_manual": "Use manually entered resolution",
"dd_resolution_option_manual_desc": "Enter the resolution to be used",
"dd_resolution_option_ogs_desc": "\"Optimize game settings\" option must be enabled on the Moonlight client for this to work.",
"dd_wa_hdr_toggle_desc": "When using virtual display device as for streaming, it might display incorrect HDR color. With this option enabled, Sunshine will try to mitigate this issue.",
"dd_wa_hdr_toggle": "Enable high-contrast workaround for HDR",
"dd_wa_hdr_toggle_delay_desc_1": "When using virtual display device (VDD) for streaming, it might incorrectly display HDR color. Sunshine can try to mitigate this issue, by turning HDR off and then on again.",
"dd_wa_hdr_toggle_delay_desc_2": "If the value is set to 0, the workaround is disabled (default). If the value is between 0 and 3000 milliseconds, Sunshine will turn off HDR, wait for the specified amount of time and then turn HDR on again. The recommended delay time is around 500 milliseconds in most cases.",
"dd_wa_hdr_toggle_delay_desc_3": "DO NOT use this workaround unless you actually have issues with HDR as it directly impacts stream start time!",
"dd_wa_hdr_toggle_delay": "High-contrast workaround for HDR",
"ds4_back_as_touchpad_click": "Map Back/Select to Touchpad Click",
"ds4_back_as_touchpad_click_desc": "When forcing DS4 emulation, map Back/Select to Touchpad Click",
"encoder": "Force a Specific Encoder",
Expand Down
Loading