compositor: Add weston_surface_schedule_repaint() for limited repaint

In cases where we know the surface bounding box doesn't change in the
next frame, we can limit redraws to only the outputs the surface is
currently on.  We could do even better by forcing the transform
update so we know where the surface will be in the next frame, but
this is a much simpler first step.
dev
Kristian Høgsberg 13 years ago
parent 79af73e313
commit 982387011f
  1. 21
      src/compositor.c
  2. 3
      src/compositor.h

@ -528,6 +528,16 @@ weston_surface_from_global(struct weston_surface *surface,
*sy = floorf(syf); *sy = floorf(syf);
} }
WL_EXPORT void
weston_surface_schedule_repaint(struct weston_surface *surface)
{
struct weston_output *output;
wl_list_for_each(output, &surface->compositor->output_list, link)
if (surface->output_mask & (1 << output->id))
weston_output_schedule_repaint(output);
}
WL_EXPORT void WL_EXPORT void
weston_surface_damage(struct weston_surface *surface) weston_surface_damage(struct weston_surface *surface)
{ {
@ -535,7 +545,7 @@ weston_surface_damage(struct weston_surface *surface)
0, 0, surface->geometry.width, 0, 0, surface->geometry.width,
surface->geometry.height); surface->geometry.height);
weston_compositor_schedule_repaint(surface->compositor); weston_surface_schedule_repaint(surface);
} }
WL_EXPORT void WL_EXPORT void
@ -662,7 +672,7 @@ weston_surface_unmap(struct weston_surface *surface)
wl_fixed_from_int(0)); wl_fixed_from_int(0));
} }
weston_compositor_schedule_repaint(surface->compositor); weston_surface_schedule_repaint(surface);
} }
struct weston_frame_callback { struct weston_frame_callback {
@ -1419,8 +1429,7 @@ surface_damage(struct wl_client *client,
pixman_region32_union_rect(&es->damage, &es->damage, pixman_region32_union_rect(&es->damage, &es->damage,
x, y, width, height); x, y, width, height);
weston_surface_schedule_repaint(es);
weston_compositor_schedule_repaint(es->compositor);
} }
static void static void
@ -1500,7 +1509,7 @@ surface_set_input_region(struct wl_client *client,
surface->geometry.height); surface->geometry.height);
} }
weston_compositor_schedule_repaint(surface->compositor); weston_surface_schedule_repaint(surface);
} }
static const struct wl_surface_interface surface_interface = { static const struct wl_surface_interface surface_interface = {
@ -1758,7 +1767,7 @@ notify_motion(struct wl_seat *seat, uint32_t time, wl_fixed_t x, wl_fixed_t y)
weston_surface_set_position(ws->sprite, weston_surface_set_position(ws->sprite,
ix - ws->hotspot_x, ix - ws->hotspot_x,
iy - ws->hotspot_y); iy - ws->hotspot_y);
weston_compositor_schedule_repaint(ec); weston_surface_schedule_repaint(ws->sprite);
} }
} }

@ -641,6 +641,9 @@ weston_surface_is_mapped(struct weston_surface *surface);
void void
weston_surface_assign_output(struct weston_surface *surface); weston_surface_assign_output(struct weston_surface *surface);
void
weston_surface_schedule_repaint(struct weston_surface *surface);
void void
weston_surface_damage(struct weston_surface *surface); weston_surface_damage(struct weston_surface *surface);

Loading…
Cancel
Save