From: Aman Karmani <ffmpeg@tmm1.net>
To: ffmpeg-devel@ffmpeg.org
Cc: aman@tmm1.net
Subject: [FFmpeg-devel] [PATCH v4 2/5] build: detect Metal.framework and build .metal files
Date: Fri, 17 Dec 2021 12:04:15 -0800
Message-ID: <20211217200418.68942-2-ffmpeg@tmm1.net> (raw)
In-Reply-To: <20211217200418.68942-1-ffmpeg@tmm1.net>
From: Aman Karmani <aman@tmm1.net>
Reviewed-by: Ridley Combs <rcombs@rcombs.me>
Signed-off-by: Aman Karmani <aman@tmm1.net>
---
.gitignore | 3 +++
configure | 12 +++++++++++-
ffbuild/common.mak | 9 +++++++++
3 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/.gitignore b/.gitignore
index 9ed24b542e..1a5bb29ad5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,6 +19,9 @@
*.swp
*.ver
*.version
+*.metal.air
+*.metallib
+*.metallib.c
*.ptx
*.ptx.c
*.ptx.gz
diff --git a/configure b/configure
index 5fffcb8afe..32a39f5f5b 100755
--- a/configure
+++ b/configure
@@ -309,6 +309,7 @@ External library support:
if openssl, gnutls or libtls is not used [no]
--enable-mediacodec enable Android MediaCodec support [no]
--enable-mediafoundation enable encoding via MediaFoundation [auto]
+ --disable-metal disable Apple Metal framework [autodetect]
--enable-libmysofa enable libmysofa, needed for sofalizer filter [no]
--enable-openal enable OpenAL 1.1 capture support [no]
--enable-opencl enable OpenCL processing [no]
@@ -382,6 +383,8 @@ Toolchain options:
--dep-cc=DEPCC use dependency generator DEPCC [$cc_default]
--nvcc=NVCC use Nvidia CUDA compiler NVCC or clang [$nvcc_default]
--ld=LD use linker LD [$ld_default]
+ --metalcc=METALCC use metal compiler METALCC [$metalcc_default]
+ --metallib=METALLIB use metal linker METALLIB [$metallib_default]
--pkg-config=PKGCONFIG use pkg-config tool PKGCONFIG [$pkg_config_default]
--pkg-config-flags=FLAGS pass additional flags to pkgconf []
--ranlib=RANLIB use ranlib RANLIB [$ranlib_default]
@@ -2564,6 +2567,8 @@ CMDLINE_SET="
ln_s
logfile
malloc_prefix
+ metalcc
+ metallib
nm
optflags
nvcc
@@ -3835,6 +3840,8 @@ host_cc_default="gcc"
doxygen_default="doxygen"
install="install"
ln_s_default="ln -s -f"
+metalcc_default="xcrun metal"
+metallib_default="xcrun metallib"
nm_default="nm -g"
pkg_config_default=pkg-config
ranlib_default="ranlib"
@@ -4435,7 +4442,7 @@ if enabled cuda_nvcc; then
fi
set_default arch cc cxx doxygen pkg_config ranlib strip sysinclude \
- target_exec x86asmexe
+ target_exec x86asmexe metalcc metallib
enabled cross_compile || host_cc_default=$cc
set_default host_cc
@@ -6326,6 +6333,7 @@ check_apple_framework CoreFoundation
check_apple_framework CoreMedia
check_apple_framework CoreVideo
check_apple_framework CoreAudio
+check_apple_framework Metal
enabled avfoundation && {
disable coregraphics applicationservices
@@ -7620,6 +7628,8 @@ ARFLAGS=$arflags
AR_O=$ar_o
AR_CMD=$ar
NM_CMD=$nm
+METALCC=$metalcc
+METALLIB=$metallib
RANLIB=$ranlib
STRIP=$strip
STRIPTYPE=$striptype
diff --git a/ffbuild/common.mak b/ffbuild/common.mak
index 0eb831d434..e79b509425 100644
--- a/ffbuild/common.mak
+++ b/ffbuild/common.mak
@@ -112,6 +112,15 @@ COMPILE_LASX = $(call COMPILE,CC,LASXFLAGS)
$(BIN2CEXE): ffbuild/bin2c_host.o
$(HOSTLD) $(HOSTLDFLAGS) $(HOSTLD_O) $^ $(HOSTEXTRALIBS)
+%.metal.air: %.metal
+ $(METALCC) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) -o $@
+
+%.metallib: %.metal.air
+ $(METALLIB) --split-module-without-linking $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) -o $@
+
+%.metallib.c: %.metallib $(BIN2CEXE)
+ $(BIN2C) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) $@ $(subst .,_,$(basename $(notdir $@)))
+
%.ptx: %.cu $(SRC_PATH)/compat/cuda/cuda_runtime.h
$(COMPILE_NVCC)
--
2.33.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2021-12-17 20:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-17 20:04 [FFmpeg-devel] [PATCH v4 1/5] avfilter/vf_yadif_cuda: simplify filter definition Aman Karmani
2021-12-17 20:04 ` Aman Karmani [this message]
2021-12-17 20:04 ` [FFmpeg-devel] [PATCH v4 3/5] avutil: add obj-c helpers into header-only include Aman Karmani
2021-12-19 17:09 ` James Almer
2021-12-19 17:35 ` Aman Karmani
2021-12-19 18:03 ` Marvin Scholz
2021-12-19 22:17 ` Ridley Combs
2021-12-17 20:04 ` [FFmpeg-devel] [PATCH v4 4/5] avfilter: add metal utilities Aman Karmani
2021-12-17 20:04 ` [FFmpeg-devel] [PATCH v4 5/5] avfilter: add vf_yadif_videotoolbox Aman Karmani
2021-12-17 21:38 ` Philip Langdale
2021-12-18 20:02 ` Aman Karmani
2021-12-19 0:48 ` Pavel Koshevoy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211217200418.68942-2-ffmpeg@tmm1.net \
--to=ffmpeg@tmm1.net \
--cc=aman@tmm1.net \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git