From 90e5b75968beeb5c0a5c7f56c675cdc69be7af7d Mon Sep 17 00:00:00 2001 From: Scott Moreau Date: Wed, 1 Jan 2020 21:52:32 -0700 Subject: [PATCH] output-layout: Track wlroots changes --- src/core/output-layout.cpp | 26 +++++++++++++++++++++----- src/output/render-manager.cpp | 4 ++++ 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/core/output-layout.cpp b/src/core/output-layout.cpp index d58bb69c3..1fe7602a5 100644 --- a/src/core/output-layout.cpp +++ b/src/core/output-layout.cpp @@ -513,7 +513,11 @@ namespace wf if (handle->current_mode->width == mode.width && handle->current_mode->height == mode.height && handle->current_mode->refresh == mode.refresh) + { + /* Commit the enabling of the output */ + wlr_output_commit(handle); return; + } } refresh_custom_modes(); @@ -530,7 +534,7 @@ namespace wf mode.refresh); } - return; + wlr_output_commit(handle); } /* Mirroring implementation */ @@ -587,6 +591,16 @@ namespace wf wlr_dmabuf_attributes_finish(&attributes); } + void set_enabled(bool enabled) + { + if (wlr_output_is_noop(handle)) + return; + + wlr_output_enable(handle, enabled); + if (!enabled) + wlr_output_commit(handle); + } + void setup_mirror() { /* Check if we can mirror */ @@ -608,8 +622,7 @@ namespace wf { /* If we mirror from a DPMS or an OFF output, we should turn * off this output as well */ - wlr_output_enable(handle, false); - + set_enabled(false); log_info("%s: Cannot mirror from output %s. Disabling output.", handle->name, current_state.mirror_from.c_str()); return; @@ -650,7 +663,7 @@ namespace wf if (state.source & OUTPUT_IMAGE_SOURCE_NONE) { /* DPMS or OFF */ - wlr_output_enable(handle, false); + set_enabled(false); if (state.source == OUTPUT_IMAGE_SOURCE_NONE) { /* OFF */ @@ -661,7 +674,7 @@ namespace wf else { /* SELF or MIRROR */ - wlr_output_enable(handle, true); + set_enabled(true); } apply_mode(state.mode); @@ -673,6 +686,8 @@ namespace wf if (handle->scale != state.scale) wlr_output_set_scale(handle, state.scale); + wlr_output_commit(handle); + ensure_wayfire_output(); output->render->damage_whole(); if (!wlr_output_is_noop(handle)) @@ -729,6 +744,7 @@ namespace wf get_core().connect_signal("shutdown", &on_shutdown); noop_backend = wlr_noop_backend_create(get_core().display); + wlr_backend_start(noop_backend); /* The noop output will be typically destroyed on the first * plugged monitor, however we need to create it here so that we * support booting with 0 monitors */ diff --git a/src/output/render-manager.cpp b/src/output/render-manager.cpp index bfac1d275..b5ff7136a 100644 --- a/src/output/render-manager.cpp +++ b/src/output/render-manager.cpp @@ -530,7 +530,10 @@ class wf::render_manager::impl bool needs_swap; if (!output_damage->make_current(needs_swap)) + { + wlr_output_rollback(output->handle); return; + } if (!needs_swap && !constant_redraw_counter) { @@ -538,6 +541,7 @@ class wf::render_manager::impl * and no plugin wants custom redrawing - we can just skip the whole * repaint */ post_paint(); + wlr_output_rollback(output->handle); return; }