mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-03-21 05:34:09 -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
|
|
@ -1155,16 +1155,15 @@ static void dealloc_crtc(struct wlr_drm_connector *conn) {
|
|||
wlr_drm_conn_log(conn, WLR_DEBUG, "De-allocating CRTC %" PRIu32,
|
||||
conn->crtc->id);
|
||||
|
||||
struct wlr_output_state state = {
|
||||
.committed = WLR_OUTPUT_STATE_ENABLED,
|
||||
.allow_artifacts = true,
|
||||
.enabled = false,
|
||||
};
|
||||
struct wlr_output_state state;
|
||||
wlr_output_state_init(&state);
|
||||
wlr_output_state_set_enabled(&state, false);
|
||||
if (!drm_connector_commit_state(conn, &state)) {
|
||||
// On GPU unplug, disabling the CRTC can fail with EPERM
|
||||
wlr_drm_conn_log(conn, WLR_ERROR, "Failed to disable CRTC %"PRIu32,
|
||||
conn->crtc->id);
|
||||
}
|
||||
wlr_output_state_finish(&state);
|
||||
}
|
||||
|
||||
static void realloc_crtcs(struct wlr_drm_backend *drm,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue