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.
This commit is contained in:
Simon Ser 2019-04-23 20:22:42 +03:00 committed by Drew DeVault
parent 5e6766a165
commit 20690346c7
10 changed files with 31 additions and 31 deletions

View File

@ -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 */

View File

@ -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;
}

View File

@ -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,

View File

@ -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

View File

@ -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.
*/

View File

@ -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;
}

View File

@ -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) {

View File

@ -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;
}

View File

@ -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) {

View File

@ -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);
}