mirror of
https://github.com/hyprwm/Hyprland
synced 2026-05-07 17:18:02 +02:00
cache workbuffer descriptions
This commit is contained in:
parent
3f77bf25d1
commit
e249b381bf
2 changed files with 21 additions and 8 deletions
|
|
@ -2558,15 +2558,25 @@ PImageDescription CMonitor::workBufferImageDescription() {
|
|||
const bool isHDRLikeTF =
|
||||
value.transferFunction == CM_TRANSFER_FUNCTION_ST2084_PQ || value.transferFunction == CM_TRANSFER_FUNCTION_HLG || value.transferFunction == CM_TRANSFER_FUNCTION_EXT_LINEAR;
|
||||
|
||||
if (isHDRLikeTF || value.windowsScRGB)
|
||||
return LINEAR_IMAGE_DESCRIPTION;
|
||||
const auto& cached = m_cachedInternalDescription->value();
|
||||
|
||||
return CImageDescription::from(SImageDescription{
|
||||
.transferFunction = chooseTF(m_sdrEotf),
|
||||
.primariesNameSet = true,
|
||||
.primariesNamed = NColorManagement::CM_PRIMARIES_BT2020,
|
||||
.primaries = NColorPrimaries::BT2020,
|
||||
});
|
||||
// HDR
|
||||
if (isHDRLikeTF || value.windowsScRGB) {
|
||||
if (cached.primariesNamed != NColorManagement::CM_PRIMARIES_SRGB || cached.luminances != value.luminances)
|
||||
m_cachedInternalDescription = LINEAR_IMAGE_DESCRIPTION->with(value.luminances);
|
||||
return m_cachedInternalDescription;
|
||||
}
|
||||
|
||||
// SDR
|
||||
if (cached.primariesNamed != NColorManagement::CM_PRIMARIES_BT2020 || cached.transferFunction != chooseTF(m_sdrEotf))
|
||||
m_cachedInternalDescription = CImageDescription::from(SImageDescription{
|
||||
.transferFunction = chooseTF(m_sdrEotf),
|
||||
.primariesNameSet = true,
|
||||
.primariesNamed = NColorManagement::CM_PRIMARIES_BT2020,
|
||||
.primaries = NColorPrimaries::BT2020,
|
||||
});
|
||||
|
||||
return m_cachedInternalDescription;
|
||||
}
|
||||
|
||||
WP<CMonitorResources> CMonitor::resources() {
|
||||
|
|
|
|||
|
|
@ -415,6 +415,9 @@ class CMonitor {
|
|||
|
||||
// Resources
|
||||
UP<Monitor::CMonitorResources> m_resources;
|
||||
// cached should contain one of predefined descriptions: BT2020 primaries with variable TF and SDR luminances or SRGB primaries with linear TF and variable luminances.
|
||||
// avoids lookup for an id when ::from is used
|
||||
NColorManagement::PImageDescription m_cachedInternalDescription = NColorManagement::CImageDescription::from(NColorManagement::SImageDescription{});
|
||||
|
||||
struct {
|
||||
CHyprSignalListener frame;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue