From 5895d6c24fa3b66230fe1f5177af7f65b4c6a706 Mon Sep 17 00:00:00 2001 From: Alexander Preisinger Date: Mon, 26 Aug 2013 16:27:18 +0200 Subject: wayland/shm: use opaque regions Make use of opaque regions on non-alpha formats. This allows the compositor to improve the drawing of the surface, because he can discard everything behind the window when drawing. --- video/out/vo_wayland.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'video') diff --git a/video/out/vo_wayland.c b/video/out/vo_wayland.c index f6c68a8e73..9871503b81 100644 --- a/video/out/vo_wayland.c +++ b/video/out/vo_wayland.c @@ -393,6 +393,16 @@ static bool resize(struct priv *p) wl->window.width = p->dst_w; wl->window.height = p->dst_h; + // if no alpha enabled format is used then create an opaque region to allow + // the compositor to optimize the drawing of the window + if (!p->enable_alpha) { + struct wl_region *opaque = + wl_compositor_create_region(wl->display.compositor); + wl_region_add(opaque, 0, 0, p->dst_w, p->dst_h); + wl_surface_set_opaque_region(wl->window.surface, opaque); + wl_region_destroy(opaque); + } + // a redraw should happen at this point wl_surface_attach(wl->window.surface, p->front_buffer->wlbuf, x, y); wl_surface_damage(wl->window.surface, 0, 0, p->dst_w, p->dst_h); -- cgit v1.2.3