Skip to content

Commit 71779ae

Browse files
committed
feat(display): expose HDR toggle workaround delay to user
1 parent 23e1314 commit 71779ae

File tree

7 files changed

+30
-17
lines changed

7 files changed

+30
-17
lines changed

docs/configuration.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,28 +1154,29 @@ editing the `conf` file in a text editor. Use the examples as reference.
11541154
</tr>
11551155
</table>
11561156

1157-
### dd_wa_hdr_toggle
1157+
### dd_wa_hdr_toggle_delay
11581158

11591159
<table>
11601160
<tr>
11611161
<td>Description</td>
11621162
<td colspan="2">
1163-
When using virtual display device as for streaming, it might display incorrect (high-contrast) color.
1164-
With this option enabled, Sunshine will try to mitigate this issue.
1163+
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>
1164+
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>
1165+
DO NOT use this workaround unless you actually have issues with HDR as it directly impacts stream start time!
11651166
@note{This option works independently of [dd_hdr_option](#dd_hdr_option)}
11661167
@note{Applies to Windows only.}
11671168
</td>
11681169
</tr>
11691170
<tr>
11701171
<td>Default</td>
11711172
<td colspan="2">@code{}
1172-
disabled
1173+
0
11731174
@endcode</td>
11741175
</tr>
11751176
<tr>
11761177
<td>Example</td>
11771178
<td colspan="2">@code{}
1178-
dd_wa_hdr_toggle = enabled
1179+
dd_wa_hdr_toggle_delay = 500
11791180
@endcode</td>
11801181
</tr>
11811182
</table>

src/config.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,11 @@ namespace config {
11331133
}
11341134
}
11351135
generic_f(vars, "dd_mode_remapping", video.dd.mode_remapping, dd::mode_remapping_from_view);
1136-
bool_f(vars, "dd_wa_hdr_toggle", video.dd.wa.hdr_toggle);
1136+
{
1137+
int value = 0;
1138+
int_between_f(vars, "dd_wa_hdr_toggle_delay", value, {0, 3000});
1139+
video.dd.wa.hdr_toggle_delay = std::chrono::milliseconds {value};
1140+
}
11371141

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

src/config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ namespace config {
8484

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

9090
enum class config_option_e {

src/display_device.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ namespace display_device {
621621
std::make_shared<FileSettingsPersistence>(persistence_filepath)
622622
),
623623
WinWorkarounds {
624-
.m_hdr_blank_delay = video_config.dd.wa.hdr_toggle ? std::make_optional(500ms) : std::nullopt
624+
.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
625625
}
626626
);
627627
#else

src_assets/common/assets/web/config.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ <h1 class="my-4">{{ $t('config.configuration') }}</h1>
176176
"dd_hdr_option": "auto",
177177
"dd_config_revert_delay": 3000,
178178
"dd_mode_remapping": {"mixed": [], "resolution_only": [], "refresh_rate_only": []},
179-
"dd_wa_hdr_toggle": "disabled",
179+
"dd_wa_hdr_toggle_delay": 0,
180180
"min_fps_factor": 1,
181181
},
182182
},

src_assets/common/assets/web/configs/tabs/audiovideo/DisplayDeviceOptions.vue

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<script setup>
22
import { ref } from 'vue'
33
import PlatformLayout from '../../../PlatformLayout.vue'
4-
import Checkbox from "../../../Checkbox.vue";
54
65
const props = defineProps({
76
platform: String,
@@ -132,11 +131,18 @@ function addRemappingEntry() {
132131
<option value="auto">{{ $t('config.dd_hdr_option_auto') }}</option>
133132
</select>
134133
<!-- HDR toggle -->
135-
<Checkbox id="dd_wa_hdr_toggle"
136-
locale-prefix="config"
137-
v-model="config.dd_wa_hdr_toggle"
138-
default="false"
139-
></Checkbox>
134+
<label for="dd_wa_hdr_toggle_delay" class="form-label">
135+
{{ $t('config.dd_wa_hdr_toggle_delay') }}
136+
</label>
137+
<input type="number" class="form-control" id="dd_wa_hdr_toggle_delay" placeholder="0" min="0" max="3000"
138+
v-model="config.dd_wa_hdr_toggle_delay" />
139+
<div class="form-text">
140+
{{ $t('config.dd_wa_hdr_toggle_delay_desc_1') }}
141+
<br>
142+
{{ $t('config.dd_wa_hdr_toggle_delay_desc_2') }}
143+
<br>
144+
{{ $t('config.dd_wa_hdr_toggle_delay_desc_3') }}
145+
</div>
140146
</div>
141147

142148
<!-- Config revert delay -->

src_assets/common/assets/web/public/assets/locale/en.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,10 @@
187187
"dd_resolution_option_manual": "Use manually entered resolution",
188188
"dd_resolution_option_manual_desc": "Enter the resolution to be used",
189189
"dd_resolution_option_ogs_desc": "\"Optimize game settings\" option must be enabled on the Moonlight client for this to work.",
190-
"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.",
191-
"dd_wa_hdr_toggle": "Enable high-contrast workaround for HDR",
190+
"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.",
191+
"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.",
192+
"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!",
193+
"dd_wa_hdr_toggle_delay": "High-contrast workaround for HDR",
192194
"ds4_back_as_touchpad_click": "Map Back/Select to Touchpad Click",
193195
"ds4_back_as_touchpad_click_desc": "When forcing DS4 emulation, map Back/Select to Touchpad Click",
194196
"encoder": "Force a Specific Encoder",

0 commit comments

Comments
 (0)