summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorAlexander Preisinger <alexander.preisinger@gmail.com>2013-08-26 16:27:18 +0200
committerAlexander Preisinger <alexander.preisinger@gmail.com>2013-08-26 16:29:03 +0200
commit5895d6c24fa3b66230fe1f5177af7f65b4c6a706 (patch)
tree4dba566673318ae615da2a93933c74a56cdc6d00 /video
parentdf9639d755448380d0caec144a7e822bb100078e (diff)
downloadmpv-5895d6c24fa3b66230fe1f5177af7f65b4c6a706.tar.bz2
mpv-5895d6c24fa3b66230fe1f5177af7f65b4c6a706.tar.xz
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.
Diffstat (limited to 'video')
-rw-r--r--video/out/vo_wayland.c10
1 files changed, 10 insertions, 0 deletions
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);