diff options
author | Vaxry <[email protected]> | 2024-01-27 13:58:13 +0000 |
---|---|---|
committer | Vaxry <[email protected]> | 2024-01-27 13:58:28 +0000 |
commit | 7b3d03938888f399c3c14adfce73ea22bbe461ea (patch) | |
tree | 871448bf8b8b3a942629793af27132686247a3ed | |
parent | 12d79d63421e2ed3f31130755c7a37f0e4fb5cb1 (diff) | |
download | Hyprland-7b3d03938888f399c3c14adfce73ea22bbe461ea.tar.gz Hyprland-7b3d03938888f399c3c14adfce73ea22bbe461ea.zip |
deps: update wlroots
drops requirement for WLR_DRM_NO_ATOMIC provided kernel >= 6.8
-rw-r--r-- | src/Compositor.cpp | 14 | ||||
-rw-r--r-- | src/Window.cpp | 2 | ||||
-rw-r--r-- | src/config/ConfigManager.cpp | 26 | ||||
-rw-r--r-- | src/events/Misc.cpp | 12 | ||||
-rw-r--r-- | src/helpers/Monitor.cpp | 30 | ||||
-rw-r--r-- | src/helpers/Monitor.hpp | 1 | ||||
-rw-r--r-- | src/managers/KeybindManager.cpp | 4 | ||||
-rw-r--r-- | src/managers/input/InputManager.cpp | 3 | ||||
-rw-r--r-- | src/render/Renderer.cpp | 82 | ||||
-rw-r--r-- | src/render/Renderer.hpp | 1 | ||||
m--------- | subprojects/wlroots | 0 |
11 files changed, 92 insertions, 83 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp index a4f7871f..a5550f2f 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -115,7 +115,7 @@ void CCompositor::initServer() { else wlr_log_init(WLR_ERROR, Debug::wlrLog); - m_sWLRBackend = wlr_backend_autocreate(m_sWLDisplay, &m_sWLRSession); + m_sWLRBackend = wlr_backend_autocreate(m_sWLEventLoop, &m_sWLRSession); if (!m_sWLRBackend) { Debug::log(CRIT, "m_sWLRBackend was NULL! This usually means wlroots could not find a GPU or enountered some issues."); @@ -239,7 +239,7 @@ void CCompositor::initServer() { m_sWLRActivation = wlr_xdg_activation_v1_create(m_sWLDisplay); - m_sWLRHeadlessBackend = wlr_headless_backend_create(m_sWLDisplay); + m_sWLRHeadlessBackend = wlr_headless_backend_create(m_sWLEventLoop); m_sWLRSessionLockMgr = wlr_session_lock_manager_v1_create(m_sWLDisplay); @@ -395,8 +395,8 @@ void CCompositor::cleanup() { for (auto& m : m_vMonitors) { g_pHyprOpenGL->destroyMonitorResources(m.get()); - wlr_output_enable(m->output, false); - wlr_output_commit(m->output); + wlr_output_state_set_enabled(&m->outputState, false); + wlr_output_commit_state(m->output, &m->outputState); } m_vMonitors.clear(); @@ -2670,11 +2670,7 @@ int CCompositor::getNewSpecialID() { } void CCompositor::performUserChecks() { - if (g_pConfigManager->getInt("general:allow_tearing") == 1 && !envEnabled("WLR_DRM_NO_ATOMIC")) { - g_pHyprNotificationOverlay->addNotification("You have enabled tearing, but immediate presentations are not available on your configuration. Try adding " - "env = WLR_DRM_NO_ATOMIC,1 to your config.", - CColor(0), 15000, ICON_WARNING); - } + ; // intentional } void CCompositor::moveWindowToWorkspaceSafe(CWindow* pWindow, CWorkspace* pWorkspace) { diff --git a/src/Window.cpp b/src/Window.cpp index 5a50713b..ceda1284 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -1061,7 +1061,7 @@ int CWindow::getRealBorderSize() { } bool CWindow::canBeTorn() { - return (m_sAdditionalConfigData.forceTearing.toUnderlying() || m_bTearingHint) && g_pHyprRenderer->m_bTearingEnvSatisfied; + return (m_sAdditionalConfigData.forceTearing.toUnderlying() || m_bTearingHint); } bool CWindow::shouldSendFullscreenState() { diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 532a8a38..e9d2e512 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -2310,30 +2310,30 @@ void CConfigManager::ensureVRR(CMonitor* pMonitor) { static auto* const PVRR = &getConfigValuePtr("misc:vrr")->intValue; static auto ensureVRRForDisplay = [&](CMonitor* m) -> void { - if (!m->output) + if (!m->output || m->createdByUser) return; const auto USEVRR = m->activeMonitorRule.vrr.has_value() ? m->activeMonitorRule.vrr.value() : *PVRR; if (USEVRR == 0) { if (m->vrrActive) { - wlr_output_enable_adaptive_sync(m->output, 0); + wlr_output_state_set_adaptive_sync_enabled(&m->outputState, 0); - if (!wlr_output_commit(m->output)) + if (!wlr_output_commit_state(m->output, &m->outputState)) Debug::log(ERR, "Couldn't commit output {} in ensureVRR -> false", m->output->name); } m->vrrActive = false; return; } else if (USEVRR == 1) { if (!m->vrrActive) { - wlr_output_enable_adaptive_sync(m->output, 1); + wlr_output_state_set_adaptive_sync_enabled(&m->outputState, 1); - if (!wlr_output_test(m->output)) { + if (!wlr_output_test_state(m->output, &m->outputState)) { Debug::log(LOG, "Pending output {} does not accept VRR.", m->output->name); - wlr_output_enable_adaptive_sync(m->output, 0); + wlr_output_state_set_adaptive_sync_enabled(&m->outputState, 0); } - if (!wlr_output_commit(m->output)) + if (!wlr_output_commit_state(m->output, &m->outputState)) Debug::log(ERR, "Couldn't commit output {} in ensureVRR -> true", m->output->name); } m->vrrActive = true; @@ -2350,20 +2350,20 @@ void CConfigManager::ensureVRR(CMonitor* pMonitor) { const auto WORKSPACEFULL = PWORKSPACE->m_bHasFullscreenWindow && PWORKSPACE->m_efFullscreenMode == FULLSCREEN_FULL; if (WORKSPACEFULL && m->output->adaptive_sync_status == WLR_OUTPUT_ADAPTIVE_SYNC_DISABLED) { - wlr_output_enable_adaptive_sync(m->output, 1); + wlr_output_state_set_adaptive_sync_enabled(&m->outputState, 1); - if (!wlr_output_test(m->output)) { + if (!wlr_output_test_state(m->output, &m->outputState)) { Debug::log(LOG, "Pending output {} does not accept VRR.", m->output->name); - wlr_output_enable_adaptive_sync(m->output, 0); + wlr_output_state_set_adaptive_sync_enabled(&m->outputState, 0); } - if (!wlr_output_commit(m->output)) + if (!wlr_output_commit_state(m->output, &m->outputState)) Debug::log(ERR, "Couldn't commit output {} in ensureVRR -> true", m->output->name); } else if (!WORKSPACEFULL && m->output->adaptive_sync_status == WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED) { - wlr_output_enable_adaptive_sync(m->output, 0); + wlr_output_state_set_adaptive_sync_enabled(&m->outputState, 0); - if (!wlr_output_commit(m->output)) + if (!wlr_output_commit_state(m->output, &m->outputState)) Debug::log(ERR, "Couldn't commit output {} in ensureVRR -> false", m->output->name); } } diff --git a/src/events/Misc.cpp b/src/events/Misc.cpp index 6b77d9c5..b186236a 100644 --- a/src/events/Misc.cpp +++ b/src/events/Misc.cpp @@ -175,11 +175,17 @@ void Events::listener_sessionActive(wl_listener* listener, void* data) { void Events::listener_powerMgrSetMode(wl_listener* listener, void* data) { Debug::log(LOG, "PowerMgr set mode!"); - const auto EVENT = (wlr_output_power_v1_set_mode_event*)data; + const auto EVENT = (wlr_output_power_v1_set_mode_event*)data; + const auto PMONITOR = g_pCompositor->getMonitorFromOutput(EVENT->output); - wlr_output_enable(EVENT->output, EVENT->mode == 1); + if (!PMONITOR) { + Debug::log(ERR, "Invalid powerMgrSetMode output"); + return; + } + + wlr_output_state_set_enabled(&PMONITOR->outputState, EVENT->mode == 1); - if (!wlr_output_commit(EVENT->output)) + if (!wlr_output_commit_state(EVENT->output, &PMONITOR->outputState)) Debug::log(ERR, "Couldn't set power mode"); } diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp index e62d9d49..f476c4c3 100644 --- a/src/helpers/Monitor.cpp +++ b/src/helpers/Monitor.cpp @@ -10,10 +10,12 @@ int ratHandler(void* data) { CMonitor::CMonitor() { wlr_damage_ring_init(&damage); + wlr_output_state_init(&outputState); } CMonitor::~CMonitor() { wlr_damage_ring_finish(&damage); + wlr_output_state_finish(&outputState); hyprListener_monitorDestroy.removeCallback(); hyprListener_monitorFrame.removeCallback(); @@ -43,8 +45,8 @@ void CMonitor::onConnect(bool noRule) { tearingState.canTear = wlr_backend_is_drm(output->backend); // tearing only works on drm if (m_bEnabled) { - wlr_output_enable(output, 1); - wlr_output_commit(output); + wlr_output_state_set_enabled(&outputState, true); + wlr_output_commit_state(output, &outputState); return; } @@ -63,8 +65,8 @@ void CMonitor::onConnect(bool noRule) { // if it's disabled, disable and ignore if (monitorRule.disabled) { - wlr_output_set_scale(output, 1); - wlr_output_set_transform(output, WL_OUTPUT_TRANSFORM_NORMAL); + wlr_output_state_set_scale(&outputState, 1); + wlr_output_state_set_transform(&outputState, WL_OUTPUT_TRANSFORM_NORMAL); auto PREFSTATE = wlr_output_preferred_mode(output); @@ -72,9 +74,9 @@ void CMonitor::onConnect(bool noRule) { wlr_output_mode* mode; wl_list_for_each(mode, &output->modes, link) { - wlr_output_set_mode(output, PREFSTATE); + wlr_output_state_set_mode(&outputState, mode); - if (!wlr_output_test(output)) + if (!wlr_output_test_state(output, &outputState)) continue; PREFSTATE = mode; @@ -83,13 +85,13 @@ void CMonitor::onConnect(bool noRule) { } if (PREFSTATE) - wlr_output_set_mode(output, PREFSTATE); + wlr_output_state_set_mode(&outputState, PREFSTATE); else Debug::log(WARN, "No mode found for disabled output {}", output->name); - wlr_output_enable(output, 0); + wlr_output_state_set_enabled(&outputState, 0); - if (!wlr_output_commit(output)) + if (!wlr_output_commit_state(output, &outputState)) Debug::log(ERR, "Couldn't commit disabled state on output {}", output->name); m_bEnabled = false; @@ -130,13 +132,14 @@ void CMonitor::onConnect(bool noRule) { m_bEnabled = true; - wlr_output_enable(output, 1); + wlr_output_state_set_enabled(&outputState, 1); // set mode, also applies if (!noRule) g_pHyprRenderer->applyMonitorRule(this, &monitorRule, true); - wlr_output_commit(output); + if (!wlr_output_commit_state(output, &outputState)) + Debug::log(WARN, "wlr_output_commit_state failed in CMonitor::onCommit"); wlr_damage_ring_set_bounds(&damage, vecTransformedSize.x, vecTransformedSize.y); @@ -283,9 +286,10 @@ void CMonitor::onDisconnect(bool destroy) { if (!destroy) wlr_output_layout_remove(g_pCompositor->m_sWLROutputLayout, output); - wlr_output_enable(output, false); + wlr_output_state_set_enabled(&outputState, false); - wlr_output_commit(output); + if (!wlr_output_commit_state(output, &outputState)) + Debug::log(WARN, "wlr_output_commit_state failed in CMonitor::onDisconnect"); if (g_pCompositor->m_pLastMonitor == this) g_pCompositor->setActiveMonitor(BACKUPMON); diff --git a/src/helpers/Monitor.hpp b/src/helpers/Monitor.hpp index 943b929d..b1448fa9 100644 --- a/src/helpers/Monitor.hpp +++ b/src/helpers/Monitor.hpp @@ -63,6 +63,7 @@ class CMonitor { bool gammaChanged = false; float xwaylandScale = 1.f; std::array<float, 9> projMatrix = {0}; + wlr_output_state outputState = {0}; // TODO: write a wrapper for this garbage 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. diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index a08c95f5..7d31a039 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -1852,11 +1852,11 @@ void CKeybindManager::dpms(std::string arg) { if (!port.empty() && m->szName != port) continue; - wlr_output_enable(m->output, enable); + wlr_output_state_set_enabled(&m->outputState, enable); m->dpmsStatus = enable; - if (!wlr_output_commit(m->output)) { + if (!wlr_output_commit_state(m->output, &m->outputState)) { Debug::log(ERR, "Couldn't commit output {}", m->szName); } diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index 8a98fe67..2c46cf85 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -695,7 +695,8 @@ void CInputManager::onMouseWheel(wlr_pointer_axis_event* e) { return; } - wlr_seat_pointer_notify_axis(g_pCompositor->m_sSeat.seat, e->time_msec, e->orientation, factor * e->delta, std::round(factor * e->delta_discrete), e->source); + wlr_seat_pointer_notify_axis(g_pCompositor->m_sSeat.seat, e->time_msec, e->orientation, factor * e->delta, std::round(factor * e->delta_discrete), e->source, + WLR_AXIS_RELATIVE_DIRECTION_IDENTICAL); } Vector2D CInputManager::getMouseCoordsInternal() { diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index d44aafd5..61f21854 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -9,8 +9,6 @@ extern "C" { } CHyprRenderer::CHyprRenderer() { - if (envEnabled("WLR_DRM_NO_ATOMIC")) - m_bTearingEnvSatisfied = true; if (g_pCompositor->m_sWLRSession) { wlr_device* dev; @@ -905,9 +903,9 @@ bool CHyprRenderer::attemptDirectScanout(CMonitor* pMonitor) { return false; // finally, we should be GTG. - wlr_output_attach_buffer(pMonitor->output, &PSURFACE->buffer->base); + wlr_output_state_set_buffer(&pMonitor->outputState, &PSURFACE->buffer->base); - if (!wlr_output_test(pMonitor->output)) + if (!wlr_output_test_state(pMonitor->output, &pMonitor->outputState)) return false; timespec now; @@ -915,7 +913,7 @@ bool CHyprRenderer::attemptDirectScanout(CMonitor* pMonitor) { wlr_surface_send_frame_done(PSURFACE, &now); wlr_presentation_surface_scanned_out_on_output(PSURFACE, pMonitor->output); - if (wlr_output_commit(pMonitor->output)) { + if (wlr_output_commit_state(pMonitor->output, &pMonitor->outputState)) { if (!m_pLastScanout) { m_pLastScanout = PCANDIDATE; Debug::log(LOG, "Entered a direct scanout to {:x}: \"{}\"", (uintptr_t)PCANDIDATE, PCANDIDATE->m_szTitle); @@ -1016,14 +1014,15 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) { const auto PGAMMACTRL = wlr_gamma_control_manager_v1_get_control(g_pCompositor->m_sWLRGammaCtrlMgr, pMonitor->output); - if (!wlr_gamma_control_v1_apply(PGAMMACTRL, &pMonitor->output->pending)) { + if (!wlr_gamma_control_v1_apply(PGAMMACTRL, &pMonitor->outputState)) { Debug::log(ERR, "Could not apply gamma control to {}", pMonitor->szName); return; } - if (!wlr_output_test(pMonitor->output)) { + if (!wlr_output_test_state(pMonitor->output, &pMonitor->outputState)) { Debug::log(ERR, "Output test failed for setting gamma to {}", pMonitor->szName); - wlr_output_rollback(pMonitor->output); + // aka rollback + wlr_gamma_control_v1_apply(nullptr, &pMonitor->outputState); wlr_gamma_control_v1_send_failed_and_destroy(PGAMMACTRL); } } @@ -1238,9 +1237,9 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) { EMIT_HOOK_EVENT("render", RENDER_POST); - pMonitor->output->pending.tearing_page_flip = shouldTear; + pMonitor->outputState.tearing_page_flip = shouldTear; - if (!wlr_output_commit(pMonitor->output)) { + if (!wlr_output_commit_state(pMonitor->output, &pMonitor->outputState)) { if (UNLOCK_SC) wlr_output_lock_software_cursors(pMonitor->output, false); @@ -1327,6 +1326,8 @@ void CHyprRenderer::outputMgrApplyTest(wlr_output_configuration_v1* config, bool std::string commandForCfg = ""; const auto OUTPUT = head->state.output; + const auto PMONITOR = g_pCompositor->getMonitorFromOutput(OUTPUT); + RASSERT(PMONITOR, "nullptr monitor in outputMgrApplyTest"); commandForCfg += std::string(OUTPUT->name) + ","; @@ -1337,7 +1338,7 @@ void CHyprRenderer::outputMgrApplyTest(wlr_output_configuration_v1* config, bool continue; } - wlr_output_enable(OUTPUT, head->state.enabled); + wlr_output_state_set_enabled(&PMONITOR->outputState, head->state.enabled); if (head->state.mode) commandForCfg += @@ -1351,10 +1352,10 @@ void CHyprRenderer::outputMgrApplyTest(wlr_output_configuration_v1* config, bool if (!test) { g_pConfigManager->parseKeyword("monitor", commandForCfg, true); - wlr_output_state_set_adaptive_sync_enabled(&OUTPUT->pending, head->state.adaptive_sync_enabled); + wlr_output_state_set_adaptive_sync_enabled(&PMONITOR->outputState, head->state.adaptive_sync_enabled); } - ok = wlr_output_test(OUTPUT); + ok = wlr_output_test_state(OUTPUT, &PMONITOR->outputState); if (!ok) break; @@ -1764,10 +1765,10 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR pMonitor->scale = DEFAULTSCALE; } - wlr_output_set_scale(pMonitor->output, pMonitor->scale); + wlr_output_state_set_scale(&pMonitor->outputState, pMonitor->scale); pMonitor->setScale = pMonitor->scale; - wlr_output_set_transform(pMonitor->output, pMonitorRule->transform); + wlr_output_state_set_transform(&pMonitor->outputState, pMonitorRule->transform); pMonitor->transform = pMonitorRule->transform; const auto WLRREFRESHRATE = (wlr_backend_is_wl(pMonitor->output->backend) || wlr_backend_is_x11(pMonitor->output->backend)) ? 0 : pMonitorRule->refreshRate * 1000; @@ -1782,9 +1783,9 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR // if delta of refresh rate, w and h chosen and mode is < 1 we accept it if (DELTALESSTHAN(mode->width, pMonitorRule->resolution.x, 1) && DELTALESSTHAN(mode->height, pMonitorRule->resolution.y, 1) && DELTALESSTHAN(mode->refresh / 1000.f, pMonitorRule->refreshRate, 1)) { - wlr_output_set_mode(pMonitor->output, mode); + wlr_output_state_set_mode(&pMonitor->outputState, mode); - if (!wlr_output_test(pMonitor->output)) { + if (!wlr_output_test_state(pMonitor->output, &pMonitor->outputState)) { Debug::log(LOG, "Monitor {}: REJECTED available mode: {}x{}@{:2f}!", pMonitor->output->name, mode->width, mode->height, mode->refresh / 1000.f); continue; } @@ -1802,11 +1803,11 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR } if (!found) { - wlr_output_set_custom_mode(pMonitor->output, (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, WLRREFRESHRATE); + wlr_output_state_set_custom_mode(&pMonitor->outputState, (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, WLRREFRESHRATE); pMonitor->vecSize = pMonitorRule->resolution; pMonitor->refreshRate = pMonitorRule->refreshRate; - if (!wlr_output_test(pMonitor->output)) { + if (!wlr_output_test_state(pMonitor->output, &pMonitor->outputState)) { Debug::log(ERR, "Custom resolution FAILED, falling back to preferred"); const auto PREFERREDMODE = wlr_output_preferred_mode(pMonitor->output); @@ -1818,7 +1819,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR } // Preferred is valid - wlr_output_set_mode(pMonitor->output, PREFERREDMODE); + wlr_output_state_set_mode(&pMonitor->outputState, PREFERREDMODE); Debug::log(ERR, "Monitor {} got an invalid requested mode: {:X0}@{:2f}, using the preferred one instead: {}x{}@{:2f}", pMonitor->output->name, pMonitorRule->resolution, (float)pMonitorRule->refreshRate, PREFERREDMODE->width, PREFERREDMODE->height, PREFERREDMODE->refresh / 1000.f); @@ -1840,7 +1841,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR } else { auto* mode = wlr_drm_connector_add_mode(pMonitor->output, &pMonitorRule->drmMode); if (mode) { - wlr_output_set_mode(pMonitor->output, mode); + wlr_output_state_set_mode(&pMonitor->outputState, mode); pMonitor->customDrmMode = pMonitorRule->drmMode; } else { Debug::log(ERR, "wlr_drm_connector_add_mode failed"); @@ -1848,13 +1849,13 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR } } } else { - wlr_output_set_custom_mode(pMonitor->output, (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, WLRREFRESHRATE); + wlr_output_state_set_custom_mode(&pMonitor->outputState, (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, WLRREFRESHRATE); } pMonitor->vecSize = pMonitorRule->resolution; pMonitor->refreshRate = pMonitorRule->refreshRate; - if (fail || !wlr_output_test(pMonitor->output)) { + if (fail || !wlr_output_test_state(pMonitor->output, &pMonitor->outputState)) { Debug::log(ERR, "Custom resolution FAILED, falling back to preferred"); const auto PREFERREDMODE = wlr_output_preferred_mode(pMonitor->output); @@ -1866,7 +1867,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR } // Preferred is valid - wlr_output_set_mode(pMonitor->output, PREFERREDMODE); + wlr_output_state_set_mode(&pMonitor->outputState, PREFERREDMODE); Debug::log(ERR, "Monitor {} got an invalid requested mode: {:X0}@{:2f}, using the preferred one instead: {}x{}@{:2f}", pMonitor->output->name, pMonitorRule->resolution, (float)pMonitorRule->refreshRate, PREFERREDMODE->width, PREFERREDMODE->height, PREFERREDMODE->refresh / 1000.f); @@ -1890,8 +1891,8 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR if (pMonitorRule->resolution == Vector2D(-1, -1)) { wl_list_for_each(mode, &pMonitor->output->modes, link) { if ((mode->width >= currentWidth && mode->height >= currentHeight && mode->refresh >= (currentRefresh - 1000.f)) || mode->refresh > (currentRefresh + 3000.f)) { - wlr_output_set_mode(pMonitor->output, mode); - if (wlr_output_test(pMonitor->output)) { + wlr_output_state_set_mode(&pMonitor->outputState, mode); + if (wlr_output_test_state(pMonitor->output, &pMonitor->outputState)) { currentWidth = mode->width; currentHeight = mode->height; currentRefresh = mode->refresh; @@ -1903,8 +1904,8 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR wl_list_for_each(mode, &pMonitor->output->modes, link) { if ((mode->width >= currentWidth && mode->height >= currentHeight && mode->refresh >= (currentRefresh - 1000.f)) || (mode->width > currentWidth && mode->height > currentHeight)) { - wlr_output_set_mode(pMonitor->output, mode); - if (wlr_output_test(pMonitor->output)) { + wlr_output_state_set_mode(&pMonitor->outputState, mode); + if (wlr_output_test_state(pMonitor->output, &pMonitor->outputState)) { currentWidth = mode->width; currentHeight = mode->height; currentRefresh = mode->refresh; @@ -1927,7 +1928,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR } // Preferred is valid - wlr_output_set_mode(pMonitor->output, PREFERREDMODE); + wlr_output_state_set_mode(&pMonitor->outputState, PREFERREDMODE); Debug::log(ERR, "Monitor {} got an invalid requested mode: {:X0}@{:2f}, using the preferred one instead: {}x{}@{:2f}", pMonitor->output->name, pMonitorRule->resolution, (float)pMonitorRule->refreshRate, PREFERREDMODE->width, PREFERREDMODE->height, PREFERREDMODE->refresh / 1000.f); @@ -1952,9 +1953,9 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR wlr_output_mode* mode; wl_list_for_each(mode, &pMonitor->output->modes, link) { - wlr_output_set_mode(pMonitor->output, mode); + wlr_output_state_set_mode(&pMonitor->outputState, mode); - if (!wlr_output_test(pMonitor->output)) { + if (!wlr_output_test_state(pMonitor->output, &pMonitor->outputState)) { Debug::log(LOG, "Monitor {}: REJECTED available mode: {}x{}@{:2f}!", pMonitor->output->name, mode->width, mode->height, mode->refresh / 1000.f); continue; } @@ -1970,7 +1971,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR } } else { // Preferred is valid - wlr_output_set_mode(pMonitor->output, PREFERREDMODE); + wlr_output_state_set_mode(&pMonitor->outputState, PREFERREDMODE); pMonitor->vecSize = Vector2D(PREFERREDMODE->width, PREFERREDMODE->height); pMonitor->refreshRate = PREFERREDMODE->refresh / 1000.f; @@ -1979,7 +1980,8 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR } } - pMonitor->vrrActive = pMonitor->output->pending.adaptive_sync_enabled; // disabled here, will be tested in CConfigManager::ensureVRR() + pMonitor->vrrActive = pMonitor->outputState.adaptive_sync_enabled // disabled here, will be tested in CConfigManager::ensureVRR() + || pMonitor->createdByUser; // wayland backend doesn't allow for disabling adaptive_sync pMonitor->vecPixelSize = pMonitor->vecSize; @@ -1996,7 +1998,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR Vector2D logicalZero = pMonitor->vecPixelSize / scaleZero; if (logicalZero == logicalZero.round()) { pMonitor->scale = scaleZero; - wlr_output_set_scale(pMonitor->output, pMonitor->scale); + wlr_output_state_set_scale(&pMonitor->outputState, pMonitor->scale); } else { for (size_t i = 1; i < 90; ++i) { double scaleUp = (searchScale + i) / 120.0; @@ -2039,7 +2041,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR double logicalX = std::round(pMonitor->vecPixelSize.x / pMonitor->scale); logicalX += 0.1; - wlr_output_set_scale(pMonitor->output, pMonitor->vecPixelSize.x / logicalX); + wlr_output_state_set_scale(&pMonitor->outputState, pMonitor->vecPixelSize.x / logicalX); } } @@ -2058,9 +2060,9 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR pMonitor->drmFormat = DRM_FORMAT_INVALID; for (auto& fmt : formats[(int)!pMonitorRule->enable10bit]) { - wlr_output_set_render_format(pMonitor->output, fmt.second); + wlr_output_state_set_render_format(&pMonitor->outputState, fmt.second); - if (!wlr_output_test(pMonitor->output)) { + if (!wlr_output_test_state(pMonitor->output, &pMonitor->outputState)) { Debug::log(ERR, "output {} failed basic test on format {}", pMonitor->szName, fmt.first); } else { Debug::log(LOG, "output {} succeeded basic test on format {}", pMonitor->szName, fmt.first); @@ -2074,7 +2076,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR pMonitor->enabled10bit = set10bit; - if (!wlr_output_commit(pMonitor->output)) { + if (!wlr_output_commit_state(pMonitor->output, &pMonitor->outputState)) { Debug::log(ERR, "Couldn't commit output named {}", pMonitor->output->name); } @@ -2441,7 +2443,7 @@ bool CHyprRenderer::beginRender(CMonitor* pMonitor, CRegion& damage, eRenderMode } if (!buffer) { - if (!wlr_output_configure_primary_swapchain(pMonitor->output, &pMonitor->output->pending, &pMonitor->output->swapchain)) + if (!wlr_output_configure_primary_swapchain(pMonitor->output, &pMonitor->outputState, &pMonitor->output->swapchain)) return false; m_pCurrentWlrBuffer = wlr_swapchain_acquire(pMonitor->output->swapchain, &m_iLastBufferAge); @@ -2485,7 +2487,7 @@ void CHyprRenderer::endRender() { glFlush(); if (m_eRenderMode == RENDER_MODE_NORMAL) { - wlr_output_state_set_buffer(&PMONITOR->output->pending, m_pCurrentWlrBuffer); + wlr_output_state_set_buffer(&PMONITOR->outputState, m_pCurrentWlrBuffer); unsetEGL(); // flush the context } diff --git a/src/render/Renderer.hpp b/src/render/Renderer.hpp index bc914558..d83e772b 100644 --- a/src/render/Renderer.hpp +++ b/src/render/Renderer.hpp @@ -82,7 +82,6 @@ class CHyprRenderer { CMonitor* m_pMostHzMonitor = nullptr; bool m_bDirectScanoutBlocked = false; bool m_bSoftwareCursorsLocked = false; - bool m_bTearingEnvSatisfied = false; DAMAGETRACKINGMODES damageTrackingModeFromStr(const std::string&); diff --git a/subprojects/wlroots b/subprojects/wlroots -Subproject f81c3d93cd6f61b20ae784297679283438def8d +Subproject 00b869c1a96f300a8f25da95d624524895e0ddf |