Skip to content

Commit fa22227

Browse files
authored
feat(display): expose HDR toggle workaround delay to user (#3579)
1 parent 9aaa40c commit fa22227

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
@@ -1156,28 +1156,29 @@ editing the `conf` file in a text editor. Use the examples as reference.
11561156
</tr>
11571157
</table>
11581158

1159-
### dd_wa_hdr_toggle
1159+
### dd_wa_hdr_toggle_delay
11601160

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

src/config.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1136,7 +1136,11 @@ namespace config {
11361136
}
11371137
bool_f(vars, "dd_config_revert_on_disconnect", video.dd.config_revert_on_disconnect);
11381138
generic_f(vars, "dd_mode_remapping", video.dd.mode_remapping, dd::mode_remapping_from_view);
1139-
bool_f(vars, "dd_wa_hdr_toggle", video.dd.wa.hdr_toggle);
1139+
{
1140+
int value = 0;
1141+
int_between_f(vars, "dd_wa_hdr_toggle_delay", value, {0, 3000});
1142+
video.dd.wa.hdr_toggle_delay = std::chrono::milliseconds {value};
1143+
}
11401144

11411145
int_between_f(vars, "min_fps_factor", video.min_fps_factor, {1, 3});
11421146
int_f(vars, "max_bitrate", video.max_bitrate);

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
@@ -177,7 +177,7 @@ <h1 class="my-4">{{ $t('config.configuration') }}</h1>
177177
"dd_config_revert_delay": 3000,
178178
"dd_config_revert_on_disconnect": "disabled",
179179
"dd_mode_remapping": {"mixed": [], "resolution_only": [], "refresh_rate_only": []},
180-
"dd_wa_hdr_toggle": "disabled",
180+
"dd_wa_hdr_toggle_delay": 0,
181181
"min_fps_factor": 1,
182182
"max_bitrate": 0,
183183
},

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
@@ -189,8 +189,10 @@
189189
"dd_resolution_option_manual": "Use manually entered resolution",
190190
"dd_resolution_option_manual_desc": "Enter the resolution to be used",
191191
"dd_resolution_option_ogs_desc": "\"Optimize game settings\" option must be enabled on the Moonlight client for this to work.",
192-
"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.",
193-
"dd_wa_hdr_toggle": "Enable high-contrast workaround for HDR",
192+
"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.",
193+
"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.",
194+
"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!",
195+
"dd_wa_hdr_toggle_delay": "High-contrast workaround for HDR",
194196
"ds4_back_as_touchpad_click": "Map Back/Select to Touchpad Click",
195197
"ds4_back_as_touchpad_click_desc": "When forcing DS4 emulation, map Back/Select to Touchpad Click",
196198
"encoder": "Force a Specific Encoder",

0 commit comments

Comments
 (0)