protocols: Don't update hdr metadata if image description is unchanged (#9776)

This commit is contained in:
Lee Bousfield 2025-03-29 19:25:27 -05:00 committed by GitHub
parent 46b00a4a86
commit 86c279d7d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 3 deletions

View File

@ -332,10 +332,15 @@ const hdr_output_metadata& CColorManagementSurface::hdrMetadata() {
void CColorManagementSurface::setHDRMetadata(const hdr_output_metadata& metadata) {
m_hdrMetadata = metadata;
m_lastImageDescription = m_imageDescription;
m_needsNewMetadata = false;
}
bool CColorManagementSurface::needsHdrMetadataUpdate() {
if (!m_needsNewMetadata)
return false;
if (m_imageDescription == m_lastImageDescription)
m_needsNewMetadata = false;
return m_needsNewMetadata;
}

View File

@ -65,6 +65,7 @@ class CColorManagementSurface {
SP<CWpColorManagementSurfaceV1> m_resource;
wl_client* pClient = nullptr;
NColorManagement::SImageDescription m_imageDescription;
NColorManagement::SImageDescription m_lastImageDescription;
bool m_hasImageDescription = false;
bool m_needsNewMetadata = false;
hdr_output_metadata m_hdrMetadata;

View File

@ -245,8 +245,8 @@ CXXColorManagementSurface::CXXColorManagementSurface(SP<CXxColorManagementSurfac
}
if (surface.valid()) {
surface->colorManagement->setHasImageDescription(true);
surface->colorManagement->m_imageDescription = imageDescription->get()->settings;
surface->colorManagement->setHasImageDescription(true);
} else
LOGM(ERR, "Set image description for invalid surface");
});