Skip to content

Commit

Permalink
per monitor hdr check
Browse files Browse the repository at this point in the history
  • Loading branch information
UjinT34 committed Jan 17, 2025
1 parent aad967c commit 83ba215
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/helpers/Monitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ class CMonitor {

bool m_bEnabled = false;
bool m_bRenderingInitPassed = false;
WP<CWindow> m_previousFSWindow;

// For the list lookup

Expand Down
6 changes: 3 additions & 3 deletions src/render/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1468,18 +1468,18 @@ bool CHyprRenderer::commitPendingAndDoExplicitSync(PHLMONITOR pMonitor) {
const auto WINDOW = pMonitor->activeWorkspace->getFullscreenWindow();
const auto SURF = WINDOW->m_pWLSurface->resource();
if (SURF->colorManagement.valid() && SURF->colorManagement->hasImageDescription()) {
bool needsHdrMetadataUpdate = SURF->colorManagement->needsHdrMetadataUpdate() || m_previousFSWindow != WINDOW;
bool needsHdrMetadataUpdate = SURF->colorManagement->needsHdrMetadataUpdate() || pMonitor->m_previousFSWindow != WINDOW;
if (SURF->colorManagement->needsHdrMetadataUpdate())
SURF->colorManagement->setHDRMetadata(createHDRMetadata(SURF->colorManagement.get()->imageDescription(), pMonitor->output->parsedEDID));
if (needsHdrMetadataUpdate)
pMonitor->output->state->setHDRMetadata(SURF->colorManagement->hdrMetadata());
} else if ((pMonitor->output->state->state().hdrMetadata.hdmi_metadata_type1.eotf == 2) != *PHDR)
pMonitor->output->state->setHDRMetadata(*PHDR ? createHDRMetadata(2, pMonitor->output->parsedEDID) : createHDRMetadata(0, pMonitor->output->parsedEDID));
m_previousFSWindow = WINDOW;
pMonitor->m_previousFSWindow = WINDOW;
} else {
if ((pMonitor->output->state->state().hdrMetadata.hdmi_metadata_type1.eotf == 2) != *PHDR)
pMonitor->output->state->setHDRMetadata(*PHDR ? createHDRMetadata(2, pMonitor->output->parsedEDID) : createHDRMetadata(0, pMonitor->output->parsedEDID));
m_previousFSWindow.reset();
pMonitor->m_previousFSWindow.reset();
}
}

Expand Down
1 change: 0 additions & 1 deletion src/render/Renderer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ class CHyprRenderer {

bool commitPendingAndDoExplicitSync(PHLMONITOR pMonitor);

WP<CWindow> m_previousFSWindow;
bool m_bCursorHidden = false;
bool m_bCursorHasSurface = false;
SP<CRenderbuffer> m_pCurrentRenderbuffer = nullptr;
Expand Down

0 comments on commit 83ba215

Please sign in to comment.