From 63c076a6aa3fd2d4928a82cda50f2f5107729b87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=BCller?= Date: Fri, 29 May 2020 23:54:22 +0200 Subject: [PATCH] ardour6: initial add 6.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It builds without issues but running it caused crashes caused by memory access alignment errors. Signed-off-by: Andreas Müller --- ...-flags-that-cause-trouble-for-cross-.patch | 66 +++++ ...rinsics-if-available-for-mixing-func.patch | 229 ++++++++++++++++++ recipes-musicians/ardour/ardour6_git.bb | 106 ++++++++ 3 files changed, 401 insertions(+) create mode 100644 recipes-musicians/ardour/ardour6/0001-remove-all-build-flags-that-cause-trouble-for-cross-.patch create mode 100644 recipes-musicians/ardour/ardour6/0002-Use-ARM-NEON-intrinsics-if-available-for-mixing-func.patch create mode 100644 recipes-musicians/ardour/ardour6_git.bb diff --git a/recipes-musicians/ardour/ardour6/0001-remove-all-build-flags-that-cause-trouble-for-cross-.patch b/recipes-musicians/ardour/ardour6/0001-remove-all-build-flags-that-cause-trouble-for-cross-.patch new file mode 100644 index 0000000..67152a3 --- /dev/null +++ b/recipes-musicians/ardour/ardour6/0001-remove-all-build-flags-that-cause-trouble-for-cross-.patch @@ -0,0 +1,66 @@ +From 24b6038dc7c235780038d3fce2d9c83fada6ac8b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Andreas=20M=C3=BCller?= +Date: Mon, 6 Feb 2017 23:33:45 +0100 +Subject: [PATCH] remove all build flags that cause trouble for cross + configure/build +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Upstream-Status: Inappropriate [cross specific] + +Signed-off-by: Andreas Müller + +--- + tools/autowaf.py | 1 + + wscript | 26 -------------------------- + 2 files changed, 1 insertion(+), 26 deletions(-) + +diff --git a/tools/autowaf.py b/tools/autowaf.py +index 375dc5909..bb7714335 100644 +--- a/tools/autowaf.py ++++ b/tools/autowaf.py +@@ -93,6 +93,7 @@ def copyfile (task): + + def check_header(conf, lang, name, define='', mandatory=True): + "Check for a header" ++ return True + includes = '' # search default system include paths + if sys.platform == "darwin": + includes = '/opt/local/include' +diff --git a/wscript b/wscript +index 9fd84bb2c..d4178cb36 100644 +--- a/wscript ++++ b/wscript +@@ -476,31 +476,6 @@ int main() { return 0; }''', + + compiler_flags.append ("-DARCH_X86") + +- if platform == 'linux' : +- +- # +- # determine processor flags via /proc/cpuinfo +- # +- +- if conf.env['build_target'] != 'i386': +- +- flag_line = os.popen ("cat /proc/cpuinfo | grep '^flags'").read()[:-1] +- x86_flags = flag_line.split (": ")[1:][0].split () +- +- if "mmx" in x86_flags: +- compiler_flags.append ("-mmmx") +- if "sse" in x86_flags: +- build_host_supports_sse = True +- if "3dnow" in x86_flags: +- compiler_flags.append ("-m3dnow") +- +- if cpu == "i586": +- compiler_flags.append ("-march=i586") +- elif cpu == "i686": +- compiler_flags.append ("-march=i686") +- +- if not is_clang and ((conf.env['build_target'] == 'i686') or (conf.env['build_target'] == 'x86_64')) and build_host_supports_sse: +- compiler_flags.extend ([ flags_dict['sse'], flags_dict['fpmath-sse'], flags_dict['xmmintrinsics'] ]) + + if (conf.env['build_target'] == 'mingw'): + if (re.search ("(x86_64|AMD64)", cpu) != None): diff --git a/recipes-musicians/ardour/ardour6/0002-Use-ARM-NEON-intrinsics-if-available-for-mixing-func.patch b/recipes-musicians/ardour/ardour6/0002-Use-ARM-NEON-intrinsics-if-available-for-mixing-func.patch new file mode 100644 index 0000000..19d49b6 --- /dev/null +++ b/recipes-musicians/ardour/ardour6/0002-Use-ARM-NEON-intrinsics-if-available-for-mixing-func.patch @@ -0,0 +1,229 @@ +From 610ce4e19b0b39d0e8391057b22163d4fdc7bdb4 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Andreas=20M=C3=BCller?= +Date: Mon, 3 Jul 2017 23:24:55 +0200 +Subject: [PATCH 2/2] Use ARM NEON intrinsics if available for mixing functions +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Andreas Müller +--- + libs/ardour/ardour/mix.h | 10 +++ + libs/ardour/globals.cc | 13 ++++ + libs/ardour/mix.cc | 157 +++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 180 insertions(+) + +diff --git a/libs/ardour/ardour/mix.h b/libs/ardour/ardour/mix.h +index 4676c01..55919f0 100644 +--- a/libs/ardour/ardour/mix.h ++++ b/libs/ardour/ardour/mix.h +@@ -65,6 +65,16 @@ LIBARDOUR_API void veclib_mix_buffers_no_gain (ARDOUR::Sample * dst, cons + + #endif + ++#if defined (__ARM_NEON__) ++ ++LIBARDOUR_API float neon_compute_peak (const ARDOUR::Sample * buf, ARDOUR::pframes_t nsamples, float current); ++LIBARDOUR_API void neon_find_peaks (const ARDOUR::Sample * buf, ARDOUR::pframes_t nsamples, float *min, float *max); ++LIBARDOUR_API void neon_apply_gain_to_buffer (ARDOUR::Sample * buf, ARDOUR::pframes_t nframes, float gain); ++LIBARDOUR_API void neon_mix_buffers_with_gain (ARDOUR::Sample * dst, const ARDOUR::Sample * src, ARDOUR::pframes_t nframes, float gain); ++LIBARDOUR_API void neon_mix_buffers_no_gain (ARDOUR::Sample * dst, const ARDOUR::Sample * src, ARDOUR::pframes_t nframes); ++ ++#endif ++ + /* non-optimized functions */ + + LIBARDOUR_API float default_compute_peak (const ARDOUR::Sample * buf, ARDOUR::pframes_t nsamples, float current); +diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc +index 28eb818..d562b35 100644 +--- a/libs/ardour/globals.cc ++++ b/libs/ardour/globals.cc +@@ -222,6 +222,19 @@ setup_hardware_optimization (bool try_optimization) + + info << "Apple VecLib H/W specific optimizations in use" << endmsg; + } ++#elif defined (__ARM_NEON__) ++ // No runtime detection ++ compute_peak = neon_compute_peak; ++ find_peaks = neon_find_peaks; ++ apply_gain_to_buffer = neon_apply_gain_to_buffer; ++ mix_buffers_with_gain = neon_mix_buffers_with_gain; ++ mix_buffers_no_gain = neon_mix_buffers_no_gain; ++ copy_vector = default_copy_vector; ++ ++ generic_mix_functions = false; ++ ++ info << "ARM NEON optimizations in use" << endmsg; ++ + #endif + + /* consider FPU denormal handling to be "h/w optimization" */ +diff --git a/libs/ardour/mix.cc b/libs/ardour/mix.cc +index 96ae624..d1a46a2 100644 +--- a/libs/ardour/mix.cc ++++ b/libs/ardour/mix.cc +@@ -182,4 +182,161 @@ veclib_mix_buffers_no_gain (ARDOUR::Sample * dst, const ARDOUR::Sample * src, pf + + #endif + ++#if defined (__ARM_NEON__) ++#include ++ ++float ++neon_compute_peak (const ARDOUR::Sample * buf, ARDOUR::pframes_t nsamples, float current) ++{ ++ float32x4_t v4current = vdupq_n_f32(current); ++ float32x4_t v4work; ++ float32x2_t v2current; ++ ++ // unaligned lead (spread single float to vector) ++ while (((intptr_t)buf) % 16 != 0 && nsamples > 0) { ++ v4work = vdupq_n_f32(*buf); ++ v4current = vmaxq_f32(v4current, vabsq_f32(v4work)); ++ ++ buf++; ++ nsamples--; ++ } ++ // aligned ++ while (nsamples >= 4) { ++ v4work = vld1q_f32(buf); ++ v4current = vmaxq_f32(v4current, vabsq_f32(v4work)); ++ ++ buf+=4; ++ nsamples-=4; ++ } ++ // rest < 4 (spread single float to vector) ++ while (nsamples > 0) { ++ v4work = vdupq_n_f32(*buf); ++ v4current = vmaxq_f32(v4current, vabsq_f32(v4work)); ++ ++ buf++; ++ nsamples--; ++ } ++ ++ // calc max in vector by pairwise max done twice ++ v2current = vpmax_f32(vget_low_f32(v4current), vget_high_f32(v4current)); ++ v2current = vpmax_f32(v2current, v2current); ++ return vget_lane_f32(v2current, 0); ++} ++ ++void ++neon_find_peaks (const ARDOUR::Sample * buf, ARDOUR::pframes_t nsamples, float *min, float *max) ++{ ++ float32x4_t v4min = vdupq_n_f32(*min); ++ float32x4_t v4max = vdupq_n_f32(*max); ++ float32x4_t v4work; ++ float32x2_t v2min, v2max; ++ ++ // vector ++ while (nsamples >= 4) { ++ v4work = vld1q_f32(buf); ++ v4min = vminq_f32(v4min, v4work); ++ v4max = vmaxq_f32(v4max, v4work); ++ ++ buf+=4; ++ nsamples-=4; ++ } ++ // rest < 4 (spread single float to vector) ++ while (nsamples > 0) { ++ v4work = vdupq_n_f32(*buf); ++ v4min = vminq_f32(v4min, v4work); ++ v4max = vmaxq_f32(v4max, v4work); ++ ++ buf++; ++ nsamples--; ++ } ++ ++ // calc min in vector by pairwise max done twice ++ v2min = vpmin_f32(vget_low_f32(v4min), vget_high_f32(v4min)); ++ v2min = vpmax_f32(v2min, v2min); ++ *min = vget_lane_f32(v2min, 0); ++ // calc max in vector by pairwise max done twice ++ v2max = vpmax_f32(vget_low_f32(v4max), vget_high_f32(v4max)); ++ v2max = vpmax_f32(v2max, v2max); ++ *max = vget_lane_f32(v2max, 0); ++} ++ ++void ++neon_apply_gain_to_buffer (ARDOUR::Sample * buf, ARDOUR::pframes_t nframes, float gain) ++{ ++ float32x4_t v4gain = vdupq_n_f32(gain); ++ float32x4_t v4work; ++ ++ // vector ++ while (nframes >= 4) { ++ v4work = vld1q_f32(buf); ++ v4work = vmulq_f32(v4work, v4gain); ++ vst1q_f32(buf, v4work); ++ ++ buf+=4; ++ nframes-=4; ++ } ++ // rest < 4 ++ while (nframes > 0) { ++ *buf *= gain; ++ ++ buf++; ++ nframes--; ++ } ++} ++ ++void ++neon_mix_buffers_with_gain (ARDOUR::Sample * dst, const ARDOUR::Sample * src, ARDOUR::pframes_t nframes, float gain) ++{ ++ float32x4_t v4gain = vdupq_n_f32(gain); ++ float32x4_t v4src, v4dst; ++ ++ // vector ++ while (nframes >= 4) { ++ v4src = vld1q_f32(src); ++ v4dst = vld1q_f32(dst); ++ // v4dst = v4dst + v4src * v4gain ++ v4dst = vmlaq_f32(v4dst, v4src, v4gain); ++ vst1q_f32(dst, v4dst); ++ ++ src+=4; ++ dst+=4; ++ nframes-=4; ++ } ++ // rest < 4 ++ while (nframes > 0) { ++ *dst += *src * gain; ++ ++ src++; ++ dst++; ++ nframes--; ++ } ++} ++ ++void ++neon_mix_buffers_no_gain (ARDOUR::Sample * dst, const ARDOUR::Sample * src, ARDOUR::pframes_t nframes) ++{ ++ float32x4_t v4src, v4dst; ++ ++ // vector ++ while (nframes >= 4) { ++ v4src = vld1q_f32(src); ++ v4dst = vld1q_f32(dst); ++ v4dst = vaddq_f32(v4dst, v4src); ++ vst1q_f32(dst, v4dst); ++ ++ src+=4; ++ dst+=4; ++ nframes-=4; ++ } ++ // rest < 4 ++ while (nframes > 0) { ++ *dst += *src; ++ ++ src++; ++ dst++; ++ nframes--; ++ } ++} ++ ++#endif + +-- +2.9.4 + diff --git a/recipes-musicians/ardour/ardour6_git.bb b/recipes-musicians/ardour/ardour6_git.bb new file mode 100644 index 0000000..4759917 --- /dev/null +++ b/recipes-musicians/ardour/ardour6_git.bb @@ -0,0 +1,106 @@ +SUMMARY = "Ardour is a multi-channel digital audio workstation" +HOMEPAGE = "http://ardour.org/" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://COPYING;md5=4641e94ec96f98fabc56ff9cc48be14b" + +DEPENDS += " \ + gettext-native \ + gtk+ \ + gtkmm \ + cppunit \ + jack \ + alsa-lib \ + fftw \ + vamp-plugin-sdk \ + aubio \ + taglib \ + boost \ + virtual/libx11 \ + dssi \ + zlib \ + lrdf \ + rubberband \ + suil \ + lilv \ + libarchive \ + libltc \ + qm-dsp \ + fluidsynth \ + hidapi \ +" + +inherit waf features_check gtk-icon-cache pkgconfig python3native mime-xdg + +REQUIRED_DISTRO_FEATURE = "x11" + +SRC_URI = " \ + git://github.com/Ardour/ardour.git \ + file://0001-remove-all-build-flags-that-cause-trouble-for-cross-.patch \ + file://0002-Use-ARM-NEON-intrinsics-if-available-for-mixing-func.patch \ +" +SRCREV = "360c81b815efe1e7b117ad6f96f8493f675d51bf" +PV = "6.0" +S = "${WORKDIR}/git" + +# arch specific override - default (tested) is ARM -> no fpu-optimizations +# can be something like i686 / x86_64 see file 'wscript' in sourcepath for more details +BUILD_DIST_TARGET ??= "none" + +EXTRA_OECONF = " \ + --configdir=${sysconfdir} \ + --bindir=${bindir} \ + --libdir=${libdir} \ + --optimize \ + --freedesktop \ + --cxx11 \ + --no-phone-home \ + --use-external-libs \ + --qm-dsp-include=${STAGING_INCDIR}/qm-dsp \ + \ + --with-backends="jack,alsa" \ + --dist-target=${BUILD_DIST_TARGET} \ +" + +PATH_append = ":${B}" + +# Asking fails - waf supports --bindir / --libdir +waf_preconfigure() { +} + +do_configure_prepend() { + # link python -> python3 + ln -sf `which python3` ${B}/python +} + +do_install_append() { + # install icons to freedesktop locations + for s in 16 22 32 48 256 512; do + install -d ${D}${datadir}/icons/hicolor/${s}x${s}/apps + ln -s ../../../../${BPN}/resources/Ardour-icon_${s}px.png \ + ${D}${datadir}/icons/hicolor/${s}x${s}/apps/${BPN}.png + done + + # install .desktop + install -d ${D}${datadir}/applications + install -m 0644 ${B}/gtk2_ardour/ardour6.desktop ${D}${datadir}/applications +} + +FILES_${PN}-dev += " \ + ${libdir}/${BPN}/libardour.so \ + ${libdir}/${BPN}/libardouralsautil.so \ + ${libdir}/${BPN}/libaudiographer.so \ + ${libdir}/${BPN}/libcanvas.so \ + ${libdir}/${BPN}/libevoral.so \ + ${libdir}/${BPN}/libgtkmm2ext.so \ + ${libdir}/${BPN}/libmidipp.so \ + ${libdir}/${BPN}/libpbd.so \ + ${libdir}/${BPN}/libptformat.so \ + ${libdir}/${BPN}/libtemporal.so \ + ${libdir}/${BPN}/libwaveview.so \ + ${libdir}/${BPN}/libwidgets.so \ + ${libdir}/${BPN}/vamp/*.so \ +" + +FILES_${PN}-staticdev += " \ + ${libdir}/${BPN}/*.a \ +"