stuff I already forgot what I did

This commit is contained in:
Vaxry 2024-06-27 21:48:45 +02:00
parent 5dd21d0928
commit bcea65ab09
3 changed files with 16 additions and 13 deletions

View file

@ -126,7 +126,7 @@ void CMonitor::onConnect(bool noRule) {
g_pHyprRenderer->applyMonitorRule(this, &monitorRule, true);
if (!state.commit())
Debug::log(WARN, "wlr_output_commit_state failed in CMonitor::onCommit");
Debug::log(WARN, "state.commit() failed in CMonitor::onCommit");
damage.setSize(vecTransformedSize);
@ -778,10 +778,24 @@ CMonitorState::~CMonitorState() {
}
bool CMonitorState::commit() {
if (!updateSwapchain())
return false;
bool ret = m_pOwner->output->commit();
return ret;
}
bool CMonitorState::test() {
if (!updateSwapchain())
return false;
return m_pOwner->output->test();
}
bool CMonitorState::updateSwapchain() {
auto options = m_pOwner->output->swapchain->currentOptions();
const auto& STATE = m_pOwner->output->state->state();
options.format = STATE.drmFormat;
options.scanout = true;
options.length = 2;
options.size = STATE.mode ? STATE.mode->pixelSize : STATE.customMode->pixelSize;
return m_pOwner->output->swapchain->reconfigure(options);
}

View file

@ -49,6 +49,7 @@ class CMonitorState {
bool commit();
bool test();
bool updateSwapchain();
private:
CMonitor* m_pOwner;

View file

@ -2610,18 +2610,6 @@ bool CHyprRenderer::beginRender(CMonitor* pMonitor, CRegion& damage, eRenderMode
static constexpr const int HL_BUFFER_AGE = 2;
if (!buffer) {
const auto& MODE = pMonitor->output->state->state().mode ? pMonitor->output->state->state().mode : pMonitor->output->state->state().customMode;
if (!MODE) // no mode??
return false;
Aquamarine::SSwapchainOptions opts = pMonitor->output->swapchain->currentOptions();
opts.length = 2;
opts.size = MODE->pixelSize;
opts.format = pMonitor->output->state->state().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(nullptr);
if (!m_pCurrentBuffer) {
Debug::log(ERR, "Failed to acquire swapchain buffer for {}", pMonitor->szName);