render: fixup format mismatch after leaving DS

fixes #7373
This commit is contained in:
Vaxry 2024-08-17 19:27:11 +02:00
parent 92744b5b9a
commit 912e7ba82d
4 changed files with 16 additions and 11 deletions

View file

@ -158,16 +158,16 @@ std::string monitorsRequest(eHyprCtlOutputFormat format, std::string request) {
if (!m->output || m->ID == -1) if (!m->output || m->ID == -1)
continue; continue;
result += result += std::format(
std::format("Monitor {} (ID {}):\n\t{}x{}@{:.5f} at {}x{}\n\tdescription: {}\n\tmake: {}\n\tmodel: {}\n\tserial: {}\n\tactive workspace: {} ({})\n\t" "Monitor {} (ID {}):\n\t{}x{}@{:.5f} at {}x{}\n\tdescription: {}\n\tmake: {}\n\tmodel: {}\n\tserial: {}\n\tactive workspace: {} ({})\n\t"
"special workspace: {} ({})\n\treserved: {} {} {} {}\n\tscale: {:.2f}\n\ttransform: {}\n\tfocused: {}\n\t" "special workspace: {} ({})\n\treserved: {} {} {} {}\n\tscale: {:.2f}\n\ttransform: {}\n\tfocused: {}\n\t"
"dpmsStatus: {}\n\tvrr: {}\n\tactivelyTearing: {}\n\tdisabled: {}\n\tcurrentFormat: {}\n\tavailableModes: {}\n\n", "dpmsStatus: {}\n\tvrr: {}\n\tactivelyTearing: {}\n\tdisabled: {}\n\tcurrentFormat: A {} H {}\n\tavailableModes: {}\n\n",
m->szName, m->ID, (int)m->vecPixelSize.x, (int)m->vecPixelSize.y, m->refreshRate, (int)m->vecPosition.x, (int)m->vecPosition.y, m->szShortDescription, m->szName, m->ID, (int)m->vecPixelSize.x, (int)m->vecPixelSize.y, m->refreshRate, (int)m->vecPosition.x, (int)m->vecPosition.y, m->szShortDescription,
m->output->make, m->output->model, m->output->serial, m->activeWorkspaceID(), (!m->activeWorkspace ? "" : m->activeWorkspace->m_szName), m->output->make, m->output->model, m->output->serial, m->activeWorkspaceID(), (!m->activeWorkspace ? "" : m->activeWorkspace->m_szName),
m->activeSpecialWorkspaceID(), (m->activeSpecialWorkspace ? m->activeSpecialWorkspace->m_szName : ""), (int)m->vecReservedTopLeft.x, m->activeSpecialWorkspaceID(), (m->activeSpecialWorkspace ? m->activeSpecialWorkspace->m_szName : ""), (int)m->vecReservedTopLeft.x, (int)m->vecReservedTopLeft.y,
(int)m->vecReservedTopLeft.y, (int)m->vecReservedBottomRight.x, (int)m->vecReservedBottomRight.y, m->scale, (int)m->transform, (int)m->vecReservedBottomRight.x, (int)m->vecReservedBottomRight.y, m->scale, (int)m->transform, (m == g_pCompositor->m_pLastMonitor ? "yes" : "no"),
(m == g_pCompositor->m_pLastMonitor ? "yes" : "no"), (int)m->dpmsStatus, (int)(m->output->state ? m->output->state->state().adaptiveSync : false), (int)m->dpmsStatus, (int)(m->output->state ? m->output->state->state().adaptiveSync : false), m->tearingState.activelyTearing, !m->m_bEnabled,
m->tearingState.activelyTearing, !m->m_bEnabled, formatToString(m->output->state->state().drmFormat), availableModesForOutput(m.get(), format)); formatToString(m->output->state->state().drmFormat), formatToString(m->drmFormat), availableModesForOutput(m.get(), format));
} }
} }

View file

@ -946,7 +946,7 @@ bool CMonitorState::updateSwapchain() {
Debug::log(WARN, "updateSwapchain: No mode?"); Debug::log(WARN, "updateSwapchain: No mode?");
return true; return true;
} }
options.format = STATE.drmFormat; options.format = m_pOwner->drmFormat;
options.scanout = true; options.scanout = true;
options.length = 2; options.length = 2;
options.size = MODE->pixelSize; options.size = MODE->pixelSize;

View file

@ -100,6 +100,7 @@ class CMonitor {
std::optional<Vector2D> forceSize; std::optional<Vector2D> forceSize;
SP<Aquamarine::SOutputMode> currentMode; SP<Aquamarine::SOutputMode> currentMode;
SP<Aquamarine::CSwapchain> cursorSwapchain; SP<Aquamarine::CSwapchain> cursorSwapchain;
uint32_t drmFormat = DRM_FORMAT_INVALID;
bool dpmsStatus = true; bool dpmsStatus = true;
bool vrrActive = false; // this can be TRUE even if VRR is not active in the case that this display does not support it. bool vrrActive = false; // this can be TRUE even if VRR is not active in the case that this display does not support it.

View file

@ -1207,6 +1207,9 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
} else if (!pMonitor->lastScanout.expired()) { } else if (!pMonitor->lastScanout.expired()) {
Debug::log(LOG, "Left a direct scanout."); Debug::log(LOG, "Left a direct scanout.");
pMonitor->lastScanout.reset(); pMonitor->lastScanout.reset();
// reset DRM format, make sure it's the one we want.
pMonitor->output->state->setFormat(pMonitor->drmFormat);
} }
} }
@ -2155,6 +2158,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
for (auto& fmt : formats[(int)!RULE->enable10bit]) { for (auto& fmt : formats[(int)!RULE->enable10bit]) {
pMonitor->output->state->setFormat(fmt.second); pMonitor->output->state->setFormat(fmt.second);
pMonitor->drmFormat = fmt.second;
if (!pMonitor->state.test()) { if (!pMonitor->state.test()) {
Debug::log(ERR, "output {} failed basic test on format {}", pMonitor->szName, fmt.first); Debug::log(ERR, "output {} failed basic test on format {}", pMonitor->szName, fmt.first);