renderer: add simple color management (#9506)

Adds proper color management and transformations for CM surfaces.
This commit is contained in:
UjinT34
2025-03-14 02:15:18 +03:00
committed by GitHub
parent e86d3a14e4
commit 8c97cb7858
14 changed files with 823 additions and 179 deletions

View File

@@ -692,12 +692,11 @@ CConfigManager::CConfigManager() {
registerConfigVar("render:xp_mode", Hyprlang::INT{0});
registerConfigVar("render:ctm_animation", Hyprlang::INT{2});
registerConfigVar("render:allow_early_buffer_release", Hyprlang::INT{1});
registerConfigVar("render:cm_fs_passthrough", Hyprlang::INT{1});
registerConfigVar("ecosystem:no_update_news", Hyprlang::INT{0});
registerConfigVar("ecosystem:no_donation_nag", Hyprlang::INT{0});
registerConfigVar("experimental:wide_color_gamut", Hyprlang::INT{0});
registerConfigVar("experimental:hdr", Hyprlang::INT{0});
registerConfigVar("experimental:xx_color_management_v4", Hyprlang::INT{0});
// devices
@@ -2042,6 +2041,32 @@ std::optional<std::string> CConfigManager::handleMonitor(const std::string& comm
} else if (ARGS[argno] == "bitdepth") {
newrule.enable10bit = ARGS[argno + 1] == "10";
argno++;
} else if (ARGS[argno] == "cm") {
if (ARGS[argno + 1] == "auto")
newrule.cmType = CM_AUTO;
else if (ARGS[argno + 1] == "srgb")
newrule.cmType = CM_SRGB;
else if (ARGS[argno + 1] == "wide")
newrule.cmType = CM_WIDE;
else if (ARGS[argno + 1] == "edid")
newrule.cmType = CM_EDID;
else if (ARGS[argno + 1] == "hdr")
newrule.cmType = CM_HDR;
else if (ARGS[argno + 1] == "hdredid")
newrule.cmType = CM_HDR_EDID;
else
error = "invalid cm ";
argno++;
} else if (ARGS[argno] == "sdrsaturation") {
try {
newrule.sdrSaturation = stof(ARGS[argno + 1]);
} catch (...) { error = "invalid sdrsaturation "; }
argno++;
} else if (ARGS[argno] == "sdrbrightness") {
try {
newrule.sdrBrightness = stof(ARGS[argno + 1]);
} catch (...) { error = "invalid sdrbrightness "; }
argno++;
} else if (ARGS[argno] == "transform") {
if (!isNumber(ARGS[argno + 1])) {
error = "invalid transform ";