From 20690346c7a9f75cfb181cb613b8f006e6ce3e14 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 23 Apr 2019 20:22:42 +0300 Subject: [PATCH] output: rename needs_commit to needs_frame This new name makes more sense, since it is a request from the backend to get a new frame. In the future a commit may not convey a new frame. --- backend/drm/drm.c | 10 +++++----- backend/x11/backend.c | 2 +- include/wlr/interfaces/wlr_output.h | 2 +- include/wlr/types/wlr_output.h | 4 ++-- include/wlr/types/wlr_output_damage.h | 6 +++--- rootston/render.c | 6 +++--- types/wlr_output.c | 14 +++++++------- types/wlr_output_damage.c | 14 +++++++------- types/wlr_screencopy_v1.c | 2 +- types/wlr_screenshooter.c | 2 +- 10 files changed, 31 insertions(+), 31 deletions(-) diff --git a/backend/drm/drm.c b/backend/drm/drm.c index f97166f1..17a2e48d 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -338,7 +338,7 @@ bool set_drm_connector_gamma(struct wlr_output *output, size_t size, bool ok = drm->iface->crtc_set_gamma(drm, conn->crtc, size, _r, _g, _b); if (ok) { - wlr_output_update_needs_commit(output); + wlr_output_update_needs_frame(output); free(conn->crtc->gamma_table); conn->crtc->gamma_table = gamma_table; @@ -677,7 +677,7 @@ static bool drm_connector_set_cursor(struct wlr_output *output, return false; } - wlr_output_update_needs_commit(output); + wlr_output_update_needs_frame(output); } if (!update_texture) { @@ -737,7 +737,7 @@ static bool drm_connector_set_cursor(struct wlr_output *output, } bool ok = drm->iface->crtc_set_cursor(drm, crtc, bo); if (ok) { - wlr_output_update_needs_commit(output); + wlr_output_update_needs_frame(output); } return ok; } @@ -774,7 +774,7 @@ static bool drm_connector_move_cursor(struct wlr_output *output, bool ok = drm->iface->crtc_move_cursor(drm, conn->crtc, box.x, box.y); if (ok) { - wlr_output_update_needs_commit(output); + wlr_output_update_needs_frame(output); } return ok; } @@ -1435,7 +1435,7 @@ static void drm_connector_cleanup(struct wlr_drm_connector *conn) { wl_event_source_remove(conn->output.idle_frame); conn->output.idle_frame = NULL; } - conn->output.needs_commit = false; + conn->output.needs_frame = false; conn->output.frame_pending = false; /* Fallthrough */ diff --git a/backend/x11/backend.c b/backend/x11/backend.c index ddd8ab77..6bece36d 100644 --- a/backend/x11/backend.c +++ b/backend/x11/backend.c @@ -46,7 +46,7 @@ static void handle_x11_event(struct wlr_x11_backend *x11, struct wlr_x11_output *output = get_x11_output_from_window_id(x11, ev->window); if (output != NULL) { - wlr_output_update_needs_commit(&output->wlr_output); + wlr_output_update_needs_frame(&output->wlr_output); } break; } diff --git a/include/wlr/interfaces/wlr_output.h b/include/wlr/interfaces/wlr_output.h index 283afe66..9c6f4aa5 100644 --- a/include/wlr/interfaces/wlr_output.h +++ b/include/wlr/interfaces/wlr_output.h @@ -43,7 +43,7 @@ void wlr_output_update_mode(struct wlr_output *output, void wlr_output_update_custom_mode(struct wlr_output *output, int32_t width, int32_t height, int32_t refresh); void wlr_output_update_enabled(struct wlr_output *output, bool enabled); -void wlr_output_update_needs_commit(struct wlr_output *output); +void wlr_output_update_needs_frame(struct wlr_output *output); void wlr_output_damage_whole(struct wlr_output *output); void wlr_output_send_frame(struct wlr_output *output); void wlr_output_send_present(struct wlr_output *output, diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index b0965245..fb21e913 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -97,7 +97,7 @@ struct wlr_output { enum wl_output_subpixel subpixel; enum wl_output_transform transform; - bool needs_commit; + bool needs_frame; // damage for cursors and fullscreen surface, in output-local coordinates pixman_region32_t damage; bool frame_pending; @@ -110,7 +110,7 @@ struct wlr_output { struct wl_signal frame; // Emitted when buffers need to be swapped (because software cursors or // fullscreen damage or because of backend-specific logic) - struct wl_signal needs_commit; + struct wl_signal needs_frame; // Emitted right before commit struct wl_signal precommit; // wlr_output_event_precommit // Emitted right after commit diff --git a/include/wlr/types/wlr_output_damage.h b/include/wlr/types/wlr_output_damage.h index bc29ebdf..43db717b 100644 --- a/include/wlr/types/wlr_output_damage.h +++ b/include/wlr/types/wlr_output_damage.h @@ -51,7 +51,7 @@ struct wlr_output_damage { struct wl_listener output_mode; struct wl_listener output_transform; struct wl_listener output_scale; - struct wl_listener output_needs_commit; + struct wl_listener output_needs_frame; struct wl_listener output_frame; struct wl_listener output_commit; }; @@ -63,12 +63,12 @@ void wlr_output_damage_destroy(struct wlr_output_damage *output_damage); * function before rendering. After they are done rendering, they should call * `wlr_output_set_damage` and `wlr_output_commit` to submit the new frame. * - * `needs_commit` will be set to true if a frame should be submitted. `damage` + * `needs_frame` will be set to true if a frame should be submitted. `damage` * will be set to the region of the output that needs to be repainted, in * output-buffer-local coordinates. */ bool wlr_output_damage_attach_render(struct wlr_output_damage *output_damage, - bool *needs_commit, pixman_region32_t *damage); + bool *needs_frame, pixman_region32_t *damage); /** * Accumulates damage and schedules a `frame` event. */ diff --git a/rootston/render.c b/rootston/render.c index 203e3ace..66996d96 100644 --- a/rootston/render.c +++ b/rootston/render.c @@ -220,10 +220,10 @@ void output_render(struct roots_output *output) { clear_color[0] = clear_color[1] = clear_color[2] = 0; } - bool needs_swap; + bool needs_frame; pixman_region32_t damage; pixman_region32_init(&damage); - if (!wlr_output_damage_attach_render(output->damage, &needs_swap, &damage)) { + if (!wlr_output_damage_attach_render(output->damage, &needs_frame, &damage)) { return; } @@ -232,7 +232,7 @@ void output_render(struct roots_output *output) { .alpha = 1.0, }; - if (!needs_swap) { + if (!needs_frame) { // Output doesn't need swap and isn't damaged, skip rendering completely goto damage_finish; } diff --git a/types/wlr_output.c b/types/wlr_output.c index 9d90c1dc..81cf2117 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -273,7 +273,7 @@ void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend, wl_list_init(&output->cursors); wl_list_init(&output->resources); wl_signal_init(&output->events.frame); - wl_signal_init(&output->events.needs_commit); + wl_signal_init(&output->events.needs_frame); wl_signal_init(&output->events.precommit); wl_signal_init(&output->events.commit); wl_signal_init(&output->events.present); @@ -437,7 +437,7 @@ bool wlr_output_commit(struct wlr_output *output) { wlr_signal_emit_safe(&output->events.commit, output); output->frame_pending = true; - output->needs_commit = false; + output->needs_frame = false; output_state_clear(&output->pending); return true; } @@ -517,9 +517,9 @@ bool wlr_output_export_dmabuf(struct wlr_output *output, return output->impl->export_dmabuf(output, attribs); } -void wlr_output_update_needs_commit(struct wlr_output *output) { - output->needs_commit = true; - wlr_signal_emit_safe(&output->events.needs_commit, output); +void wlr_output_update_needs_frame(struct wlr_output *output) { + output->needs_frame = true; + wlr_signal_emit_safe(&output->events.needs_frame, output); } void wlr_output_damage_whole(struct wlr_output *output) { @@ -528,7 +528,7 @@ void wlr_output_damage_whole(struct wlr_output *output) { pixman_region32_union_rect(&output->damage, &output->damage, 0, 0, width, height); - wlr_output_update_needs_commit(output); + wlr_output_update_needs_frame(output); } struct wlr_output *wlr_output_from_resource(struct wl_resource *resource) { @@ -674,7 +674,7 @@ static void output_cursor_damage_whole(struct wlr_output_cursor *cursor) { output_cursor_get_box(cursor, &box); pixman_region32_union_rect(&cursor->output->damage, &cursor->output->damage, box.x, box.y, box.width, box.height); - wlr_output_update_needs_commit(cursor->output); + wlr_output_update_needs_frame(cursor->output); } static void output_cursor_reset(struct wlr_output_cursor *cursor) { diff --git a/types/wlr_output_damage.c b/types/wlr_output_damage.c index 7d5df670..b209d300 100644 --- a/types/wlr_output_damage.c +++ b/types/wlr_output_damage.c @@ -31,10 +31,10 @@ static void output_handle_scale(struct wl_listener *listener, void *data) { wlr_output_damage_add_whole(output_damage); } -static void output_handle_needs_commit(struct wl_listener *listener, +static void output_handle_needs_frame(struct wl_listener *listener, void *data) { struct wlr_output_damage *output_damage = - wl_container_of(listener, output_damage, output_needs_commit); + wl_container_of(listener, output_damage, output_needs_frame); pixman_region32_union(&output_damage->current, &output_damage->current, &output_damage->output->damage); wlr_output_schedule_frame(output_damage->output); @@ -93,8 +93,8 @@ struct wlr_output_damage *wlr_output_damage_create(struct wlr_output *output) { output_damage->output_transform.notify = output_handle_transform; wl_signal_add(&output->events.scale, &output_damage->output_scale); output_damage->output_scale.notify = output_handle_scale; - wl_signal_add(&output->events.needs_commit, &output_damage->output_needs_commit); - output_damage->output_needs_commit.notify = output_handle_needs_commit; + wl_signal_add(&output->events.needs_frame, &output_damage->output_needs_frame); + output_damage->output_needs_frame.notify = output_handle_needs_frame; wl_signal_add(&output->events.frame, &output_damage->output_frame); output_damage->output_frame.notify = output_handle_frame; wl_signal_add(&output->events.commit, &output_damage->output_commit); @@ -112,7 +112,7 @@ void wlr_output_damage_destroy(struct wlr_output_damage *output_damage) { wl_list_remove(&output_damage->output_mode.link); wl_list_remove(&output_damage->output_transform.link); wl_list_remove(&output_damage->output_scale.link); - wl_list_remove(&output_damage->output_needs_commit.link); + wl_list_remove(&output_damage->output_needs_frame.link); wl_list_remove(&output_damage->output_frame.link); pixman_region32_fini(&output_damage->current); for (size_t i = 0; i < WLR_OUTPUT_DAMAGE_PREVIOUS_LEN; ++i) { @@ -122,7 +122,7 @@ void wlr_output_damage_destroy(struct wlr_output_damage *output_damage) { } bool wlr_output_damage_attach_render(struct wlr_output_damage *output_damage, - bool *needs_commit, pixman_region32_t *damage) { + bool *needs_frame, pixman_region32_t *damage) { struct wlr_output *output = output_damage->output; int buffer_age = -1; @@ -156,7 +156,7 @@ bool wlr_output_damage_attach_render(struct wlr_output_damage *output_damage, } } - *needs_commit = output->needs_commit || pixman_region32_not_empty(damage); + *needs_frame = output->needs_frame || pixman_region32_not_empty(damage); return true; } diff --git a/types/wlr_screencopy_v1.c b/types/wlr_screencopy_v1.c index 320c0a39..42945839 100644 --- a/types/wlr_screencopy_v1.c +++ b/types/wlr_screencopy_v1.c @@ -140,7 +140,7 @@ static void frame_handle_copy(struct wl_client *client, frame->buffer_destroy.notify = frame_handle_buffer_destroy; // Schedule a buffer commit - output->needs_commit = true; + output->needs_frame = true; wlr_output_schedule_frame(output); if (frame->overlay_cursor) { diff --git a/types/wlr_screenshooter.c b/types/wlr_screenshooter.c index b0145752..63309050 100644 --- a/types/wlr_screenshooter.c +++ b/types/wlr_screenshooter.c @@ -150,7 +150,7 @@ static void screenshooter_shoot(struct wl_client *client, wl_signal_add(&output->events.precommit, &state->frame_listener); // Schedule a buffer commit - output->needs_commit = true; + output->needs_frame = true; wlr_output_schedule_frame(output); }