mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2024-11-25 16:42:26 +00:00
output: add wlr_output_state.allow_artifacts
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
This commit is contained in:
parent
baf3fa27dc
commit
a0345f2854
@ -384,8 +384,7 @@ static void drm_connector_state_init(struct wlr_drm_connector_state *state,
|
|||||||
const struct wlr_output_state *base) {
|
const struct wlr_output_state *base) {
|
||||||
memset(state, 0, sizeof(*state));
|
memset(state, 0, sizeof(*state));
|
||||||
state->base = base;
|
state->base = base;
|
||||||
state->modeset = base->committed &
|
state->modeset = base->allow_artifacts;
|
||||||
(WLR_OUTPUT_STATE_ENABLED | WLR_OUTPUT_STATE_MODE);
|
|
||||||
state->active = (base->committed & WLR_OUTPUT_STATE_ENABLED) ?
|
state->active = (base->committed & WLR_OUTPUT_STATE_ENABLED) ?
|
||||||
base->enabled : conn->output.enabled;
|
base->enabled : conn->output.enabled;
|
||||||
|
|
||||||
|
@ -79,6 +79,9 @@ enum wlr_output_state_mode_type {
|
|||||||
*/
|
*/
|
||||||
struct wlr_output_state {
|
struct wlr_output_state {
|
||||||
uint32_t committed; // enum wlr_output_state_field
|
uint32_t committed; // enum wlr_output_state_field
|
||||||
|
// Set to true to allow temporary visual artifacts (e.g. black screen) while
|
||||||
|
// the update is being applied
|
||||||
|
bool allow_artifacts;
|
||||||
pixman_region32_t damage; // output-buffer-local coordinates
|
pixman_region32_t damage; // output-buffer-local coordinates
|
||||||
bool enabled;
|
bool enabled;
|
||||||
float scale;
|
float scale;
|
||||||
|
@ -4,6 +4,7 @@ void wlr_output_state_set_enabled(struct wlr_output_state *state,
|
|||||||
bool enabled) {
|
bool enabled) {
|
||||||
state->committed |= WLR_OUTPUT_STATE_ENABLED;
|
state->committed |= WLR_OUTPUT_STATE_ENABLED;
|
||||||
state->enabled = enabled;
|
state->enabled = enabled;
|
||||||
|
state->allow_artifacts = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_output_state_set_mode(struct wlr_output_state *state,
|
void wlr_output_state_set_mode(struct wlr_output_state *state,
|
||||||
@ -11,6 +12,7 @@ void wlr_output_state_set_mode(struct wlr_output_state *state,
|
|||||||
state->committed |= WLR_OUTPUT_STATE_MODE;
|
state->committed |= WLR_OUTPUT_STATE_MODE;
|
||||||
state->mode_type = WLR_OUTPUT_STATE_MODE_FIXED;
|
state->mode_type = WLR_OUTPUT_STATE_MODE_FIXED;
|
||||||
state->mode = mode;
|
state->mode = mode;
|
||||||
|
state->allow_artifacts = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_output_state_set_custom_mode(struct wlr_output_state *state,
|
void wlr_output_state_set_custom_mode(struct wlr_output_state *state,
|
||||||
@ -20,6 +22,7 @@ void wlr_output_state_set_custom_mode(struct wlr_output_state *state,
|
|||||||
state->custom_mode.width = width;
|
state->custom_mode.width = width;
|
||||||
state->custom_mode.height = height;
|
state->custom_mode.height = height;
|
||||||
state->custom_mode.refresh = refresh;
|
state->custom_mode.refresh = refresh;
|
||||||
|
state->allow_artifacts = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_output_state_set_scale(struct wlr_output_state *state, float scale) {
|
void wlr_output_state_set_scale(struct wlr_output_state *state, float scale) {
|
||||||
|
Loading…
Reference in New Issue
Block a user