mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-25 22:25:58 +01:00
a0345f2854
When starting up, the compositor might call wlr_output_set_mode() with a mode which is already the current one. wlroots will detect this and make the wlr_output_set_mode() call a no-op. During the next wlr_output_commit() call, wlroots will perform an atomic commit without the ALLOW_MODESET flag. This is an issue, because some drivers need ALLOW_MODESET even if the mode is the same. For instance, if the FB stride or modifier changed, some drivers require a modeset. Add a new flag "allow_artifacts" which is set when the compositor calls mode-setting functions. Use this flag to figure out whether we want to perform atomic commits with ALLOW_MODESET. (The name "allow_artifacts" is picked because ALLOW_MODESET is a misnomer, see [1].) [1]: https://patchwork.freedesktop.org/patch/505107/ Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3499
55 lines
1.7 KiB
C
55 lines
1.7 KiB
C
#include "types/wlr_output.h"
|
|
|
|
void wlr_output_state_set_enabled(struct wlr_output_state *state,
|
|
bool enabled) {
|
|
state->committed |= WLR_OUTPUT_STATE_ENABLED;
|
|
state->enabled = enabled;
|
|
state->allow_artifacts = true;
|
|
}
|
|
|
|
void wlr_output_state_set_mode(struct wlr_output_state *state,
|
|
struct wlr_output_mode *mode) {
|
|
state->committed |= WLR_OUTPUT_STATE_MODE;
|
|
state->mode_type = WLR_OUTPUT_STATE_MODE_FIXED;
|
|
state->mode = mode;
|
|
state->allow_artifacts = true;
|
|
}
|
|
|
|
void wlr_output_state_set_custom_mode(struct wlr_output_state *state,
|
|
int32_t width, int32_t height, int32_t refresh) {
|
|
state->committed |= WLR_OUTPUT_STATE_MODE;
|
|
state->mode_type = WLR_OUTPUT_STATE_MODE_CUSTOM;
|
|
state->custom_mode.width = width;
|
|
state->custom_mode.height = height;
|
|
state->custom_mode.refresh = refresh;
|
|
state->allow_artifacts = true;
|
|
}
|
|
|
|
void wlr_output_state_set_scale(struct wlr_output_state *state, float scale) {
|
|
state->committed |= WLR_OUTPUT_STATE_SCALE;
|
|
state->scale = scale;
|
|
}
|
|
|
|
void wlr_output_state_set_transform(struct wlr_output_state *state,
|
|
enum wl_output_transform transform) {
|
|
state->committed |= WLR_OUTPUT_STATE_TRANSFORM;
|
|
state->transform = transform;
|
|
}
|
|
|
|
void wlr_output_state_set_adaptive_sync_enabled(struct wlr_output_state *state,
|
|
bool enabled) {
|
|
state->committed |= WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED;
|
|
state->adaptive_sync_enabled = enabled;
|
|
}
|
|
|
|
void wlr_output_state_set_render_format(struct wlr_output_state *state,
|
|
uint32_t format) {
|
|
state->committed |= WLR_OUTPUT_STATE_RENDER_FORMAT;
|
|
state->render_format = format;
|
|
}
|
|
|
|
void wlr_output_state_set_subpixel(struct wlr_output_state *state,
|
|
enum wl_output_subpixel subpixel) {
|
|
state->committed |= WLR_OUTPUT_STATE_SUBPIXEL;
|
|
state->subpixel = subpixel;
|
|
}
|