compositor: Introduce weston_output_schedule_repaint()

This lets us schedule a repaint on just the output that needs it.
dev
Kristian Høgsberg 13 years ago
parent 9c9b3a4b46
commit 49952d1f12
  1. 2
      src/compositor-drm.c
  2. 8
      src/compositor-x11.c
  3. 27
      src/compositor.c
  4. 2
      src/compositor.h
  5. 2
      src/screenshooter.c

@ -230,7 +230,7 @@ fb_handle_buffer_destroy(struct wl_listener *listener, void *data)
if (fb == fb->output->next ||
(fb == fb->output->current && !fb->output->next))
weston_compositor_schedule_repaint(fb->output->base.compositor);
weston_output_schedule_repaint(&fb->output->base);
}
static int

@ -627,6 +627,7 @@ x11_compositor_handle_event(int fd, uint32_t mask, void *data)
xcb_key_press_event_t *key_press, *key_release;
xcb_keymap_notify_event_t *keymap_notify;
xcb_focus_in_event_t *focus_in;
xcb_expose_event_t *expose;
xcb_atom_t atom;
uint32_t *k;
uint32_t i, set;
@ -716,10 +717,9 @@ x11_compositor_handle_event(int fd, uint32_t mask, void *data)
break;
case XCB_EXPOSE:
/* FIXME: schedule output repaint */
/* output = x11_compositor_find_output(c, expose->window); */
weston_compositor_schedule_repaint(&c->base);
expose = (xcb_expose_event_t *) event;
output = x11_compositor_find_output(c, expose->window);
weston_output_schedule_repaint(&output->base);
break;
case XCB_ENTER_NOTIFY:

@ -929,7 +929,7 @@ weston_output_damage(struct weston_output *output)
pixman_region32_union(&compositor->damage,
&compositor->damage, &output->region);
weston_compositor_schedule_repaint(compositor);
weston_output_schedule_repaint(output);
}
static void
@ -1175,23 +1175,21 @@ weston_layer_init(struct weston_layer *layer, struct wl_list *below)
}
WL_EXPORT void
weston_compositor_schedule_repaint(struct weston_compositor *compositor)
weston_output_schedule_repaint(struct weston_output *output)
{
struct weston_output *output;
struct weston_compositor *compositor = output->compositor;
struct wl_event_loop *loop;
if (compositor->state == WESTON_COMPOSITOR_SLEEPING)
return;
loop = wl_display_get_event_loop(compositor->wl_display);
wl_list_for_each(output, &compositor->output_list, link) {
output->repaint_needed = 1;
if (output->repaint_scheduled)
continue;
output->repaint_needed = 1;
if (output->repaint_scheduled)
return;
wl_event_loop_add_idle(loop, idle_repaint, output);
output->repaint_scheduled = 1;
}
wl_event_loop_add_idle(loop, idle_repaint, output);
output->repaint_scheduled = 1;
if (compositor->input_loop_source) {
wl_event_source_remove(compositor->input_loop_source);
@ -1199,6 +1197,15 @@ weston_compositor_schedule_repaint(struct weston_compositor *compositor)
}
}
WL_EXPORT void
weston_compositor_schedule_repaint(struct weston_compositor *compositor)
{
struct weston_output *output;
wl_list_for_each(output, &compositor->output_list, link)
weston_output_schedule_repaint(output);
}
WL_EXPORT void
weston_compositor_fade(struct weston_compositor *compositor, float tint)
{

@ -519,6 +519,8 @@ weston_layer_init(struct weston_layer *layer, struct wl_list *below);
void
weston_output_finish_frame(struct weston_output *output, int msecs);
void
weston_output_schedule_repaint(struct weston_output *output);
void
weston_output_damage(struct weston_output *output);
void
weston_compositor_schedule_repaint(struct weston_compositor *compositor);

@ -165,7 +165,7 @@ screenshooter_shoot(struct wl_client *client,
l->listener.notify = screenshooter_frame_notify;
wl_signal_add(&output->frame_signal, &l->listener);
weston_compositor_schedule_repaint(output->compositor);
weston_output_schedule_repaint(output);
}
struct screenshooter_interface screenshooter_implementation = {

Loading…
Cancel
Save