aboutsummaryrefslogtreecommitdiffstats
path: root/sway/config/output.c
Commit message (Collapse)AuthorAge
* config/output: Print output state during testsLibravatar Kenny Levinsen2 days
| | | | | | Instead of having each search function print its various test decisions, print the full state at the end of every search. This makes it much clearer what state a particular test includes.
* config/output: Search for output config fallbacksLibravatar Kenny Levinsen2 days
| | | | | | | | | | | | | | | | The original sway output config implementation enabled one output at a time, testing modes, render formats and VRR support as it went along. While this sort of fallback is easy to do, it has the downside of not considering the effect of neighbor outputs on the configuration viability. With backend-wide commits, we can now better consider the effect of neighbor outputs, but to handle the fact that we commit all outputs at once we need to perform a more elaborate search of viable configurations. Implement a recursive configuration search for when the primary configuration failed to apply.
* config/output: Use all outputs for config mergeLibravatar Kenny Levinsen2 days
| | | | | | | | | | | When storing a config, we need to find the output that is being configured to extract its identifier. output_by_name_or_id does not return outputs that are disabled, and using this makes it impossible to merge configurations related to disabled outputs. Switch to all_outputs_by_name_or_id. Fixes: https://github.com/swaywm/sway/issues/8141
* config/output: drop fast path in store_output_config()Libravatar Simon Ser2024-04-13
| | | | | | | | If there is no output currently connected, we still want to merge to any existing config. It shouldn't matter to iterate over the list of outputs to do nothing anwyays.
* config/output: fix NULL derefs in store_output_config()Libravatar Simon Ser2024-04-13
| | | | | | | | | | | | | | | | | | | | | | ../sway/config/output.c:33:21: runtime error: member access within null pointer of type 'struct sway_output' AddressSanitizer:DEADLYSIGNAL ================================================================= ==7856==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000080 (pc 0x63da8558205c bp 0x7ffdc35881a0 sp 0x7ffdc3588160 T0) ==7856==The signal is caused by a READ memory access. ==7856==Hint: address points to the zero page. #0 0x63da8558205c in output_get_identifier ../sway/config/output.c:33 #1 0x63da855865c3 in store_output_config ../sway/config/output.c:220 #2 0x63da855d4066 in cmd_output ../sway/commands/output.c:106 #3 0x63da8547f2e3 in config_command ../sway/commands.c:425 #4 0x63da8548f3fc in read_config ../sway/config.c:822 #5 0x63da8548a224 in load_config ../sway/config.c:435 #6 0x63da8548b065 in load_main_config ../sway/config.c:507 #7 0x63da854bee8d in main ../sway/main.c:351 #8 0x77e2ea643ccf (/usr/lib/libc.so.6+0x25ccf) (BuildId: c0caa0b7709d3369ee575fcd7d7d0b0fc48733af) #9 0x77e2ea643d89 in __libc_start_main (/usr/lib/libc.so.6+0x25d89) (BuildId: c0caa0b7709d3369ee575fcd7d7d0b0fc48733af) #10 0x63da8547ad64 in _start (/home/simon/src/sway/build/sway/sway+0x372d64) (BuildId: 3fa2e8838c1c32713b40aec6b1e84bbe4db5bde8) Fixes: 1267e47de913 ("config/output: Refactor handling of tiered configs")
* config/output: Refactor handling of tiered configsLibravatar Kenny Levinsen2024-04-12
| | | | | | | | | | | | | | | | | | | | Output configuration can be applied to a particular output in three ways: As a wildcard, by connector name and by identifier. This in turn means that three different configurations must be handled at any given time. In the current model, this is managed by merging new configuration into every other matching configuration. At the same time, an additional synthetic configuration is made which matchehes both identifier and name at the same time, further complicating logic. Instead, manage and store each configuration independently and merge them in order when retrieving configuration for an output. When changes are made to a less specific configuration, clear these fields from more specific configurations to allow the change to take effect regardless of precedence. Fixes: https://github.com/swaywm/sway/issues/8048
* output/config: Remove unused test_output_configLibravatar Kenny Levinsen2024-03-28
|
* config/output: Make merge_output_config staticLibravatar Kenny Levinsen2024-03-28
|
* output/config: Remove reset_outputs and co.Libravatar Kenny Levinsen2024-03-28
| | | | | | | | | | | | | | | apply_output_config_to_outputs uses the specified output config to check which outputs to apply to, and to use as backup when no config is found. If any config matches the output, the specified config will be disregarded. The only remaining user of apply_output_config_to_outputs is reset_outputs, which called apply_output_config_to_outputs with either the first stored wildcard config, or a new empty wildcard config. Providing a stored or empty wildcard config is practically the same as calling `apply_all_output_configs`. Replace uses of `reset_outputs` with `apply_all_output_configs` and remove the now unused functions.
* config/output: Remove apply_output_configLibravatar Kenny Levinsen2024-03-28
|
* output/config: Add apply_all_output_configsLibravatar Kenny Levinsen2024-03-28
| | | | | | Apply all output configs as they are. This differs from apply_output_config_to_outputs, which tries to apply a specific output config.
* config/output: Introduce apply_output_configsLibravatar Kenny Levinsen2024-03-28
| | | | | | | Introduce apply_output_configs, which applies the specified matched output configs as a single backend commit. Reimplement apply_output_config_to_outputs using apply_output_configs.
* config/output: Split apply_output_configLibravatar Kenny Levinsen2024-03-28
| | | | | | | | | Applying an output config has two stages: Atomic application of wlr_output_state, and applicaiton of non-atomic state like output layout. Split the latter out into finalize_output_config for use in a later commit.
* config/output: drop enabling flagLibravatar Simon Ser2024-03-08
| | | | | This was useful when wlroots backends were updating the current mode on their own. This is no longer the case.
* Define _POSIX_C_SOURCE globallyLibravatar Simon Ser2024-02-23
| | | | See discussion in https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4555
* sway/output: Improve logging of swaybg execvp failure and more checksLibravatar Tamino Bauknecht2024-01-29
| | | | | | This doesn't catch the error if a background changing command is executed via swaymsg, but improves logging. The additional checks at least propagate if e.g. forking failed.
* scene_graph: Port opacity and filter modesLibravatar Alexander Orzechowski2024-01-18
|
* Delete old damage tracking codeLibravatar Alexander Orzechowski2024-01-18
| | | | The new scene graph abstraction handles this for us.
* Only reconfigure input mappings on output changeLibravatar Simon Ser2023-11-16
| | | | | | Fully reconfiguring all input devices on output change takes a loooong time. Let's just reconfigure what we need: only mappings depend on outputs.
* config/output: Allow approximation of output refresh rateLibravatar Tamino Bauknecht2023-10-23
| | | | | | | | | | | Previous behavior was that only if resolution and refresh rate match exactly, the mode was accepted. As fallback, the mode with the highest refresh rate and the same resolution was chosen. New behavior is that the mode with the closest match for the refresh rate is used with a limit of up to 1Hz. The fallback behavior stays the same. Additionally, the logging was made more verbose.
* output: drop current_modeLibravatar Simon Ser2023-07-31
| | | | This is now unused.
* Use format_str() throughoutLibravatar Simon Ser2023-04-14
|
* Use output_match_name_or_id() in apply_output_config_to_outputs()Libravatar Simon Ser2023-04-14
|
* Use all_output_by_name_or_id() in merge_id_on_name()Libravatar Simon Ser2023-04-14
| | | | No need to iterate over the outputs manually.
* Adjust scale for fractional-scale-v1Libravatar Simon Ser2023-02-22
|
* Replace math functions that promote float to doubleLibravatar Carl Smedstad2023-01-03
|
* Make DRM backend optionalLibravatar Simon Ser2022-11-28
|
* config/output: test adaptive syncLibravatar Simon Ser2022-08-30
| | | | | | Required for [1]. [1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3637
* Remove internal references to DPMSLibravatar Simon Ser2022-07-04
| | | | | While at it, use an int for the config field, just like we do for all other fields.
* config/output: use wlr_output_commit_stateLibravatar Simon Ser2022-06-10
| | | | | | | | | This makes the code more robust because we don't potentially leave bad state in wlr_output.pending behind anymore. This also fixes a bug. Closes: https://github.com/swaywm/sway/issues/7043 References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3610
* Handle NULL output make/model/serialLibravatar Simon Ser2022-05-26
|
* chore: chase wlr_output_layout_get_box() updateLibravatar Kirill Primak2022-01-31
| | | | https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3439
* sway: replace noop_output by fallback_outputLibravatar Simon Zeni2021-11-25
| | | | | wlroots removed the support for the noop backend. Instead we rely on the headless backend to provide the fallback output.
* Add 'output render_bit_depth [8|10]' commandLibravatar Manuel Stoeckl2021-11-23
| | | | | | | This makes it possible to hint to the renderer and backends how many bits per channel the buffers that the compositor draws windows onto should have. Renderers and backends may deviate from this if they do not support the formats with higher bit depth.
* Bump RLIMIT_NOFILELibravatar Simon Ser2021-10-30
| | | | | | | | Wayland compositors handle many file descriptors: client connections, DMA-BUFs, sync_files, wl_data_device pipes, and so on. Bump the limit to the max. Closes: https://github.com/swaywm/sway/issues/6285
* Add support for DRM panel orientationLibravatar Simon Ser2021-09-28
| | | | References: https://github.com/swaywm/wlroots/pull/3205
* Add `output modeline` commandLibravatar David Rosca2021-08-31
| | | | Only works with DRM backend.
* Fallback to other output modes if preferred mode failsLibravatar Simon Ser2021-08-12
| | | | | | | Sometimes the preferred mode is not available due to hardware constraints (e.g. GPU or cable bandwidth limitations). In these cases it's better to fallback to lower modes than to end up with a black screen.
* output: Reconfigure xcursor when applying output configLibravatar Tadeo Kondrak2021-02-24
| | | | | | | | | | | | Before this commit, when an output had its scale dynamically changed, Sway would not load a cursor theme with the new scale. This results in stale cursor images when moving the cursor into an area controlled by the compositor, like the background or resize areas. To reproduce: - Using IPC, set an output scale to a value that isn't currently used - Move the cursor into a compositor-controlled area - The cursor will not change
* config/output: correct refresh rate rounding errorLibravatar Ronan Pigott2021-01-15
|
* config/output: don't change output state before commitLibravatar Simon Ser2020-07-10
| | | | | | | | | | | | | | | | | | | | | | | Previously, we called output_disable prior to wlr_output_commit. This mutates Sway's output state before the output commit actually succeeds. This results in Sway's state getting out-of-sync with wlroots'. An alternative fix [1] was to revert the changes made by output_disable in case of failure. This is a little complicated. Instead, this patch makes it so Sway's internal state is never changed before a successful wlr_output commit. We had two output flags: enabled and configured. However enabled was set prior to the output becoming enabled, and was used to prevent the output event handlers (specifically, the mode handler) from calling apply_output_config again (infinite loop). Rename enabled to enabling and use it exclusively for this purpose. Rename configure to enabled, because that's what it really means. [1]: https://github.com/swaywm/sway/pull/5521 Closes: https://github.com/swaywm/sway/issues/5483
* input: disable events for map_to_output devices when output not presentLibravatar Tudor Brindus2020-06-19
| | | | Fixes #3449.
* Use new wlroots API for clearing keyboard/pointer focus during grabsLibravatar Thomas Hebb2020-06-05
| | | | | | | | | We are not allowed to do what we did in #5222 and pass a `NULL` surface wlr_seat_pointer_notify_enter(), and it's causing crashes when an xdg-shell popup is active (see #5294 and swaywm/wlroots#2161). Instead, solve #5220 using the new wlroots API introduced in swaywm/wlroots#2217.
* config/output: reconfigure input devices after full output initLibravatar Tudor Brindus2020-04-26
| | | | | | | | | | Previously in 3de1a39, it "worked by accident" in my testing since the display being used in `map_to_output` was initialized first (the map would not be applied because the display hadn't actually come online yet), and was followed by a second display (at which point the map would get applied for the first display). Refs #5231
* config/output: reconfigure input devices on new outputLibravatar Tudor Brindus2020-04-24
| | | | | | | | | | | | Some input rules, like `map_to_output`, are dependent on a specific screen being present. This currently does not work for hotplugged outputs, or outputs that are processed after the input device is initially probed. This commit fixes both cases, by reconfiguring inputs on each output addition. Fixes #5231.
* Don't add disabled outputs back to output layoutLibravatar Simon Ser2020-04-09
| | | | | | | Return early from apply_output_config if the output is disabled. This restores our previous behavior [1]. [1]: https://github.com/swaywm/sway/commit/0cdcf66bbccfeb1e3a8191cedd5f824bb27776a6#diff-4f65f4327e987fef8ec3796cdb07644eL349
* Fix initial modesetLibravatar Simon Ser2020-04-09
| | | | | | | | | | | | An if branch takes care of the case where the output needs to be turned off (DPMS'ed or disabled). The other branch needs to unconditionally enable the output. output->current_mode is already taken care of in apply_config. Sorry about that, probably made a bad change by mistake after my DRM testing. Closes: https://github.com/swaywm/sway/issues/5193
* Introduce test_output_configLibravatar Simon Ser2020-04-08
| | | | | This function checks whether the backend would accept an output configuration, without applying the changes.
* Add an adaptive_sync output commandLibravatar Simon Ser2020-03-07
| | | | | | | | | This enables/disables adaptive synchronization on the output. For now, the default is disabled because it might cause flickering on some hardware if clients don't submit frames at regular enough intervals. In the future an "auto" option will only enable adaptive sync if a fullscreen client opts-in via a Wayland protocol.
* output: fix updating output manager configLibravatar Brian Ashworth2020-02-16
| | | | | | | | | | | | | | | | | | The output manager config is created when the output is created. It is updated when the mode, transform, scale, or layout for the output changes, as well as, when the output is destroyed. Since the output->enabled property was not being set before calling apply_output_config, the output event handlers were early returning and never updating the output manager config when the output state was committed. This fixes the issue by setting output->enabled in apply_output_config below the output disabling section. There are also a few other minor changes that are required to function. Additionally, this renames output_enable to output_configure to better describe the recent changes.