outputconfigurationstore: store icc profile paths

This commit is contained in:
Xaver Hugl 2023-10-21 21:35:14 +02:00
parent e441b5f35d
commit 006d1f6a14
5 changed files with 19 additions and 0 deletions

View file

@ -346,6 +346,7 @@ void DrmOutput::applyQueuedChanges(const std::shared_ptr<OutputChangeSet> &props
next.wideColorGamut = props->wideColorGamut.value_or(m_state.wideColorGamut);
next.autoRotatePolicy = props->autoRotationPolicy.value_or(m_state.autoRotatePolicy);
if (props->iccProfilePath) {
next.iccProfilePath = *props->iccProfilePath;
next.iccProfile = IccProfile::load(*props->iccProfilePath);
m_pipeline->setIccProfile(next.iccProfile);
}

View file

@ -335,6 +335,7 @@ void Output::applyChanges(const OutputConfiguration &config)
next.scale = props->scale.value_or(m_state.scale);
next.rgbRange = props->rgbRange.value_or(m_state.rgbRange);
next.autoRotatePolicy = props->autoRotationPolicy.value_or(m_state.autoRotatePolicy);
next.iccProfilePath = props->iccProfilePath.value_or(m_state.iccProfilePath);
if (props->iccProfilePath) {
next.iccProfile = IccProfile::load(*props->iccProfilePath);
}
@ -570,6 +571,11 @@ std::shared_ptr<IccProfile> Output::iccProfile() const
return m_state.iccProfile;
}
QString Output::iccProfilePath() const
{
return m_state.iccProfilePath;
}
bool Output::updateCursorLayer()
{
return false;

View file

@ -315,6 +315,7 @@ public:
uint32_t sdrBrightness() const;
AutoRotationPolicy autoRotationPolicy() const;
std::shared_ptr<IccProfile> iccProfile() const;
QString iccProfilePath() const;
virtual bool setGammaRamp(const std::shared_ptr<ColorTransformation> &transformation);
virtual bool setChannelFactors(const QVector3D &rgb);
@ -415,6 +416,7 @@ protected:
bool highDynamicRange = false;
uint32_t sdrBrightness = 200;
AutoRotationPolicy autoRotatePolicy = AutoRotationPolicy::InTabletMode;
QString iccProfilePath;
std::shared_ptr<IccProfile> iccProfile;
};

View file

@ -195,6 +195,7 @@ void OutputConfigurationStore::storeConfig(const QList<Output *> &allOutputs, bo
.sdrBrightness = changeSet->sdrBrightness.value_or(output->sdrBrightness()),
.wideColorGamut = changeSet->wideColorGamut.value_or(output->wideColorGamut()),
.autoRotation = changeSet->autoRotationPolicy.value_or(output->autoRotationPolicy()),
.iccProfilePath = changeSet->iccProfilePath.value_or(output->iccProfilePath()),
};
*outputIt = SetupState{
.outputIndex = *outputIndex,
@ -221,6 +222,7 @@ void OutputConfigurationStore::storeConfig(const QList<Output *> &allOutputs, bo
.sdrBrightness = output->sdrBrightness(),
.wideColorGamut = output->wideColorGamut(),
.autoRotation = output->autoRotationPolicy(),
.iccProfilePath = output->iccProfilePath(),
};
*outputIt = SetupState{
.outputIndex = *outputIndex,
@ -262,6 +264,7 @@ std::pair<OutputConfiguration, QList<Output *>> OutputConfigurationStore::setupT
.sdrBrightness = state.sdrBrightness,
.wideColorGamut = state.wideColorGamut,
.autoRotationPolicy = state.autoRotation,
.iccProfilePath = state.iccProfilePath,
};
if (setupState.enabled) {
priorities.push_back(std::make_pair(output, setupState.priority));
@ -614,6 +617,9 @@ void OutputConfigurationStore::load()
state.autoRotation = Output::AutoRotationPolicy::Always;
}
}
if (const auto it = data.find("iccProfilePath"); it != data.end()) {
state.iccProfilePath = it->toString();
}
outputDatas.push_back(state);
}
@ -800,6 +806,9 @@ void OutputConfigurationStore::save()
break;
}
}
if (output.iccProfilePath) {
o["iccProfilePath"] = *output.iccProfilePath;
}
outputsData.append(o);
}
outputs["data"] = outputsData;

View file

@ -73,6 +73,7 @@ private:
std::optional<uint32_t> sdrBrightness;
std::optional<bool> wideColorGamut;
std::optional<Output::AutoRotationPolicy> autoRotation;
std::optional<QString> iccProfilePath;
};
struct SetupState
{