From 60d04e196d566403a629630b6d8a9dcf13dabd26 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Mon, 24 Jun 2024 23:22:27 +0200 Subject: [PATCH] minor fixes for new drm stuff --- src/Compositor.cpp | 3 +++ src/render/Renderer.cpp | 13 +++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 597950c8..e3036c6e 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -257,6 +257,7 @@ void CCompositor::initServer() { m_bInitialized = true; m_iDRMFD = m_pAqBackend->drmFD(); + Debug::log(LOG, "Running on DRMFD: {}", m_iDRMFD); initManagers(STAGE_BASICINIT); @@ -2848,6 +2849,8 @@ void CCompositor::onNewMonitor(SP output) { if (std::string("HEADLESS-1") == output->name) g_pCompositor->m_pUnsafeOutput = PNEWMONITOR.get(); + Debug::log(LOG, "New output with name {}", output->name); + PNEWMONITOR->szName = output->name; PNEWMONITOR->output = output; PNEWMONITOR->self = PNEWMONITOR; diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index f9a411fe..1796486e 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -27,7 +27,7 @@ static int cursorTicker(void* data) { CHyprRenderer::CHyprRenderer() { if (g_pCompositor->m_pAqBackend->hasSession()) { for (auto& dev : g_pCompositor->m_pAqBackend->session->sessionDevices) { - const auto DRMV = drmGetVersion(dev->fd); + const auto DRMV = drmGetVersion(dev->fd); if (!DRMV) continue; std::string name = std::string{DRMV->name, DRMV->name_len}; @@ -1246,7 +1246,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) { clock_gettime(CLOCK_MONOTONIC, &now); // check the damage - bool hasChanged = /*pMonitor->output->needs_frame ||*/ pMonitor->damage.hasChanged(); + bool hasChanged = pMonitor->output->needsFrame || pMonitor->damage.hasChanged(); if (!hasChanged && *PDAMAGETRACKINGMODE != DAMAGE_TRACKING_NONE && pMonitor->forceFullFrames == 0 && damageBlinkCleanup == 0) return; @@ -2601,6 +2601,15 @@ bool CHyprRenderer::beginRender(CMonitor* pMonitor, CRegion& damage, eRenderMode int bufferAge = 0; if (!buffer) { + Aquamarine::SSwapchainOptions opts = pMonitor->output->swapchain->currentOptions(); + opts.length = 2; + opts.size = pMonitor->currentMode->pixelSize; + opts.format = pMonitor->drmFormat; + if (!pMonitor->output->swapchain->reconfigure(opts)) { + Debug::log(ERR, "Failed to reconfigure swapchain for {}", pMonitor->szName); + return false; + } + m_pCurrentBuffer = pMonitor->output->swapchain->next(&bufferAge); if (!m_pCurrentBuffer) { Debug::log(ERR, "Failed to acquire swapchain buffer for {}", pMonitor->szName);