mirror of
https://github.com/swaywm/sway.git
synced 2024-11-29 11:21:28 +00:00
Move output commit out of output_render()
That way output_render() only does what it says on the tin.
This commit is contained in:
parent
d6cb4fa8de
commit
c2ccc0c9d4
|
@ -112,8 +112,7 @@ bool output_has_opaque_overlay_layer_surface(struct sway_output *output);
|
||||||
|
|
||||||
struct sway_workspace *output_get_active_workspace(struct sway_output *output);
|
struct sway_workspace *output_get_active_workspace(struct sway_output *output);
|
||||||
|
|
||||||
void output_render(struct sway_output *output, struct timespec *when,
|
void output_render(struct sway_output *output, pixman_region32_t *damage);
|
||||||
pixman_region32_t *damage);
|
|
||||||
|
|
||||||
void output_surface_for_each_surface(struct sway_output *output,
|
void output_surface_for_each_surface(struct sway_output *output,
|
||||||
struct wlr_surface *surface, double ox, double oy,
|
struct wlr_surface *surface, double ox, double oy,
|
||||||
|
|
|
@ -517,13 +517,34 @@ static bool scan_out_fullscreen_view(struct sway_output *output,
|
||||||
return wlr_output_commit(wlr_output);
|
return wlr_output_commit(wlr_output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void get_frame_damage(struct sway_output *output,
|
||||||
|
pixman_region32_t *frame_damage) {
|
||||||
|
struct wlr_output *wlr_output = output->wlr_output;
|
||||||
|
|
||||||
|
int width, height;
|
||||||
|
wlr_output_transformed_resolution(wlr_output, &width, &height);
|
||||||
|
|
||||||
|
pixman_region32_init(frame_damage);
|
||||||
|
|
||||||
|
enum wl_output_transform transform =
|
||||||
|
wlr_output_transform_invert(wlr_output->transform);
|
||||||
|
wlr_region_transform(frame_damage, &output->damage_ring.current,
|
||||||
|
transform, width, height);
|
||||||
|
|
||||||
|
if (debug.damage != DAMAGE_DEFAULT) {
|
||||||
|
pixman_region32_union_rect(frame_damage, frame_damage,
|
||||||
|
0, 0, wlr_output->width, wlr_output->height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int output_repaint_timer_handler(void *data) {
|
static int output_repaint_timer_handler(void *data) {
|
||||||
struct sway_output *output = data;
|
struct sway_output *output = data;
|
||||||
if (output->wlr_output == NULL) {
|
struct wlr_output *wlr_output = output->wlr_output;
|
||||||
|
if (wlr_output == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
output->wlr_output->frame_pending = false;
|
wlr_output->frame_pending = false;
|
||||||
|
|
||||||
struct sway_workspace *workspace = output->current.active_workspace;
|
struct sway_workspace *workspace = output->current.active_workspace;
|
||||||
if (workspace == NULL) {
|
if (workspace == NULL) {
|
||||||
|
@ -575,10 +596,22 @@ static int output_repaint_timer_handler(void *data) {
|
||||||
struct timespec now;
|
struct timespec now;
|
||||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||||
|
|
||||||
output_render(output, &now, &damage);
|
output_render(output, &damage);
|
||||||
|
|
||||||
pixman_region32_fini(&damage);
|
pixman_region32_fini(&damage);
|
||||||
|
|
||||||
|
pixman_region32_t frame_damage;
|
||||||
|
get_frame_damage(output, &frame_damage);
|
||||||
|
wlr_output_set_damage(wlr_output, &frame_damage);
|
||||||
|
pixman_region32_fini(&frame_damage);
|
||||||
|
|
||||||
|
if (!wlr_output_commit(wlr_output)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
wlr_damage_ring_rotate(&output->damage_ring);
|
||||||
|
output->last_frame = now;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1029,8 +1029,7 @@ static void render_seatops(struct sway_output *output,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void output_render(struct sway_output *output, struct timespec *when,
|
void output_render(struct sway_output *output, pixman_region32_t *damage) {
|
||||||
pixman_region32_t *damage) {
|
|
||||||
struct wlr_output *wlr_output = output->wlr_output;
|
struct wlr_output *wlr_output = output->wlr_output;
|
||||||
struct wlr_renderer *renderer = output->server->renderer;
|
struct wlr_renderer *renderer = output->server->renderer;
|
||||||
|
|
||||||
|
@ -1184,30 +1183,4 @@ renderer_end:
|
||||||
wlr_renderer_scissor(renderer, NULL);
|
wlr_renderer_scissor(renderer, NULL);
|
||||||
wlr_output_render_software_cursors(wlr_output, damage);
|
wlr_output_render_software_cursors(wlr_output, damage);
|
||||||
wlr_renderer_end(renderer);
|
wlr_renderer_end(renderer);
|
||||||
|
|
||||||
int width, height;
|
|
||||||
wlr_output_transformed_resolution(wlr_output, &width, &height);
|
|
||||||
|
|
||||||
pixman_region32_t frame_damage;
|
|
||||||
pixman_region32_init(&frame_damage);
|
|
||||||
|
|
||||||
enum wl_output_transform transform =
|
|
||||||
wlr_output_transform_invert(wlr_output->transform);
|
|
||||||
wlr_region_transform(&frame_damage, &output->damage_ring.current,
|
|
||||||
transform, width, height);
|
|
||||||
|
|
||||||
if (debug.damage != DAMAGE_DEFAULT) {
|
|
||||||
pixman_region32_union_rect(&frame_damage, &frame_damage,
|
|
||||||
0, 0, wlr_output->width, wlr_output->height);
|
|
||||||
}
|
|
||||||
|
|
||||||
wlr_output_set_damage(wlr_output, &frame_damage);
|
|
||||||
pixman_region32_fini(&frame_damage);
|
|
||||||
|
|
||||||
if (!wlr_output_commit(wlr_output)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
wlr_damage_ring_rotate(&output->damage_ring);
|
|
||||||
output->last_frame = *when;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue