renderer: better sdr eotf settings (#12812)

This commit is contained in:
UjinT34 2026-02-26 15:01:59 +03:00 committed by GitHub
parent 0e9196867b
commit c71fbd854d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 174 additions and 65 deletions

View file

@ -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());