aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorIkalco <[email protected]>2024-08-28 08:07:13 -0500
committerGitHub <[email protected]>2024-08-28 15:07:13 +0200
commit98e99cd03df5b4421f72f2a3f2d7de53f8261f1f (patch)
tree903c0be590279235b5c322f8b115cfd0331168ec
parent8210a1d7ac38f6af76ccbb831dc1d62b1ebc53db (diff)
downloadHyprland-98e99cd03df5b4421f72f2a3f2d7de53f8261f1f.tar.gz
Hyprland-98e99cd03df5b4421f72f2a3f2d7de53f8261f1f.zip
renderer: ensure buffer format on commit (#7556)
-rw-r--r--src/helpers/Monitor.cpp11
-rw-r--r--src/render/Renderer.cpp1
2 files changed, 8 insertions, 4 deletions
diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp
index d81ccb3d..2b8404ee 100644
--- a/src/helpers/Monitor.cpp
+++ b/src/helpers/Monitor.cpp
@@ -915,17 +915,20 @@ CMonitorState::~CMonitorState() {
}
void CMonitorState::ensureBufferPresent() {
- if (!m_pOwner->output->state->state().enabled) {
+ const auto STATE = m_pOwner->output->state->state();
+ if (!STATE.enabled) {
Debug::log(TRACE, "CMonitorState::ensureBufferPresent: Ignoring, monitor is not enabled");
return;
}
- if (m_pOwner->output->state->state().buffer)
- return;
+ if (STATE.buffer) {
+ if (const auto params = STATE.buffer->dmabuf(); params.success && params.format == m_pOwner->drmFormat)
+ return;
+ }
// this is required for modesetting being possible and might be missing in case of first tests in the renderer
// where we test modes and buffers
- Debug::log(LOG, "CMonitorState::ensureBufferPresent: no buffer, attaching one from the swapchain for modeset being possible");
+ Debug::log(LOG, "CMonitorState::ensureBufferPresent: no buffer or mismatched format, attaching one from the swapchain for modeset being possible");
m_pOwner->output->state->setBuffer(m_pOwner->output->swapchain->next(nullptr));
m_pOwner->output->swapchain->rollback(); // restore the counter, don't advance the swapchain
}
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index c601e369..7d63468e 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -1910,6 +1910,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
pMonitor->currentMode = nullptr;
pMonitor->output->state->setFormat(DRM_FORMAT_XRGB8888);
+ pMonitor->drmFormat = DRM_FORMAT_XRGB8888;
pMonitor->output->state->resetExplicitFences();
bool autoScale = false;