Commit Graph

33 Commits

Author SHA1 Message Date
Simon Ser 9e10e9af7f output-damage: constify wlr_output_damage_add() 2022-11-11 23:11:17 +00:00
Kirill Primak dd0665d822 output-damage: drop precommit listener 2022-10-07 17:43:50 +03:00
Kirill Primak b9155c5b80 output-damage: fix setting pending_attach_render 2022-10-07 17:42:32 +03:00
Simon Ser 8e8b9a7217 output: fix back buffer checks
The back buffer is no longer set at commit time since 0556aa0c59
("output: rejigger attach/clear for back buffer").

Instead, check whether the buffer belongs to the output swapchain.
This is more robust.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3496
2022-09-21 16:18:16 +02:00
Alexander Orzechowski ef4baea0e2 Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04:00
Simon Ser b21c26a1c9 output: add wlr_output_event_precommit.state 2022-05-30 11:34:57 +02:00
Alexander Orzechowski f330759ba4 wlr_output_damage: Don't schedule a new frame if damage region does not intersect with output
This fixed adaptive sync issues with wlr_scene. Scenes don't check
if the damage region intersects with an output when calling
wlr_output_damage_add.

This is especially important for multi output.
2022-03-08 14:05:36 +00:00
Alexander Orzechowski fbd4d40318 wlr_output_damage: Use wlr_output_damage_add for wlr_output_damage_add_box 2022-03-08 14:05:36 +00:00
Simon Ser 04304c322e output-damage: fix damage on modeset
On modeset wlr_output will internally allocate a buffer. The
backend will emit a "mode" output event, then wlr_output will
emit a "commit" event.

wlr_output_damage handles the "mode" event by damaging the whole
output, and then handles the "commit" event. However the commit
event has a buffer, so wlr_output_damage rotates the damage in its
ring buffer, thinking the compositor has rendered a frame. The
compositor hasn't rendered a frame, what wlr_output_damage sees is
the internal wlr_output black buffer used for the modeset.

Let's fix this by damaging the whole output in the "commit" event
handler if the mode has changed. Additionally, damage the whole
output after rotating the damage ring buffer.
2021-09-07 22:27:31 +02:00
Simon Ser 3132c0ab10 output: drop wlr_output_state.buffer_type
This is now unconditionally set to WLR_OUTPUT_STATE_BUFFER_SCANOUT.
2021-07-29 09:48:33 -04:00
Simon Ser f211bc983a output-damage: stop using enum wlr_output_state_buffer_type
This enum will get dropped in the next commit.
2021-07-29 09:48:33 -04:00
Simon Ser a48e569d38 output-damage: fix output swapchain handling
When wlr_output.swapchain is used instead of the backend's, the
buffer_type will be set to SCANOUT even if wlr_output_attach_render
has been called. This tricks wlr_output_damage into thinking the
whole output needs to be repainted.

Workaround this issue by forcing buffer_type to RENDER when the
output has a back-buffer set.

Will clean all of that up when removing the precommit event handler
altogether.

This commit fixes damage tracking on the Wayland, X11 and headless
backends.
2021-07-07 12:02:24 -04:00
Simon Zeni e192d87731 move wlr_box from /types to /util 2021-07-06 21:43:17 +02:00
Simon Ser 1fb9535e99 output-damage: stop relying on output pending state on commit
References: https://github.com/swaywm/wlroots/issues/2098
2021-01-16 09:06:27 +01:00
Simon Ser f6f46b4ee2 output-damage: stop listening to scale/transform events
Only listen to the commit event.
2021-01-15 10:18:56 +01:00
Simon Ser edf5082a4c
output-damage: use output commit event
Instead of relying on output.pending.committed, use
wlr_output_event_commit to find out whether a buffer was committed.
Eventually output.pending will be cleared before the commit event is
emitted.

References: https://github.com/swaywm/wlroots/issues/2098
2021-01-10 17:02:25 +01:00
Simon Ser e0bbafc253 output: replace wlr_output.damage with a damage event
This patch disambiguates the needs_frame event by uncoupling it from
damage. A new separate damage event is emitted when the backend damages
the output (this happens e.g. VT is changed or software cursors are
used). The event specifies the damaged region.

The wlr_output.damage field is removed. wlr_output is no longer
responsible for tracking its own damage, this is wlr_output_damage's
job.

This is a breaking change, but wlr_output_damage users shouldn't need an
update.

Bugs fixed:

- Screen flashes on VT switch
- Cursor damage issues on the X11 and headless backends

Closes: https://github.com/swaywm/sway/issues/5086
2020-03-12 22:47:59 +01:00
Simon Ser ca45f4490c Remove all wayland-server.h includes
The documentation for wayland-server.h says:

> Use of this header file is discouraged. Prefer including
> wayland-server-core.h instead, which does not include the server protocol
> header and as such only defines the library PI, excluding the deprecated API
> below.

Replacing wayland-server.h with wayland-server-core.h allows us to drop the
WL_HIDE_DEPRECATED declaration.
2019-07-27 15:49:32 -04:00
Ilia Bozhinov fb739b8293 output-damage: set needs swap only when we have new damage
An output needs swap when there is new damage. If the damage is only
accumulated from the last frame, we could simply skip drawing.
2019-06-27 21:49:19 +03:00
Simon Ser e07ffaa249 output-damage: support direct scan-out
In case direct scan-out is used, we still need to accumulate damage for the
render-buffers.
2019-06-07 09:06:11 -04:00
Simon Ser 8d3369d70f output-damage: fix segfault after destroy
Fixes: 5e6766a165
2019-04-25 11:39:51 +03:00
Simon Ser 20690346c7 output: rename needs_commit to needs_frame
This new name makes more sense, since it is a request from the backend to get
a new frame. In the future a commit may not convey a new frame.
2019-04-23 14:34:30 -06:00
Simon Ser 5e6766a165 output-damage: refactor API
wlr_output_damage_make_current has been renamed to
wlr_output_damage_attach_render, since it's just a wrapper for
wlr_output_attach_render.

wlr_output_damage_swap_buffers has been removed completely. Instead,
wlr_output_damage now listens to successful wlr_output commits and updates its
internal state accordingly.
2019-04-23 14:34:30 -06:00
Simon Ser 9a0f8a194c output: refactor backend API
This updates the backend part of the output API. This is mostly renaming:
make_current becomes attach_render and swap_buffers becomes commit.

This also fixes the RDP backend to support NULL damage.
2019-04-23 14:34:30 -06:00
Simon Ser 23e37e7b1d output: refactor frame submission API
This is necessary for direct scan-out and other upcoming features. This patch
changes the output API to look like the wl_surface API.

Outputs now have some double-buffered state: the frame to be submitted
(currently only wlr_renderer frames are supported) and the damaged region.
To attach a pending frame, use wlr_output_attach_render. To set the pending
damaged region, use wlr_output_set_damage.

To submit the pending state, call wlr_output_commit. This will submit the
pending frame to the backend.

To migrate from the old API to the new one:

- Replace wlr_output_make_current calls by wlr_output_attach_render
- Replace wlr_output_swap_buffers calls by wlr_output_set_damage and
  wlr_output_commit
2019-04-23 14:34:30 -06:00
emersion 5087199d5d
output-damage: limit the number of damaged rectangles 2018-05-05 14:28:55 +01:00
Drew DeVault 1d9be89e2d
Revert "ELF Visibility" 2018-02-19 18:01:27 -05:00
Scott Anderson 86269052eb Explicitly export EFL symbols 2018-02-19 14:26:40 +13:00
emersion c2e1474010
Reformat all #include directives 2018-02-12 21:29:23 +01:00
emersion 36ead80cd1
Make wlr_signal_emit_safe private 2018-02-12 19:52:47 +01:00
emersion 5e58d46cc1
Add wlr_signal_emit_safe 2018-02-12 09:12:31 +01:00
emersion a9632341bf
output_damage: listen to transform and scale output events 2018-02-11 13:07:00 +01:00
emersion ec837e3c9e
Introduce wlr_output_damage 2018-02-11 12:49:30 +01:00