Skip to content

Commit

Permalink
output-layout: Track wlroots changes
Browse files Browse the repository at this point in the history
  • Loading branch information
soreau authored and ammen99 committed Jan 3, 2020
1 parent a8bda1c commit 90e5b75
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
26 changes: 21 additions & 5 deletions src/core/output-layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -530,7 +534,7 @@ namespace wf
mode.refresh);
}

return;
wlr_output_commit(handle);
}

/* Mirroring implementation */
Expand Down Expand Up @@ -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 */
Expand All @@ -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;
Expand Down Expand Up @@ -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 */
Expand All @@ -661,7 +674,7 @@ namespace wf
else
{
/* SELF or MIRROR */
wlr_output_enable(handle, true);
set_enabled(true);
}

apply_mode(state.mode);
Expand All @@ -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))
Expand Down Expand Up @@ -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 */
Expand Down
4 changes: 4 additions & 0 deletions src/output/render-manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -530,14 +530,18 @@ 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)
{
/* Optimization: the output doesn't need a swap (so isn't damaged),
* and no plugin wants custom redrawing - we can just skip the whole
* repaint */
post_paint();
wlr_output_rollback(output->handle);
return;
}

Expand Down

0 comments on commit 90e5b75

Please sign in to comment.