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. 19
      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 || if (fb == fb->output->next ||
(fb == fb->output->current && !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 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_key_press_event_t *key_press, *key_release;
xcb_keymap_notify_event_t *keymap_notify; xcb_keymap_notify_event_t *keymap_notify;
xcb_focus_in_event_t *focus_in; xcb_focus_in_event_t *focus_in;
xcb_expose_event_t *expose;
xcb_atom_t atom; xcb_atom_t atom;
uint32_t *k; uint32_t *k;
uint32_t i, set; uint32_t i, set;
@ -716,10 +717,9 @@ x11_compositor_handle_event(int fd, uint32_t mask, void *data)
break; break;
case XCB_EXPOSE: case XCB_EXPOSE:
/* FIXME: schedule output repaint */ expose = (xcb_expose_event_t *) event;
/* output = x11_compositor_find_output(c, expose->window); */ output = x11_compositor_find_output(c, expose->window);
weston_output_schedule_repaint(&output->base);
weston_compositor_schedule_repaint(&c->base);
break; break;
case XCB_ENTER_NOTIFY: case XCB_ENTER_NOTIFY:

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

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

Loading…
Cancel
Save