commit:     6b9d8da01e17743a57b79f8db59a830951addb8d
Author:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 25 15:14:28 2025 +0000
Commit:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Wed Jun 25 15:19:03 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6b9d8da0

media-video/mpv: backport cpu usage fix with wayland clipboard

Kind of simple, so doing it straight-to-stable.

Closes: https://bugs.gentoo.org/959000
Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>

 .../mpv/files/mpv-0.40.0-wayland-clipboard-cpu.patch     | 16 ++++++++++++++++
 .../mpv/{mpv-0.40.0-r2.ebuild => mpv-0.40.0-r3.ebuild}   |  4 ++++
 2 files changed, 20 insertions(+)

diff --git a/media-video/mpv/files/mpv-0.40.0-wayland-clipboard-cpu.patch 
b/media-video/mpv/files/mpv-0.40.0-wayland-clipboard-cpu.patch
new file mode 100644
index 000000000000..0432d65b29b5
--- /dev/null
+++ b/media-video/mpv/files/mpv-0.40.0-wayland-clipboard-cpu.patch
@@ -0,0 +1,16 @@
+https://bugs.gentoo.org/959000
+https://github.com/mpv-player/mpv/issues/16139
+https://github.com/mpv-player/mpv/pull/16140
+--- a/player/clipboard/clipboard-wayland.c
++++ b/player/clipboard/clipboard-wayland.c
+@@ -349,4 +349,10 @@
+         return false;
+ 
++    if (fds[2].revents & (POLLERR | POLLHUP | POLLNVAL))
++        destroy_offer(wl->selection_offer);
++
++    if (fds[3].revents & (POLLERR | POLLHUP | POLLNVAL))
++        destroy_offer(wl->primary_selection_offer);
++
+     if (fds[2].revents & POLLIN)
+         get_selection_data(wl, wl->selection_offer, false);

diff --git a/media-video/mpv/mpv-0.40.0-r2.ebuild 
b/media-video/mpv/mpv-0.40.0-r3.ebuild
similarity index 99%
rename from media-video/mpv/mpv-0.40.0-r2.ebuild
rename to media-video/mpv/mpv-0.40.0-r3.ebuild
index 61d81da0b6eb..d1d23d274ba2 100644
--- a/media-video/mpv/mpv-0.40.0-r2.ebuild
+++ b/media-video/mpv/mpv-0.40.0-r3.ebuild
@@ -124,6 +124,10 @@ BDEPEND="
        wayland? ( dev-util/wayland-scanner )
 "
 
+PATCHES=(
+       "${FILESDIR}"/${P}-wayland-clipboard-cpu.patch
+)
+
 pkg_pretend() {
        if has_version "${CATEGORY}/${PN}[X,opengl]" && use !egl; then #953107
                ewarn "${PN}'s 'opengl' USE was removed in favour of the 'egl' 
USE as it was"

Reply via email to