Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-video/ffmpeg/, media-video/ffmpeg/files/
Date: Wed, 15 Mar 2023 02:15:57
Message-Id: 1678846488.60b38d402d8674ea08c9b69cf3147e0b92ab87c2.sam@gentoo
1 commit: 60b38d402d8674ea08c9b69cf3147e0b92ab87c2
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Wed Mar 15 02:13:59 2023 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Wed Mar 15 02:14:48 2023 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=60b38d40
7
8 media-video/ffmpeg: fix build on register-starved x86
9
10 Newer compilers may optimise such that < 7 registers are free on 32-bit x86
11 and then we get an "invalid asm" error. This is https://bugs.gentoo.org/901099
12 and https://trac.ffmpeg.org/ticket/8903.
13
14 Making matters worse, GCC sometimes hangs on invalid asm, so this also
15 mitigates a hang with e.g. -O3 -march=znver1. See https://bugs.gentoo.org/900937
16 and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109137.
17
18 In future, we may want to adjust the definition of HAVE_7REGS to just exclude
19 32-bit x86, but that's a big sledgehammer, so let's avoid it for now until we have
20 a reply on the upstream ffmpeg bug.
21
22 Thanks to Ninpo.
23
24 Bug: https://trac.ffmpeg.org/ticket/8903
25 Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109137
26 Bug: https://bugs.gentoo.org/900937
27 Closes: https://bugs.gentoo.org/901099
28 Signed-off-by: Sam James <sam <AT> gentoo.org>
29
30 media-video/ffmpeg/ffmpeg-4.4.3.ebuild | 3 ++-
31 media-video/ffmpeg/ffmpeg-5.1.2-r1.ebuild | 3 ++-
32 media-video/ffmpeg/ffmpeg-6.0.ebuild | 3 ++-
33 .../ffmpeg-4.4.3-get_cabac_inline_x86-32-bit.patch | 24 +++++++++++++++++++++
34 .../ffmpeg-5.1.2-get_cabac_inline_x86-32-bit.patch | 25 ++++++++++++++++++++++
35 5 files changed, 55 insertions(+), 3 deletions(-)
36
37 diff --git a/media-video/ffmpeg/ffmpeg-4.4.3.ebuild b/media-video/ffmpeg/ffmpeg-4.4.3.ebuild
38 index 3a700cb2f82f..1eaa8af96b91 100644
39 --- a/media-video/ffmpeg/ffmpeg-4.4.3.ebuild
40 +++ b/media-video/ffmpeg/ffmpeg-4.4.3.ebuild
41 @@ -1,4 +1,4 @@
42 -# Copyright 1999-2022 Gentoo Authors
43 +# Copyright 1999-2023 Gentoo Authors
44 # Distributed under the terms of the GNU General Public License v2
45
46 EAPI=8
47 @@ -333,6 +333,7 @@ PATCHES=(
48 "${FILESDIR}"/chromium-r1.patch
49 "${FILESDIR}"/${PN}-5.0-backport-ranlib-build-fix.patch
50 "${FILESDIR}"/${P}-clang-14-ff_seek_frame_binary-crash.patch
51 + "${FILESDIR}"/${PN}-4.4.3-get_cabac_inline_x86-32-bit.patch
52 )
53
54 MULTILIB_WRAPPED_HEADERS=(
55
56 diff --git a/media-video/ffmpeg/ffmpeg-5.1.2-r1.ebuild b/media-video/ffmpeg/ffmpeg-5.1.2-r1.ebuild
57 index ebfee785a3f4..3d21b79ce2d7 100644
58 --- a/media-video/ffmpeg/ffmpeg-5.1.2-r1.ebuild
59 +++ b/media-video/ffmpeg/ffmpeg-5.1.2-r1.ebuild
60 @@ -336,7 +336,8 @@ S=${WORKDIR}/${P/_/-}
61
62 PATCHES=(
63 "${FILESDIR}"/chromium-r1.patch
64 - "${FILESDIR}/${P}-vulkan.patch"
65 + "${FILESDIR}"/${P}-vulkan.patch
66 + "${FILESDIR}"/${PN}-5.1.2-get_cabac_inline_x86-32-bit.patch
67 )
68
69 MULTILIB_WRAPPED_HEADERS=(
70
71 diff --git a/media-video/ffmpeg/ffmpeg-6.0.ebuild b/media-video/ffmpeg/ffmpeg-6.0.ebuild
72 index 5cc3230259b2..eee97981c06f 100644
73 --- a/media-video/ffmpeg/ffmpeg-6.0.ebuild
74 +++ b/media-video/ffmpeg/ffmpeg-6.0.ebuild
75 @@ -336,7 +336,8 @@ S=${WORKDIR}/${P/_/-}
76
77 PATCHES=(
78 "${FILESDIR}"/chromium-r1.patch
79 - "${FILESDIR}/${P}-DECLARE_ALIGNED.patch"
80 + "${FILESDIR}"/${P}-DECLARE_ALIGNED.patch
81 + "${FILESDIR}"/${PN}-5.1.2-get_cabac_inline_x86-32-bit.patch
82 )
83
84 MULTILIB_WRAPPED_HEADERS=(
85
86 diff --git a/media-video/ffmpeg/files/ffmpeg-4.4.3-get_cabac_inline_x86-32-bit.patch b/media-video/ffmpeg/files/ffmpeg-4.4.3-get_cabac_inline_x86-32-bit.patch
87 new file mode 100644
88 index 000000000000..ed273975452d
89 --- /dev/null
90 +++ b/media-video/ffmpeg/files/ffmpeg-4.4.3-get_cabac_inline_x86-32-bit.patch
91 @@ -0,0 +1,24 @@
92 +https://bugs.gentoo.org/901099 and partly https://bugs.gentoo.org/900937.
93 +
94 +Newer compilers may optimise such that < 7 registers are free on 32-bit x86
95 +and then we get an "invalid asm" error. This is https://bugs.gentoo.org/901099
96 +and https://trac.ffmpeg.org/ticket/8903.
97 +
98 +Making matters worse, GCC sometimes hangs on invalid asm, so this also
99 +mitigates a hang with e.g. -O3 -march=znver1. See https://bugs.gentoo.org/900937
100 +and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109137.
101 +
102 +In future, we may want to adjust the definition of HAVE_7REGS to just exclude
103 +32-bit x86, but that's a big sledgehammer, so let's avoid it for now until we have
104 +a reply on the upstream ffmpeg bug.
105 +--- a/libavcodec/x86/cabac.h
106 ++++ b/libavcodec/x86/cabac.h
107 +@@ -175,7 +175,7 @@
108 +
109 + #endif /* BROKEN_RELOCATIONS */
110 +
111 +-#if HAVE_7REGS && !BROKEN_COMPILER
112 ++#if HAVE_7REGS && !BROKEN_COMPILER && !ARCH_X86_32
113 + #define get_cabac_inline get_cabac_inline_x86
114 + static av_always_inline int get_cabac_inline_x86(CABACContext *c,
115 + uint8_t *const state)
116
117 diff --git a/media-video/ffmpeg/files/ffmpeg-5.1.2-get_cabac_inline_x86-32-bit.patch b/media-video/ffmpeg/files/ffmpeg-5.1.2-get_cabac_inline_x86-32-bit.patch
118 new file mode 100644
119 index 000000000000..40db3304b564
120 --- /dev/null
121 +++ b/media-video/ffmpeg/files/ffmpeg-5.1.2-get_cabac_inline_x86-32-bit.patch
122 @@ -0,0 +1,25 @@
123 +https://bugs.gentoo.org/901099 and partly https://bugs.gentoo.org/900937.
124 +
125 +Newer compilers may optimise such that < 7 registers are free on 32-bit x86
126 +and then we get an "invalid asm" error. This is https://bugs.gentoo.org/901099
127 +and https://trac.ffmpeg.org/ticket/8903.
128 +
129 +Making matters worse, GCC sometimes hangs on invalid asm, so this also
130 +mitigates a hang with e.g. -O3 -march=znver1. See https://bugs.gentoo.org/900937
131 +and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109137.
132 +
133 +In future, we may want to adjust the definition of HAVE_7REGS to just exclude
134 +32-bit x86, but that's a big sledgehammer, so let's avoid it for now until we have
135 +a reply on the upstream ffmpeg bug.
136 +--- a/libavcodec/x86/cabac.h
137 ++++ b/libavcodec/x86/cabac.h
138 +@@ -175,7 +175,7 @@
139 +
140 + #endif /* BROKEN_RELOCATIONS */
141 +
142 +-#if HAVE_7REGS && !BROKEN_COMPILER
143 ++#if HAVE_7REGS && !BROKEN_COMPILER && !ARCH_X86_32
144 + #define get_cabac_inline get_cabac_inline_x86
145 + static
146 + #if defined(_WIN32) && !defined(_WIN64) && defined(__clang__)
147 +