summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2020-10-01 11:00:58 -0500
committerDudemanguy <random342@airmail.cc>2020-10-01 11:12:22 -0500
commit34b8adc4562f38374d8eb981b002f268dc5640d4 (patch)
treee2bf777aa9dd629e526a2bd0819a4a208f8b8541
parentdcec6d9556c6cfca11b865442174479096f55111 (diff)
downloadmpv-34b8adc4562f38374d8eb981b002f268dc5640d4.tar.bz2
mpv-34b8adc4562f38374d8eb981b002f268dc5640d4.tar.xz
wayland: set an opaque region
Apparently a part of the wayland spec. A compositor may use a surface that has set part of itself as opaque for various optimizations. For mpv, we simply set the entire surface as opaque as long as the user has not set alpha=yes (note: alpha is technically broken in the wayland EGL backend at the time of this commit but oh well). wlshm is always opaque. Fixes #8125.
-rw-r--r--video/out/opengl/context_wayland.c7
-rw-r--r--video/out/vo_wlshm.c5
-rw-r--r--video/out/vulkan/context_wayland.c7
3 files changed, 19 insertions, 0 deletions
diff --git a/video/out/opengl/context_wayland.c b/video/out/opengl/context_wayland.c
index 13040b54d8..c0a8aee206 100644
--- a/video/out/opengl/context_wayland.c
+++ b/video/out/opengl/context_wayland.c
@@ -122,6 +122,13 @@ static void resize(struct ra_ctx *ctx)
const int32_t width = wl->scaling*mp_rect_w(wl->geometry);
const int32_t height = wl->scaling*mp_rect_h(wl->geometry);
+ if (!ctx->opts.want_alpha) {
+ struct wl_region *region = wl_compositor_create_region(wl->compositor);
+ wl_region_add(region, 0, 0, width, height);
+ wl_surface_set_opaque_region(wl->surface, region);
+ wl_region_destroy(region);
+ }
+
wl_surface_set_buffer_scale(wl->surface, wl->scaling);
if (p->egl_window)
diff --git a/video/out/vo_wlshm.c b/video/out/vo_wlshm.c
index 3b328faee6..43a1318c8d 100644
--- a/video/out/vo_wlshm.c
+++ b/video/out/vo_wlshm.c
@@ -201,6 +201,11 @@ static int resize(struct vo *vo)
const int32_t height = wl->scaling * mp_rect_h(wl->geometry);
struct buffer *buf;
+ struct wl_region *region = wl_compositor_create_region(wl->compositor);
+ wl_region_add(region, 0, 0, width, height);
+ wl_surface_set_opaque_region(wl->surface, region);
+ wl_region_destroy(region);
+
vo->want_redraw = true;
vo->dwidth = width;
vo->dheight = height;
diff --git a/video/out/vulkan/context_wayland.c b/video/out/vulkan/context_wayland.c
index 481c1005e1..753854381c 100644
--- a/video/out/vulkan/context_wayland.c
+++ b/video/out/vulkan/context_wayland.c
@@ -208,6 +208,13 @@ static bool resize(struct ra_ctx *ctx)
const int32_t width = wl->scaling*mp_rect_w(wl->geometry);
const int32_t height = wl->scaling*mp_rect_h(wl->geometry);
+ if (!ctx->opts.want_alpha) {
+ struct wl_region *region = wl_compositor_create_region(wl->compositor);
+ wl_region_add(region, 0, 0, width, height);
+ wl_surface_set_opaque_region(wl->surface, region);
+ wl_region_destroy(region);
+ }
+
wl_surface_set_buffer_scale(wl->surface, wl->scaling);
bool ok = ra_vk_ctx_resize(ctx, width, height);
if (!wl->vo_opts->fullscreen && !wl->vo_opts->window_maximized)