mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-23 22:05:59 +01:00
stuff I already forgot what I did
This commit is contained in:
parent
bd92c92ba1
commit
81bad1f8fc
3 changed files with 16 additions and 13 deletions
|
@ -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);
|
||||
|
||||
|
@ -775,10 +775,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);
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ class CMonitorState {
|
|||
|
||||
bool commit();
|
||||
bool test();
|
||||
bool updateSwapchain();
|
||||
|
||||
private:
|
||||
CMonitor* m_pOwner;
|
||||
|
|
|
@ -2607,18 +2607,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);
|
||||
|
|
Loading…
Reference in a new issue