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.
master
Simon Ser 6 years ago committed by Drew DeVault
parent 5e6766a165
commit 20690346c7

@ -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); bool ok = drm->iface->crtc_set_gamma(drm, conn->crtc, size, _r, _g, _b);
if (ok) { if (ok) {
wlr_output_update_needs_commit(output); wlr_output_update_needs_frame(output);
free(conn->crtc->gamma_table); free(conn->crtc->gamma_table);
conn->crtc->gamma_table = gamma_table; conn->crtc->gamma_table = gamma_table;
@ -677,7 +677,7 @@ static bool drm_connector_set_cursor(struct wlr_output *output,
return false; return false;
} }
wlr_output_update_needs_commit(output); wlr_output_update_needs_frame(output);
} }
if (!update_texture) { 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); bool ok = drm->iface->crtc_set_cursor(drm, crtc, bo);
if (ok) { if (ok) {
wlr_output_update_needs_commit(output); wlr_output_update_needs_frame(output);
} }
return ok; 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); bool ok = drm->iface->crtc_move_cursor(drm, conn->crtc, box.x, box.y);
if (ok) { if (ok) {
wlr_output_update_needs_commit(output); wlr_output_update_needs_frame(output);
} }
return ok; return ok;
} }
@ -1435,7 +1435,7 @@ static void drm_connector_cleanup(struct wlr_drm_connector *conn) {
wl_event_source_remove(conn->output.idle_frame); wl_event_source_remove(conn->output.idle_frame);
conn->output.idle_frame = NULL; conn->output.idle_frame = NULL;
} }
conn->output.needs_commit = false; conn->output.needs_frame = false;
conn->output.frame_pending = false; conn->output.frame_pending = false;
/* Fallthrough */ /* Fallthrough */

@ -46,7 +46,7 @@ static void handle_x11_event(struct wlr_x11_backend *x11,
struct wlr_x11_output *output = struct wlr_x11_output *output =
get_x11_output_from_window_id(x11, ev->window); get_x11_output_from_window_id(x11, ev->window);
if (output != NULL) { if (output != NULL) {
wlr_output_update_needs_commit(&output->wlr_output); wlr_output_update_needs_frame(&output->wlr_output);
} }
break; break;
} }

@ -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, void wlr_output_update_custom_mode(struct wlr_output *output, int32_t width,
int32_t height, int32_t refresh); int32_t height, int32_t refresh);
void wlr_output_update_enabled(struct wlr_output *output, bool enabled); 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_damage_whole(struct wlr_output *output);
void wlr_output_send_frame(struct wlr_output *output); void wlr_output_send_frame(struct wlr_output *output);
void wlr_output_send_present(struct wlr_output *output, void wlr_output_send_present(struct wlr_output *output,

@ -97,7 +97,7 @@ struct wlr_output {
enum wl_output_subpixel subpixel; enum wl_output_subpixel subpixel;
enum wl_output_transform transform; enum wl_output_transform transform;
bool needs_commit; bool needs_frame;
// damage for cursors and fullscreen surface, in output-local coordinates // damage for cursors and fullscreen surface, in output-local coordinates
pixman_region32_t damage; pixman_region32_t damage;
bool frame_pending; bool frame_pending;
@ -110,7 +110,7 @@ struct wlr_output {
struct wl_signal frame; struct wl_signal frame;
// Emitted when buffers need to be swapped (because software cursors or // Emitted when buffers need to be swapped (because software cursors or
// fullscreen damage or because of backend-specific logic) // fullscreen damage or because of backend-specific logic)
struct wl_signal needs_commit; struct wl_signal needs_frame;
// Emitted right before commit // Emitted right before commit
struct wl_signal precommit; // wlr_output_event_precommit struct wl_signal precommit; // wlr_output_event_precommit
// Emitted right after commit // Emitted right after commit

@ -51,7 +51,7 @@ struct wlr_output_damage {
struct wl_listener output_mode; struct wl_listener output_mode;
struct wl_listener output_transform; struct wl_listener output_transform;
struct wl_listener output_scale; 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_frame;
struct wl_listener output_commit; 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 * function before rendering. After they are done rendering, they should call
* `wlr_output_set_damage` and `wlr_output_commit` to submit the new frame. * `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 * will be set to the region of the output that needs to be repainted, in
* output-buffer-local coordinates. * output-buffer-local coordinates.
*/ */
bool wlr_output_damage_attach_render(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);
/** /**
* Accumulates damage and schedules a `frame` event. * Accumulates damage and schedules a `frame` event.
*/ */

@ -220,10 +220,10 @@ void output_render(struct roots_output *output) {
clear_color[0] = clear_color[1] = clear_color[2] = 0; clear_color[0] = clear_color[1] = clear_color[2] = 0;
} }
bool needs_swap; bool needs_frame;
pixman_region32_t damage; pixman_region32_t damage;
pixman_region32_init(&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; return;
} }
@ -232,7 +232,7 @@ void output_render(struct roots_output *output) {
.alpha = 1.0, .alpha = 1.0,
}; };
if (!needs_swap) { if (!needs_frame) {
// Output doesn't need swap and isn't damaged, skip rendering completely // Output doesn't need swap and isn't damaged, skip rendering completely
goto damage_finish; goto damage_finish;
} }

@ -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->cursors);
wl_list_init(&output->resources); wl_list_init(&output->resources);
wl_signal_init(&output->events.frame); 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.precommit);
wl_signal_init(&output->events.commit); wl_signal_init(&output->events.commit);
wl_signal_init(&output->events.present); 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); wlr_signal_emit_safe(&output->events.commit, output);
output->frame_pending = true; output->frame_pending = true;
output->needs_commit = false; output->needs_frame = false;
output_state_clear(&output->pending); output_state_clear(&output->pending);
return true; return true;
} }
@ -517,9 +517,9 @@ bool wlr_output_export_dmabuf(struct wlr_output *output,
return output->impl->export_dmabuf(output, attribs); return output->impl->export_dmabuf(output, attribs);
} }
void wlr_output_update_needs_commit(struct wlr_output *output) { void wlr_output_update_needs_frame(struct wlr_output *output) {
output->needs_commit = true; output->needs_frame = true;
wlr_signal_emit_safe(&output->events.needs_commit, output); wlr_signal_emit_safe(&output->events.needs_frame, output);
} }
void wlr_output_damage_whole(struct wlr_output *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, pixman_region32_union_rect(&output->damage, &output->damage, 0, 0,
width, height); 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) { 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); output_cursor_get_box(cursor, &box);
pixman_region32_union_rect(&cursor->output->damage, &cursor->output->damage, pixman_region32_union_rect(&cursor->output->damage, &cursor->output->damage,
box.x, box.y, box.width, box.height); 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) { static void output_cursor_reset(struct wlr_output_cursor *cursor) {

@ -31,10 +31,10 @@ static void output_handle_scale(struct wl_listener *listener, void *data) {
wlr_output_damage_add_whole(output_damage); 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) { void *data) {
struct wlr_output_damage *output_damage = 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, pixman_region32_union(&output_damage->current, &output_damage->current,
&output_damage->output->damage); &output_damage->output->damage);
wlr_output_schedule_frame(output_damage->output); 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; output_damage->output_transform.notify = output_handle_transform;
wl_signal_add(&output->events.scale, &output_damage->output_scale); wl_signal_add(&output->events.scale, &output_damage->output_scale);
output_damage->output_scale.notify = output_handle_scale; output_damage->output_scale.notify = output_handle_scale;
wl_signal_add(&output->events.needs_commit, &output_damage->output_needs_commit); wl_signal_add(&output->events.needs_frame, &output_damage->output_needs_frame);
output_damage->output_needs_commit.notify = output_handle_needs_commit; output_damage->output_needs_frame.notify = output_handle_needs_frame;
wl_signal_add(&output->events.frame, &output_damage->output_frame); wl_signal_add(&output->events.frame, &output_damage->output_frame);
output_damage->output_frame.notify = output_handle_frame; output_damage->output_frame.notify = output_handle_frame;
wl_signal_add(&output->events.commit, &output_damage->output_commit); 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_mode.link);
wl_list_remove(&output_damage->output_transform.link); wl_list_remove(&output_damage->output_transform.link);
wl_list_remove(&output_damage->output_scale.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); wl_list_remove(&output_damage->output_frame.link);
pixman_region32_fini(&output_damage->current); pixman_region32_fini(&output_damage->current);
for (size_t i = 0; i < WLR_OUTPUT_DAMAGE_PREVIOUS_LEN; ++i) { 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 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; struct wlr_output *output = output_damage->output;
int buffer_age = -1; 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; return true;
} }

@ -140,7 +140,7 @@ static void frame_handle_copy(struct wl_client *client,
frame->buffer_destroy.notify = frame_handle_buffer_destroy; frame->buffer_destroy.notify = frame_handle_buffer_destroy;
// Schedule a buffer commit // Schedule a buffer commit
output->needs_commit = true; output->needs_frame = true;
wlr_output_schedule_frame(output); wlr_output_schedule_frame(output);
if (frame->overlay_cursor) { if (frame->overlay_cursor) {

@ -150,7 +150,7 @@ static void screenshooter_shoot(struct wl_client *client,
wl_signal_add(&output->events.precommit, &state->frame_listener); wl_signal_add(&output->events.precommit, &state->frame_listener);
// Schedule a buffer commit // Schedule a buffer commit
output->needs_commit = true; output->needs_frame = true;
wlr_output_schedule_frame(output); wlr_output_schedule_frame(output);
} }

Loading…
Cancel
Save