mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-03-15 05:34:22 -04:00
output: add wlr_output_state_init()
This changes the semantics of wlr_output_state. Instead of having fields with uninitialized memory when missing from the committed bitflag, all fields are always initialized (and maybe NULL/empty), just like we do in wlr_surface_state. This reduces the chances of footguns when reading a field, and removes the need to check for the committed bitfield everywhere. A new wlr_output_state_init() function takes care of initializing the Pixman region.
This commit is contained in:
parent
8a5b5e6f28
commit
be05097968
19 changed files with 103 additions and 103 deletions
|
|
@ -1534,7 +1534,8 @@ static bool scene_buffer_can_consider_direct_scanout(struct wlr_scene_buffer *bu
|
|||
|
||||
static bool scene_buffer_try_direct_scanout(struct wlr_scene_buffer *buffer,
|
||||
struct wlr_scene_output *scene_output, struct wlr_output_state *state) {
|
||||
struct wlr_output_state pending = {0};
|
||||
struct wlr_output_state pending;
|
||||
wlr_output_state_init(&pending);
|
||||
if (!wlr_output_state_copy(&pending, state)) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1564,19 +1565,23 @@ bool wlr_scene_output_commit(struct wlr_scene_output *scene_output) {
|
|||
return true;
|
||||
}
|
||||
|
||||
struct wlr_output_state state = {0};
|
||||
bool ok = false;
|
||||
struct wlr_output_state state;
|
||||
wlr_output_state_init(&state);
|
||||
if (!wlr_scene_output_build_state(scene_output, &state)) {
|
||||
return false;
|
||||
goto out;
|
||||
}
|
||||
|
||||
bool success = wlr_output_commit_state(scene_output->output, &state);
|
||||
ok = wlr_output_commit_state(scene_output->output, &state);
|
||||
if (!ok) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
wlr_damage_ring_rotate(&scene_output->damage_ring);
|
||||
|
||||
out:
|
||||
wlr_output_state_finish(&state);
|
||||
|
||||
if (success) {
|
||||
wlr_damage_ring_rotate(&scene_output->damage_ring);
|
||||
}
|
||||
|
||||
return success;
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool wlr_scene_output_build_state(struct wlr_scene_output *scene_output,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue