mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2026-05-08 12:28:04 +02:00
compositor, clients: make damage double-buffered
This change depends on the Wayland commit "protocol: double-buffered state for wl_surface". Implement double-buffering of damage in the compositor as required by the new protocol. Ensure all Weston demo clients call wl_surface_commit() after wl_surface_damage(). Mesa does not need a fix for this, as the patch adding wl_surface_commit() call to Mesa already takes care of damage, too; Mesa commit: "wayland: use wl_surface_commit()" Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
This commit is contained in:
parent
c9e00c06e9
commit
8e159180cc
4 changed files with 20 additions and 3 deletions
|
|
@ -142,6 +142,10 @@ touch_paint(struct touch *touch, int32_t x, int32_t y, int32_t id)
|
|||
p[2] = c;
|
||||
|
||||
wl_surface_damage(touch->surface, x - 2, y - 2, 5, 5);
|
||||
/* todo: We could queue up more damage before committing, if there
|
||||
* are more input events to handle.
|
||||
*/
|
||||
wl_surface_commit(touch->surface);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -223,6 +223,7 @@ redraw_handler(struct widget *widget, void *data)
|
|||
|
||||
callback = wl_surface_frame(window_get_wl_surface(smoke->window));
|
||||
wl_callback_add_listener(callback, &listener, smoke);
|
||||
wl_surface_commit(window_get_wl_surface(smoke->window));
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
|||
|
|
@ -274,6 +274,7 @@ weston_surface_create(struct weston_compositor *compositor)
|
|||
|
||||
surface->pending.buffer_destroy_listener.notify =
|
||||
surface_handle_pending_buffer_destroy;
|
||||
pixman_region32_init(&surface->pending.damage);
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
|
@ -780,6 +781,8 @@ destroy_surface(struct wl_resource *resource)
|
|||
if (weston_surface_is_mapped(surface))
|
||||
weston_surface_unmap(surface);
|
||||
|
||||
pixman_region32_fini(&surface->pending.damage);
|
||||
|
||||
if (surface->pending.buffer)
|
||||
wl_list_remove(&surface->pending.buffer_destroy_listener.link);
|
||||
|
||||
|
|
@ -1166,11 +1169,11 @@ surface_damage(struct wl_client *client,
|
|||
struct wl_resource *resource,
|
||||
int32_t x, int32_t y, int32_t width, int32_t height)
|
||||
{
|
||||
struct weston_surface *es = resource->data;
|
||||
struct weston_surface *surface = resource->data;
|
||||
|
||||
pixman_region32_union_rect(&es->damage, &es->damage,
|
||||
pixman_region32_union_rect(&surface->pending.damage,
|
||||
&surface->pending.damage,
|
||||
x, y, width, height);
|
||||
weston_surface_schedule_repaint(es);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1265,6 +1268,12 @@ surface_commit(struct wl_client *client, struct wl_resource *resource)
|
|||
if (surface->buffer && surface->configure)
|
||||
surface->configure(surface, surface->pending.sx,
|
||||
surface->pending.sy);
|
||||
|
||||
/* wl_surface.damage */
|
||||
pixman_region32_union(&surface->damage, &surface->damage,
|
||||
&surface->pending.damage);
|
||||
empty_region(&surface->pending.damage);
|
||||
weston_surface_schedule_repaint(surface);
|
||||
}
|
||||
|
||||
static const struct wl_surface_interface surface_interface = {
|
||||
|
|
|
|||
|
|
@ -474,6 +474,9 @@ struct weston_surface {
|
|||
struct wl_listener buffer_destroy_listener;
|
||||
int32_t sx;
|
||||
int32_t sy;
|
||||
|
||||
/* wl_surface.damage */
|
||||
pixman_region32_t damage;
|
||||
} pending;
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue