diff options
| author | UjinT34 <41110182+UjinT34@users.noreply.github.com> | 2026-02-26 15:01:59 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-26 12:01:59 +0000 |
| commit | c71fbd854dfdedaae011f4b8b1fdb81f8054b309 (patch) | |
| tree | 89d600037ab206f800acca1b2567eb60af67c7e9 /src/config | |
| parent | 0e9196867b4f602e1e5a599d4f3565faff615b3c (diff) | |
renderer: better sdr eotf settings (#12812)
Diffstat (limited to 'src/config')
| -rw-r--r-- | src/config/ConfigDescriptions.hpp | 8 | ||||
| -rw-r--r-- | src/config/ConfigManager.cpp | 18 |
2 files changed, 18 insertions, 8 deletions
diff --git a/src/config/ConfigDescriptions.hpp b/src/config/ConfigDescriptions.hpp index ebe13156..ef6ca535 100644 --- a/src/config/ConfigDescriptions.hpp +++ b/src/config/ConfigDescriptions.hpp @@ -1568,10 +1568,10 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = { }, SConfigOptionDescription{ .value = "render:cm_sdr_eotf", - .description = "Default transfer function for displaying SDR apps. 0 - Use default value (Gamma 2.2), 1 - Treat unspecified as Gamma 2.2, 2 - Treat " - "unspecified and sRGB as Gamma 2.2, 3 - Treat unspecified as sRGB", - .type = CONFIG_OPTION_CHOICE, - .data = SConfigOptionDescription::SChoiceData{0, "default,gamma22,gamma22force,srgb"}, + .description = "Default transfer function for displaying SDR apps. default - Use default value (Gamma 2.2), gamma22 - Treat unspecified as Gamma 2.2, gamma22force - Treat " + "unspecified and sRGB as Gamma 2.2, srgb - Treat unspecified as sRGB", + .type = CONFIG_OPTION_STRING_SHORT, + .data = SConfigOptionDescription::SStringData{"default"}, }, SConfigOptionDescription{ .value = "render:commit_timing_enabled", diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index cd5b0ec8..cb38154e 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -795,7 +795,7 @@ CConfigManager::CConfigManager() { registerConfigVar("render:cm_auto_hdr", Hyprlang::INT{1}); registerConfigVar("render:new_render_scheduling", Hyprlang::INT{0}); registerConfigVar("render:non_shader_cm", Hyprlang::INT{3}); - registerConfigVar("render:cm_sdr_eotf", Hyprlang::INT{0}); + registerConfigVar("render:cm_sdr_eotf", {"default"}); registerConfigVar("render:commit_timing_enabled", Hyprlang::INT{1}); registerConfigVar("ecosystem:no_update_news", Hyprlang::INT{0}); @@ -859,7 +859,7 @@ CConfigManager::CConfigManager() { m_config->addSpecialConfigValue("monitorv2", "mirror", {STRVAL_EMPTY}); m_config->addSpecialConfigValue("monitorv2", "bitdepth", {STRVAL_EMPTY}); // TODO use correct type m_config->addSpecialConfigValue("monitorv2", "cm", {"auto"}); - m_config->addSpecialConfigValue("monitorv2", "sdr_eotf", Hyprlang::INT{0}); + m_config->addSpecialConfigValue("monitorv2", "sdr_eotf", {"default"}); m_config->addSpecialConfigValue("monitorv2", "sdrbrightness", Hyprlang::FLOAT{1.0}); m_config->addSpecialConfigValue("monitorv2", "sdrsaturation", Hyprlang::FLOAT{1.0}); m_config->addSpecialConfigValue("monitorv2", "vrr", Hyprlang::INT{0}); @@ -1209,8 +1209,18 @@ std::optional<std::string> CConfigManager::handleMonitorv2(const std::string& ou if (VAL && VAL->m_bSetByUser) parser.parseCM(std::any_cast<Hyprlang::STRING>(VAL->getValue())); VAL = m_config->getSpecialConfigValuePtr("monitorv2", "sdr_eotf", output.c_str()); - if (VAL && VAL->m_bSetByUser) - parser.rule().sdrEotf = std::any_cast<Hyprlang::INT>(VAL->getValue()); + if (VAL && VAL->m_bSetByUser) { + const std::string value = std::any_cast<Hyprlang::STRING>(VAL->getValue()); + // remap legacy + if (value == "0") + parser.rule().sdrEotf = NTransferFunction::TF_AUTO; + else if (value == "1") + parser.rule().sdrEotf = NTransferFunction::TF_SRGB; + else if (value == "2") + parser.rule().sdrEotf = NTransferFunction::TF_GAMMA22; + else + parser.rule().sdrEotf = NTransferFunction::fromString(value); + } VAL = m_config->getSpecialConfigValuePtr("monitorv2", "sdrbrightness", output.c_str()); if (VAL && VAL->m_bSetByUser) parser.rule().sdrBrightness = std::any_cast<Hyprlang::FLOAT>(VAL->getValue()); |
